Mail Archives: cygwin/2003/07/08/14:56:58
--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Sergey,
Please post instead of sending private email.
Thanks,
Jason
--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
--pWyiEgJYm5f9v55/
Content-Type: message/rfc822
Content-Disposition: inline
Received: from cust_req_fwding (jason AT tishler DOT net --> jt AT tishler DOT net) by lmg.ahnet.net id <309477-2624>; Tue, 8 Jul 2003 10:43:02 -0700
Received: from whale.sunbay.crimea.ua ([212.110.138.65]) by lmg.ahnet.net with ESMTP id <344341-2624>; Tue, 8 Jul 2003 10:42:02 -0700
Received: from whale.sunbay.crimea.ua (root AT localhost)
by whale.sunbay.crimea.ua (8.12.9/8.12.8/Sunbay) with SMTP id h68HfhUF071150
for <jason AT tishler DOT net>; Tue, 8 Jul 2003 20:41:44 +0300 (EEST)
(envelope-from sigurd AT sunbay DOT com)
Received: from sunbay.com (drakkar.sunbay.crimea.ua [192.168.4.74])
(authenticated bits=0)
by whale.sunbay.crimea.ua (8.12.9/8.12.8/kavkeeper) with ESMTP id h68HfIQi071064
for <jason AT tishler DOT net>; Tue, 8 Jul 2003 20:41:43 +0300 (EEST)
(envelope-from sigurd AT sunbay DOT com)
Message-ID: <3F0B023E DOT 5080805 AT sunbay DOT com>
Date: Tue, 08 Jul 2003 20:41:18 +0300
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b) Gecko/20030507
X-Accept-Language: en-us, en, ru, de
MIME-Version: 1.0
Subject: shmctl(blabla,IPC_RMID,NULL) question
Content-Type: multipart/mixed;
boundary="------------010200050807090002060103"
From: Sergey Benner <sigurd AT sunbay DOT com>
To: jason AT tishler DOT net
X-Bogosity: No, tests=bogofilter, spamicity=0.000006, version=0.11.1.3
This is a multi-part message in MIME format.
--------------010200050807090002060103
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Dear Jason,
I've got some issues with IPC_RMID under cygwin, I got cygipc1.4.
Under Linux it works perfect but under windows it doesn't remove the
schmid.
First you have to start ipctest then start getshm. Find them in attach.
The first one allocates the memory writes the pid to it and the other
gets the memory removes the shmid and kills the previous application by
the pid.
very simple.
Then when I start ipcs it shows me that the identifer wasn't removed
though it didn't write me any error in shmctl. T
hen I have to remove the identifer by hand
with ipcrm.
What could that be?
thank you for your response
--------------010200050807090002060103
Content-Type: text/plain;
name="getshm.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="getshm.c"
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
int main(int argc,char *argv){
int shmid;
key_t key;
char *shm, *s;
/*
* We need to get the segment named
* "5678", created by the server.
*/
key = 5000;
/*
* Locate the segment.
*/
if ((shmid = shmget(key, 0x2, 0666)) < 0) {
perror("shmget");
exit(1);
}
printf("get shmid = %d\n",shmid);
/*
* Now we attach the segment to our data space.
*/
if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) {
perror("shmat");
exit(1);
}
printf("pid of other proc = %s\n",shm);
if(!shmctl(shmid,IPC_RMID,NULL))
perror("shmctl");
if(kill(atoi(shm),SIGINT)!=0)
perror("cant kill");
}
--------------010200050807090002060103
Content-Type: text/plain;
name="ipctest.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ipctest.c"
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <strings.h>
int main (int argc, char* argv[]){
pid_t pid = getpid ();
key_t key = 5000;
char *shmem;
int shmid;
shmid= shmget (key,0x400,IPC_CREAT|IPC_EXCL|S_IRUSR|S_IWUSR);
printf("shmid : %d\n",shmid);
printf("pid : %d\n",pid);
shmem = (char *)shmat(shmid,0,0);
sprintf(shmem,"%d",pid);
printf("shmem : %s\n",shmem);
shmdt(shmem);
for(;;)
pause();
shmctl (shmid, IPC_RMID, 0);
}
--------------010200050807090002060103--
--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--pWyiEgJYm5f9v55/--
- Raw text -