sema_trywait() returns 0 if successful. When any of the following conditions is detected, sema_trywait() fails and returns the corresponding value.
EINVAL
Description:sp refers to an invalid semaphore.
EBUSY
Description:The semaphore pointed to by sp has a zero count.