split internal lock API out of libc.h, creating lock.h