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