# Problem with Semaphores?



## RichieMUFC (Aug 19, 2009)

I'm on AMD64 FreeBSD 7.2. In user space, when I do something simple, such as below, I get "Bad system call (core dumped)"

I've tried adding in options P1003_1B_SEMAPHORES into /usr/src/sys/AMD64/conf/GENERIC. Can these options be turned on and turned off without recompiling the kernel? I've tried to use semaphores in kernel space without any problems, so I'm very confused as to whats going on in user space.

Thanks! 


```
#include <stdio.h>
#include <semaphore.h>

int main()
{
        sem_t sem;
        int ret = sem_init(&sem, 0, 1);
        printf("returned: %i\n", ret);

        return 0;
}
~
```


----------



## anemos (Aug 19, 2009)

```
kldload sem
```

sem(4)


----------

