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


OK -- I rewrote the test program using the POSIX IPC routine sem_open()
and the program runs in SH.exe (and mintty.exe) but gives this message 
when run from a DOS box:

Warning: '/dev/shm' does not exists or is not a directory.

POSIX semaphores require the existance of this directory.
Create the directory '/dev/shm' and set the permissions to 01777.
For instance on the command line: mkdir -m 01777 /dev/shm

Steve
-----------------------------------------------------------------------------------------------
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



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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