This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Attachment: pgpWVULoPcNxf.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]