Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!bellcore!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!smoke!es!Liz_Watson%anvil.UUCP@harvard.harvard.edu From: Liz_Watson%anvil.UUCP@harvard.harvard.edu Newsgroups: net.unix-wizards Subject: re: Shared Memory Problem Message-ID: <2327@brl-smoke.ARPA> Date: Wed, 2-Apr-86 22:54:36 EST Article-I.D.: brl-smok.2327 Posted: Wed Apr 2 22:54:36 1986 Date-Received: Sat, 5-Apr-86 07:20:22 EST Sender: news@brl-smoke.ARPA Lines: 24 Bruce Holloway writes: >I'm having a problem with the shared memory routines under System V, and >I wonder if any gurus out there could help me.... > > mes = (MES *)shmat(shmid, (char *)0, 0); > if(!mes){ printf("SHMAT failed!\n"); return; } > >/* Core is dumped on next statement */ > > mes->mes_flags = 0; > First, fix up your error check on the shmat. When shmat fails, it returns a -1. This causes your core dump. The shmat call fails because the shmget call did not give adequate (any) permissions. The shmat requires at least read permission. The permissions are set by shmget, using the low-order 9 bits of shmflag. Liz Watson Stratus Comp