home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!mcsun!Germany.EU.net!murignis!ap542!D012S436!frank
- From: frank@D012S436.sniap.mchp.sni.de ()
- Subject: Re: Shared memory baby question on ultrix 4.2
- Message-ID: <1992Aug21.103445.1279@sniap.mchp.sni.de>
- Sender: news@sniap.mchp.sni.de (News Admin)
- Organization: Siemens-Nixdorf AG
- References: <1992Aug17.152207.3268@otago.ac.nz>
- Date: Fri, 21 Aug 92 10:34:45 GMT
- Lines: 69
-
- aipost@otago.ac.nz writes:
- : Help Help Help
- :
- : !!!! please e-mail me at deano@piglet.otago.ac.nz not the posting address
- :
- : I don't understand shared memory. Sorry, but all I can find in the
- : documentation for our DECstations is the man pages which tell me what to use
- : and what to pass but not HOW to use ?!?!?!?!?!?
- :
- : I am using Ultrix 4.2 etc ...... on DECstation 5000/200's
- :
- : at the moment I do this :
- :
- : key = ftok("/tmp", 'a');
- : shmid = shmget(key, 64, IPC_CREAT | IPC_EXCL);
-
- what permissions does this give your shm?
- (you can check by typing 'ipcs'
- at the command line.)
- it may be that you don't have RW access
- for the shm
- try IPC_CREAT | IPC_EXCL | 0660
-
- also this may return -1 if the shm has
- already been created. If so you should
- try again with IPC_CREAT | 0660 (no EXCL)
-
- : s = shmat(shmid, 0, SHM_R | SHM_W);
-
- why not check these calls for (-1) return codes and do a perror()
- if you get a failure. At least then you'll know which call fails.
- Sometimes the message even makes sense!
-
- i.e. if ((r=nastysystemcall(nastyparameters))==-1)
- {
- perror("nastysystemcall");
- exit(1);
- }
-
- Check your man page (yes, again) to ensure that the call in
- question does in fact return -1 on error. There's always
- one that doesn't.
- :
- : *s = 1; /* BARF BARF BARF, kernel acces since s == -1 */
- :
- : help help help
- :
- : sorry this is probably a really dumb question on the wrong roup
- : but hey it's all I know how to do !!!!
-
- Seems like the right group to me...
-
- :
- : deano
- :
- : p.s: please e-mail me at deano@piglet.otago.ac.nz not the posting address
- : --
- : ==============================================================================
- :
- : "The AI Kids"
- : Department of Computer Science
- : University of Otago
- : New Zealand
- : Internet: AIPOST@otago.ac.nz
- --
- Frank O'Dwyer Disclaimer:
- Siemens-Nixdorf AG I will deny everything
- Tel. : +49 (89) 636-40639 Fax. : +49 (89) 636-45860
- e-mail: Frank.ODwyer@sniap.mchp.sni.de
-