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.
    Test code appear below:
      1 #include <sys/types.h>
      2 #include <string.h>
      3 #include <stdio.h>
      4 #include <sys/stat.h>
      5 #include <unistd.h>
      6 #include <fcntl.h>
      7 #include <errno.h>
      8 #include <pthread.h>
      9 #include <semaphore.h>
     10
     11 int main(int argc, char ** argv)
     12 {
     13     sem_t   mutex;
     14     if (-1 == sem_init (&mutex, 1, 1)) {
     15         printf("sem init error:%s\n", strerror(errno));
     16         exit(0);
     17     }
     18     sem_wait (&mutex);
     19     printf("sem wait ok:\n");
     20     sem_post (&mutex);
     21     sem_destroy (&mutex);
     22     return 0;
     23 }

Best regards,
Gary Li
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to