delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/02/16/06:12:33

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDF51385B506
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1676545904;
bh=CS+F2+WGB/b+p0U5SWr8q74/oYeorIb9B8snwG0bmqE=;
h=Date:To:Cc:Subject:In-Reply-To:References:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=uNWJO/FlTwqUGf1YCvLnYksykUDyMqp+Wk57xU+oBmHJgIRq0Tfh3Q7o1Tn6/ka0b
NP4/InMye6cAq1GBiI9hIOF5tZ883bcGGOKAA4FrBEODXMspo+LWKnXqhPuJMfPcjM
XHOebvcSQGbuL2ePl7UxjD2YS+vbAv1fasRl4wAg=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FD173858D33
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 31GBAhuW000412
X-Nifty-SrcIP: [220.150.135.41]
Date: Thu, 16 Feb 2023 20:10:43 +0900
To: cygwin AT cygwin DOT com
Cc: Yeo Kai Wei <yeokaiwei AT hotmail DOT com>
Subject: Re: [QUERY] Help With Semaphore Error on Windows : Cygwin
Message-Id: <20230216201043.c13c211f8557fd2c36e4d1ca@nifty.ne.jp>
In-Reply-To: <PH0PR05MB9918C60D1BF4A9A8D25DEADEA4A09@PH0PR05MB9918.namprd05.prod.outlook.com>
References: <PH0PR05MB9918C60D1BF4A9A8D25DEADEA4A09 AT PH0PR05MB9918 DOT namprd05 DOT prod DOT outlook DOT com>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Thu, 16 Feb 2023 12:04:01 +0800
Yeo Kai Wei wrote:
> Hi All,
> 
> Could I request for some help on some code?
> 
> I ran into an error with semaphores with some book code using Cygwin on 
> Windows.
> 
> The code will throw an error with sem_post().
> 
> I compiled it with gcc -o memwriter memwriter.c -lrt -lpthread
> 
> $ ./memwriter
> Shared memory address: 0x6fffffff0000 [0..511]
> backing file: /dev/shm/shMemEx
> semptr is address 0x7ffffcc18 with value 0
> SEM_VALUE_MAX is 1147483648
> sem_post: Invalid argument <--------------------------- ERROR
> 
> 
> According to feedback, the above error does not turn up on Linux.
> 
> May I know if this is supposed to happen on Cygwin on Windows?
> 
> If not, how can I solve this?
> 
> I've also attached the code for reference.

Semaphore name which does not begin with slash (/) is not
portable.

See:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html

Cygwin disallows that.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

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

- Raw text -


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