On Thu, 2005-09-29 at 20:47 +0800, Gary Li-126 wrote: > Hi, > I always get the error message:"Operation not permitted" When I use > sem_init set pshared argument equal 1. Compiling as : "gcc -o sem_test > sem_test.c -lc_r". My freebsd ver is release 5.4 p6.
>From sem_init(3): A non-zero value for pshared specifies a shared semaphore that can be used by multiple processes, which this implementation is not capable of. I suspect you're asking the impossible. You could try using a different threading library, but libc_r won't work: /usr/src/lib/libc_r/uthread/uthread_sem.c: _sem_init(sem_t *sem, int pshared, unsigned int value) { [...] if (pshared != 0) { /* * The user wants a semaphore that can be shared among * processes, which this implementation can't do. Sounds like a * permissions problem to me (yeah right). */ errno = EPERM; retval = -1; goto RETURN; } This return code is documenbted in the sem_init man page: [EPERM] Unable to initialize a shared semaphore. Gavin _______________________________________________ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[EMAIL PROTECTED]"