Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpcea!hpfcdc!stroyan From: stroyan@hpfcdc.HP.COM (Mike Stroyan) Newsgroups: comp.unix.questions Subject: Re: Help about shared memory Message-ID: <5740019@hpfcdc.HP.COM> Date: 16 Feb 88 22:03:21 GMT References: <1739@phoenix.Princeton.EDU> Organization: HP Ft. Collins, Co. Lines: 20 The problem is in the shmget call. When a new segment is created, it has permissions determined by the shmflg parameter. Your shmget call produced a shared memory segment with 000 permissions, so the shmat call failed the permissions check. Changing - if ((sid = shmget(IPC_PRIVATE,sizeof(mydat),IPC_CREAT)) < 0) { to- if ((sid = shmget(IPC_PRIVATE,sizeof(mydat),IPC_CREAT | 0600)) < 0) { will fix your program. You should be careful to clean up any shared memory segments or semaphores that your test programs leave around. They will remain until you remove them or the system is rebooted. Since there aren't very many per system, it is easy to run out if they aren't cleaned up. You can see what exists with the ipcs command and remove them with the ipcrm command. Mike Stroyan, [hplabs!]hpfcla!stroyan