sem_open(3) and FBSD 5.2 : what the point ?

Dan Nelson dnelson at allantgroup.com
Fri Feb 6 13:32:46 PST 2004


In the last episode (Feb 06), Eric Jacoboni said:
> Here's a sample code:
> 
> #include <semaphore.h>
...
>    dis_ping = sem_open("/ping.sem", O_CREAT, 0777, 1);
...
> 
> On FBSD 5.2, gcc first complains it doesn't know about O_CREAT...
> That's not what the sem_open() manpage claims but, ok, let's include
> <fcntl.h>.
> 
> The code, then, compile ok, but fails on :
> 
> $ ./ping.exe
> zsh: invalid system call (core dumped)  ./ping.exe
> 
> Any idea?

Have you enabled them in your kernel config?  From /sys/conf/NOTES :

# p1003_1b_semaphores are very experimental,
# user should be ready to assist in debugging if problems arise.
options         P1003_1B_SEMAPHORES

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list