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 Subject: Re: [QUERY] Help With Semaphore Error on Windows : Cygwin Message-Id: <20230216201043.c13c211f8557fd2c36e4d1ca@nifty.ne.jp> In-Reply-To: References: 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 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Takashi Yano via Cygwin Reply-To: Takashi Yano Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" 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 -- 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