Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!genrad!panda!talcott!harvard!seismo!mcvax!unido!coma!andy From: andy@coma.UUCP Newsgroups: net.unix Subject: Re: Sys V IPC Message-ID: <900002@coma.UUCP> Date: Thu, 13-Feb-86 14:38:00 EST Article-I.D.: coma.900002 Posted: Thu Feb 13 14:38:00 1986 Date-Received: Tue, 18-Feb-86 04:27:15 EST References: <2632@gatech.UUCP> Sender: notes@unido.UUCP Lines: 56 Nf-ID: #R:gatech:-263200:coma:900002:000:1962 Nf-From: coma!andy Feb 13 19:38:00 1986 > I have been reading the documentation for the Sys V IPC stuff (msg, shm) > and it is not exactly crystal-clear (no kidding!) Could anyone please provide > me (and the net community) with one or several examples of message-passing > between cooperating processes? Indeed, the documentation of the Sys V IPC-package is not very instructive. It took me quite a time of reading and reading and reading the documentation and examining the Source-Code to understand how it works. After a while I had my first success in managing semaphores -- it really works. - First you have to get an ipc-key with "ftok". "Ftok" takes as arguments a filename of an existing file and a single letter and returns always the same key if it gets the same arguments. - For creating a set of semaphores or a message queue you have to use [sem|msg|shm]get with the flag IPC_CREATE. - Next, very important, you have to set the access-permissions with [sem|msg|shm]ctl. See UPM (2), which structs the ctl-calls expect as arguments. - If you have done this, you can use the [sem|msg|shm]op calls and they will work. Note, that the steps 2 and 3 have to be done just once for each set of semaphores, message queue or segment of shared memory. For subsequent accesses you need a ...get call (to get the ipcID) instaed. Up to now I made tests only with semaphores and message queues. Semaphores work nearly correct. "Nearly" means, that they are first in - last out !!!!! I few days ago I made my first experiences with message queues and I had some difficulties with long messages (loss of data). Perhaps that was my mistake, messages that contain just a single character arrive correctly. Good luck, Andy Andreas Lampen \\ UUCP: mcvax!unido!tub!coma!andy Techn. Univ. Berlin \\ BITNET(EARN): lampen@db0tui11 \\ Tel: +49-30-31473496 \\ Berlin, the city that never sleeps !!