semget() API fails when run from CMD.exe but works from SH.exe

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Dec 16 09:56:00 GMT 2013


On Dec 14 08:04, Steven Bardwell wrote:
> I would like my Cygwin programs to work from a DOS (CMD.exe) window, but I
> am
> having problems with some API calls. Here is a simple program that tries to
> create
> a semaphore – it works fine when it is run from sh.exe (or in a mintty
> window), but
> it crashes when run in a DOS window. (The Cygwin service is running.)
> 
> Is there a way to make it work in both environments?

That's not the intention of the IPC calls.  They usually only work
if you set up a matching environment.

XSI IPC requires cygserver to run.  The XSI IPC structures are only kept
in memory and "something" has to keep them around and coordinate their
rather complex mechanics.  If cygserver isn't running, the XSI IPC calls
return ENOSYS.

If you need persistent semaphores, message queues or shared memory,
consider switching to POSIX IPC (sem_open, mq_open, shm_open and
friends).  They are backed by the filesystem, namely the Cygwin
directories /dev/mqueue and /dev/shm.  This makes them easier to work
with from a DOS shell.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20131216/bd60c339/attachment.sig>


More information about the Cygwin mailing list