11 list_semaphores(const char* process
)
13 printf("%s (%ld) semaphores:\n", process
, find_thread(NULL
));
17 while (get_next_sem_info(B_CURRENT_TEAM
, &cookie
, &semInfo
) == B_OK
)
18 printf(" %9ld %s\n", semInfo
.sem
, semInfo
.name
);
27 fprintf(stderr
, "Error: fork() failed: %s\n", strerror(errno
));
32 // the parent process -- wait for the child to finish
34 wait_for_thread(child
, &result
);
37 list_semaphores(child
== 0 ? "child" : "parent");