This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]