home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!stl!robobar!ibmpcug!impmh!dsg
- From: dsg@impmh.uucp (Dave Gordon)
- Newsgroups: comp.unix.questions
- Subject: Re: Shared memory baby question on ultrix 4.2
- Summary: shared memory permissions
- Keywords: shared memory permissions
- Message-ID: <1992Sep1.155624.2149@impmh.uucp>
- Date: 1 Sep 92 15:56:24 GMT
- References: <1992Aug17.152207.3268@otago.ac.nz>
- Organization: Integrated Micro Products Ltd
- Lines: 46
-
- In comp.unix.questions deano@piglet.otago.ac.nz writes:
-
- > Help Help Help
- >
- > 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 ?!?!?!?!?!?
- >
- > at the moment I do this :
- >
- > key = ftok("/tmp", 'a');
- > shmid = shmget(key, 64, IPC_CREAT | IPC_EXCL);
- > s = shmat(shmid, 0, SHM_R | SHM_W);
- >
- > *s = 1; /* BARF BARF BARF, kernel acces since s == -1 */
- >
- > help help help
-
-
-
- deano's problem is in the parameters to the shmget(2) call ...
- the third parameter should include the permissions (modes) for
- the new segment; the manual page on our system reads:
-
- The low-order 9 bits of shm_perm.mode are set equal to the
- low-order 9 bits of shmflg.
-
- The shared-memory segment is created with no permissions for
- anybody, so the shmat(2) call fails (returns -1).
-
- The permissions are just like those used for files, except that
- there is no 'execute' mode. So the third parameter could be
- (IPC_CREAT|IPC_EXCL|0666)
- which gives read/write permission to everybody, or some other modes,
- according to what is wanted.
-
- ipcs(1) will display the status of shared memory segments including
- permissions.
-
-
- PS:
- deano: I tried to mail this to deano@piglet.otago.ac.nz, but it
- bounced at uknet.ac.uk; are you sure about your mail address??
- --
- Dave
- ====
-