cygwinsemaphoresysv-ipc

Using System V semaphores under Cygwin: Bad system call


I'm having a problem with POSIX Semaphores under Cygwin, I've tried the following:

$ semtool c 1
Attempting to create new semaphore set with 1 members
Bad system call
$

the semtool above tries to create (via semget, semctl etc sys. calls) a new semaphore. However it doesn't work: Bad system call.

Also a minimalistic test C program using semget() fails spitting out the same message: Bad system call.

I've done my googling: installed cygserver, defined an environment variable CYGWIN to "server", but nothing helped. My version of cygwin is pretty new:

$ cygcheck -c | grep cygwin
base-cygwin                     3.0-1                OK
cygwin                          1.7.9-1              OK
cygwin-doc                      1.7-1                OK
cygwin-x-doc                    1.1.1-1              OK
$

Any thoughts/hints what might be still missing?

tried now with the additional export:

$ export CYGWIN=server

the service is running

$ net start | grep -i cyg
   CYGWIN cygserver
$

no more error:

$ semtool c 1
Attempting to create new semaphore set with 1 members
$

seems to work now!


Solution

  • Is cygserver running?

    Update: this worked for me under Windows 7:

    1. Ran cygserver-config (as administrator), answered "yes" when prompted.
    2. Started "CYGWIN cygserver" service.
    3. Executed "export CYGWIN=server" in cygwin shell.

    At this point I could run semtool to create/lock/unlock a semaphore as well as semstat to display its state.