On Thu, Mar 06, 2003 at 09:12:03PM +0200, Juhana Sadeharju wrote:
Hello. I need two functions:
make_shm(int size, char *key)
-run by root
-creates a locked shared memory segment
-returns a key (preferably a string) which is used to
access the shared memory
shm segments are identified by key id (key_t), use ftok on a file to turn
a string (the path to the file) into a key.
Could somebody please write these routines to me?
yikes! [ insert nasty comment here ]
Or give good
hints?
_http://www.google.com
_http://www.acm.uiuc.edu/lug/presentations/shm/shm-5.html
_http://www.ecst.csuchico.edu/~beej/guide/ipc/shmem.html
_don't forget to free your shmem, it stays around after the process dies
if you don't pay attention
I have Jack and other codes, but it all is confusing
when the shared memory should be accessed from separate process
which is not fork() of the other.
pass the key id by socket, pipe, (dummy) file, etc. if it's a file you
can just pass the file path/name to the other program and it can use
ftok to generate the key.
rob
----
Robert Melby
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt4255a
Internet: async(a)cc.gatech.edu