delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/25/05:15:18

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Steve Baldwin" <stbaldwin AT multiservice DOT com>
To: <cygwin AT cygwin DOT com>
Subject: IPC problems
Date: Tue, 25 Feb 2003 21:14:56 +1100
Message-ID: <000001c2dcb6$bfd76c40$3264a8c0@AUSTBMOBILE>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019