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]

IPC problems


I'm trying to port some Unix software that extensively uses shared
memory, semaphores, and threads.  Not sure if I'm pushing sh*t uphill,
but I got cygipc-1.13-2 installed, and the IPC daemon running.  I have a
simple case that hopefully shows my error ...

#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <cygwin/ipc.h>
#include <cygwin/shm.h>

int main (int argc, char **argv) {
	int		shm_id ;
	struct shmid_ds	shm_buf ;
	int		ret ;

	shm_id = shmget(1234, 1048576, IPC_CREAT | IPC_EXCL | 0660) ;
	printf ("shm_id = %d\n", shm_id) ;
	ret = shmctl (shm_id, IPC_STAT, &shm_buf) ;
	printf ("ret = %d (%s)\n", ret, (ret == -1 ? strerror(errno) :
"")) ;
}

[src]$ gcc aa.c -o aa -L/usr/local/lib -lcygipc
[src]$ ./aa
shm_id = 1280
ret = -1 (Invalid argument)
[src]$ ipcs -a

---------- Shared Memory Segments --------
     shmid     key       bytes     nattch    status      
_shm 1280      1234      1048576   0                     

---------- Semaphore Arrays --------
     semid     nsems     key       

---------- Message Queues --------
     msqid     used-bytes  messages    


What am I missing here ?  The code works fine on Linux, HP-UX, Solaris,
...

Thanks,

Steve


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