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

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Dec 17 09:55:00 GMT 2013


Please don't http://cygwin.com/acronyms/#TOFU

Thanks.

On Dec 16 12:11, Steven Bardwell wrote:
> 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

Yes, that's what I meant by writing "if you set up a matching environment."
Looks like you don't just run tools from CMD, you're trying to run the
tools outside of the Cygwin distro with its own Cygwin DLL.  If you do
that, you have to set up the environment around that DLL.  And you
should make sure to follow http://cygwin.com/licensing.html, should you
release your efforts to third parties.


Corinna


> 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.
> [...]

-- 
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/20131217/9f0e980c/attachment.sig>


More information about the Cygwin mailing list