libc - change SEM_VALUE_MAX

sem_getvalue(3) requires a signed int count so change SEM_VALUE_MAX to INT_MAX.
libc - bail out on invalid sem_open(3) flags

Preventing now callers from passing invalid flags prevents compatibility
issue should new flags be added to sem_open(3) in future standard
revisions.
libc - improve posix semaphore initialization

Create directory storing named semaphore on per-process initialization.

Also add error handling.
add posix semaphore test suite

Port FreeBSD test suite, remove tests specific to FreeBSD
implementation, and modify tests that do not comply with the standard.

Obtained-from:   FreeBSD