Path: utzoo!dciem!psddevl!root From: root@psddevl.UUCP (root) Newsgroups: comp.unix.questions Subject: how to use the System V shared memory feature Message-ID: <217@psddevl.UUCP> Date: 21 Jan 88 19:59:57 GMT Article-I.D.: psddevl.217 Posted: Thu Jan 21 14:59:57 1988 Organization: Northern Telecom, Bramalea, Ontario Lines: 26 I am trying to use the shared memory scheme to overlay a process's own data space. However, I keep on getting the 'invalid argument' error. My program is as follows: #include #include #include #include #define SHMKEY (key_t)0*10 char shm[1024*20] = '0'; main() { char *shmat(); int shmid; if ((shmid = shmget(SHMKEY,sizeof(shm), 0600|IPC_CREAT|IPC_EXCL)) < 0) exit(1,perror("shmget")); if (shmat(shmid, (char *)shm, 0) == ((char *) -1)) exit(2,perror("shmat")); } Forcing the address of shm to be a multiple of 4K still does not work. (4K is the page size on my machine.) Any suggestions as to what I have done wrong will be deeply appreciated. Please send comments to {dciem,utzoo}!psddevl!nelson. My phone number is (416)452-3158.