Subject: Re: Wierd SYSV SHM behavior
To: None <smpatel@wam.umd.edu>
From: Charles M. Hannum <mycroft@ai.mit.edu>
List: tech-kern
Date: 04/19/1995 20:47:36
Run by UID 100:
shmid = shmget(shmemKey, sizeof(struct memory), IPC_CREAT | 0666);
sharedMemory = (struct memory *) shmat(shmid, (char *) 0, 0);
Run by UID 101:
if ((shmid = shmget (key, sizeof (struct memory), 666 )) < 0) {
perror("shmget");
exit(1);
}
This fails for me, even when I run both programs as the same uid.
That's because there's a typo in the second program. I changed:
if ((shmid = shmget (key, sizeof (struct memory), 666 )) < 0) {
to:
if ((shmid = shmget (key, sizeof (struct memory), 0666 )) < 0) {
and it worked fine.