Unsufficient number of semaphores in a set

Krzysztof Duleba krzysan@skrzynka.pl
Wed May 19 02:44:00 GMT 2004


Hello

I expreience strange Cygwin behaviour when I try to create a big semaphore
set. I wrote a simple test case as following:

$ cat semtest.c
#include <sys/sem.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>

int main(){
  int i, sem_id;
  scanf("%d", &i);
  if((sem_id = semget(1000, i, IPC_CREAT | IPC_EXCL)) == -1){
    fprintf(stderr, "%d; %s\n", errno, strerror(errno));
    exit(1);
  }

  if(semctl(sem_id, 0, IPC_RMID) == -1){
    fprintf(stderr, "%d; %s\n", errno, strerror(errno));
    exit(1);
  }
  printf("ok\n");
  return 0;
}


My Cygwin returns:

$ echo 59|./semtest
ok

$ echo 60|./semtest
ok

$ echo 61|./semtest
22; Invalid argument



On my friend's Linux box:

$ echo 61|./semtest
ok
$ echo 250|./semtest
ok
$ echo 251|./semtest
22; Invalid argument



In /usr/include/cygipc/sys one can find

#define SEMMSL  32              /* <= 512 max num of semaphores per id */

It's obviously not the case. How can I have Cygwin allowing semaphore set
of size 250?

Regards
Krzysztof Duleba
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 19337 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040519/5005c398/attachment.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list