Cygwin IPC - ftok() returns negative values - Bug Report

Ken Brown kbrown@cornell.edu
Wed Jun 29 20:59:00 GMT 2016


On 6/29/2016 3:20 PM, Stanisław Wawszczak wrote:
>> On 29/06/2016 18:06, Stanisław Wawszczak wrote:
> *Real question is why Cygwin's implementation of getsem() is not allowing to ask for more than nsems == 1?*
> Here is stated, that the platform is limiting the nsems value: http://pubs.opengroup.org/onlinepubs/9699919799/functions/semget.html#tag_16_512
> This code is not working, return errno == 22 (EINVAL, I guess...)
> #include <sys/ipc.h>
> #include <sys/sem.h>
> #include <stdio.h>
> #include <errno.h>
>
> int main(int argc, char**argv)
> {
> 	int provs = 100;
> 	key_t semHandle = ftok("/etc/fstab", 'A');
> 	int sfcbSem = -1;
> 	printf("semHandle <= 0 ; (semHandle = %lld)\n", semHandle);
> 	if ((sfcbSem = semget(semHandle, 2, IPC_CREAT | IPC_EXCL | 0600)) == -1)
> 	{
> 		printf("error semget, errno = %d\n", errno);
> 	}
> 	printf("finished\n");
> 	return 0;
> }

Do you have the cygserver service running?  (See 
/usr/share/doc/Cygwin/cygserver.README.)

Ken

--
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



More information about the Cygwin mailing list