delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/12/16/12:11:54

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:from:to:references:in-reply-to
:subject:date:message-id:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=ZUFYasoQHKDEm9K1
eGQspZT0xxtL4AYEl28MtMykzwPjmpPua/j8pzlVCpYD3VETzy+dXd25iJY0V+8B
gyKE/PuJSY2pf0/KJD5xcCDJAug+c6qolRd6Dh4iMUaYMgYXmPqFtPtzWgCLsE+y
uWoDVgyL2085CgTWkAUCSyXnTnc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:from:to:references:in-reply-to
:subject:date:message-id:mime-version:content-type
:content-transfer-encoding; s=default; bh=aTWXn1VZfjdM9Pr5qM7/Qo
Kytmo=; b=NPeyzUh2PENyCgbh3nAnTmnmm8Ck1q6iOTPmXP0YOi77xHV12mZYTv
tIAxeHr5XZXUIz3mbVotJ9f9VLjLTMihMRtuvV2YowHYpTVLfzftJiqxP1Nls5SQ
l9qA9Qgxqxoe7qRLXghKdG88UlUcOdD8yZXr4Gy/R0YptOgbEeb+s=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2
X-HELO: p3plsmtpa07-02.prod.phx3.secureserver.net
Reply-To: <sbardwell AT lbmsys DOT com>
From: "Steven Bardwell" <SBardwell AT lbmsys DOT com>
To: <cygwin AT cygwin DOT com>
References: <015701cef8cc$fb2f7010$f18e5030$@lbmsys.com> <20131216095623 DOT GJ9487 AT calimero DOT vinschen DOT de>
In-Reply-To: <20131216095623.GJ9487@calimero.vinschen.de>
Subject: RE: semget() API fails when run from CMD.exe but works from SH.exe
Date: Mon, 16 Dec 2013 12:11:11 -0500
Message-ID: <02cd01cefa81$d6f13420$84d39c60$@lbmsys.com>
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id rBGHBnvQ002564

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019