This is the mail archive of the cygwin@cygwin.com 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]

semget and permission denied


Hi,
I am working with semaphores. When I try to get a semaphore, I use
semget, but it returns me a value <0. The strerror is: Permission
denied
I tried in different ways, but it still doesn't work...
Can you help me?

--------------------------------------------------------------------
#include <sys/types.h>
#include <sys/ipc.h>

	union semun {
		int val;
		struct semid_ds *buf;
		ushort * array;
	} argument;


#include <sys/sem.h>
#include <stdio.h>
#include <errno.h>
extern int errno; 

main()
{

key_t id;
int c=19;

   if (( id=semget((key_t)ftok("./semabinit.c", c), 1, 0666 |
IPC_CREAT))== -1) 
    printf("strerror says open failed: %s\n", strerror( errno ) ); 
return(id);

}

=====
c:\>ptk




__________________________________________________

__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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