From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-03.nifty.com (conssluserg-03.nifty.com [210.131.2.82]) by sourceware.org (Postfix) with ESMTPS id 3FD173858D33 for ; Thu, 16 Feb 2023 11:11:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FD173858D33 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp Received: from HP-Z230 (aj135041.dynamic.ppp.asahi-net.or.jp [220.150.135.41]) (authenticated) by conssluserg-03.nifty.com with ESMTP id 31GBAhuW000412; Thu, 16 Feb 2023 20:10:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 31GBAhuW000412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1676545843; bh=5zadiDCXB0r0jjDYQZb75gCmOrM8yc6qHJqFlpuYATM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DQDJ1cE9ZkIiGrrahXBCKS2ATxhU9Df0KkscwWr5uqx2dK0Cw5aAEMnHil6asRNwi GVGk8+Gl81o5qda5JwWcljc6H5hryXNsg4xHWlKPeauXZNWmnWz6J1dJzOrYe4IEJr GDvqGKQfVZjiAwaAImZqPs1eL+JB7nJUhbzeOcV1bw0EoLsQ5a7pKylcCuFokk60nH 6R2JTKO4nRedodEMxo82HBSS6x+B2Cz/A/ux7FmfIYAoLlYTEwym2OBJFhUp6VK6LE WfctlnshQclz1Qq5OA65T1egLG+ZATMYt8kZlNzPrRHFLaZMzOOXg9Hja9qwtyRN14 jKtZX6Kn+SDog== X-Nifty-SrcIP: [220.150.135.41] Date: Thu, 16 Feb 2023 20:10:43 +0900 From: Takashi Yano To: cygwin@cygwin.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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 List-Id: 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