1 Reply Latest reply: May 7, 2013 1:59 AM by sscdvp RSS

    sem_init() failure on Solaris 11

    1004850
      sem_init() fails with errno=22 (EINVAL) on Solaris 11.

      From man pages, I understand that the function shall fail with EINVAL if the third argument value exceeds {SEM_VALUE_MAX}. In my case, this argument seems to be alright.

      Here is the sample code.

           sem_t sp;
      int iRC=0;
      // try to initialize semaphore first...
      errno=0;
      iRC = sem_init(&sp, 1, 1); // shared, initial value of 1
      if( iRC ) {
      printf("sem_init failed with errno=%d",errno) ;
      }

      This works without errors for one instance of the process on the machine. Rest all instances fail with the error.

      I am clueless here. Can you please help?