7 if (sem_init(&id, 0, 0) < 0) {
12 /* This should fail with EAGAIN and leave the value at 0. */
13 if (sem_trywait(&id) >= 0) {
17 if (errno != EAGAIN) {
18 perror("wrong error from sem_trywait()");
22 if (checkvalue(&id, 0) < 0) {
27 if (sem_destroy(&id) < 0) {
28 perror("sem_destroy");