This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Cygwin IPC - ftok() returns negative values - Bug Report
- From: StanisÅaw Wawszczak <stanislaw dot wawszczak at iscg dot pl>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Wed, 29 Jun 2016 16:06:30 +0000
- Subject: RE: Cygwin IPC - ftok() returns negative values - Bug Report
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp dot mailfrom=stanislaw dot wawszczak at iscg dot pl;
- References: <AM3PR05MB3399758BC225C8E63BACF0FEB230 at AM3PR05MB339 dot eurprd05 dot prod dot outlook dot com> <20160629151446 dot GO981 at calimero dot vinschen dot de>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Dear Corinna,
I am sorry about confusing you.
Simply:
----------------------------- Issue ------------------------------------
Call to ftok() returns negative value
----------------------------- Conditions -----------------------------
Windows 2012 R2 with latest patches
Cygwin x64 installed from exe installer got two weeks ago
$ cygcheck -V
cygcheck (cygwin) 2.5.2
System Checker for Cygwin
Copyright (C) 1998 - 2016 Cygwin Authors
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
----------------------------- Test case -------------------------------
#include <sys/ipc.h>
#include <stdio.h>
int main(int argc, char**argv)
{
key_t semHandle = ftok("/etc/fstab", 'A');
printf("started\n");
if(semHandle <= 0)
{
printf("semHandle <= 0 ; (semHandle = %lld)\n", semHandle);
}
else
{
printf("semHandle > 0 ; (semHandle = %lld)\n", semHandle);
}
printf("finished\n");
return 0;
}
--------------------------- Result -----------------------------------
$ ./test.exe
started
semHandle <= 0 ; (semHandle = -5833568887996598975)
finished
Pozdrawiam/Best Regards,
StanisÅaw Wawszczak
Architekt Systemowy
ISCG Sp. z o.o.
Poland
-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of Corinna Vinschen
Sent: Wednesday, June 29, 2016 5:15 PM
To: cygwin@cygwin.com
Subject: Re: Cygwin IPC - ftok() returns negative values - Bug Report
On Jun 29 13:14, StanisÅaw Wawszczak wrote:
> Dear All,
> Â
> I have had to compile sblim-sfcbd-1.4.10 on Cygwin. It is using IPC semaphores.
> Unfortunately it is returning wrong value as the result of complicated bit-wise logical operations.
> I have tried to âhack the systemâ and make multiplication of returned
> value by -1, but it triggers error in semget()
> Environment:
> Windows 2012 R2 with latest patches
> I have installed Cygwin from official installer couple days ago.
> Â
> I have attached the gdb session from such invocation. You can see the path and id in arguments are correct and stat() function returns correct values.
> Finally result in %rax is negative:
> raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000701cc1d53ÂÂÂÂÂÂ -5833568862233420461
Ok, but what's the exact problem? Following a GDB session is kind of a lot of work. Simple, very short, self-contained testcase, perhaps?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat