Move posix layer from 'kernel' to 'lib' folder as it is not
a core kernel feature.
Fixed posix header file dependencies as part of the move and
also removed NEWLIBC related macros from posix headers.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Modifies several functions that are causing wrong
behaviour.
* semaphore.h: add missing restrict keyword.
* sem_destroy(): check that nobody is waiting
before destroying the object.
* sem_timedwait(): simpify function logic and
fix a bug when abstime > currtime, that passed
ticks instead of ms to k_sem_take().
* sem_wait(): avoid unnecessary checks.
* sem_init(): add pshared value assertion.
Signed-off-by: Juan Manuel Torres Palma <j.m.torrespalma@gmail.com>