[comp.os.mach] shm*

rwd@NATASHA.MACH.CS.CMU.EDU (Randall Dean) (04/13/91)

Has anyone implimented shmget, shmat in terms of mach primitives?
A simple external pager with its ports registered with the netmsgserver
and the appropriate glue code would do the trick.

-rwd

noro@ohara.info.waseda.ac.jp (Hideo Noro) (05/03/91)

Hello. I've been reading this news group for few weeks.

I wanna run some system on MACH2.5 (I use LUNA88K(omron)),
but MACH seems not to support shared memory system calls
(shm{get,at,dt,ctl}).

Does sombody know how to make shm* system calls compatible library,
or where I could anonymous ftp if possible?

The system uses shm* system calls below. So, not full-compatibility
shm* library (or advice how to make that) is welcome.
-------------------
shmget(XVREGION_KEY, 1024, 0666)
shmget(XVREGION_KEY, size, 00666 | IPC_CREAT)
shmat(id, 0, 0)
shmdt(id)
shmctl(id, IPC_RMID, 0)
shmctl(id, IPC_STAT, &buf) /* system references only buf.shm_atime */
-------------------

I don't know much of MACH, but think;

shmget(key, size, 0666 | IPC_CREAT):
           use vm_allocate(target_task, address,
                   sizeof(struct shmid_ds) + size, TRUE),
               vm_inherit(target_task, address,
			       sizeof(struct shmid_ds) + size, VM_INHERIT_SHARE),
           and target_task has some relation to key,
		       returns some number related to address.
           (also check key has already related some address or not.)
shmat(id, 0, 0):
           returns (address + sizeof(struct shmid_ds)).
shmdt(id): nothing to do.
shmctl(id, IPC_STAT, &buf):
           copies sizeof(struct shmid_ds) bytes of memory image
           begin at address.


I don't know if these are correct or not. Since, I'm not sure
target_task can perform like 'key' which is used in shm*.


Any comments are welcome.

Thanks.

----
Hideo Noro
Ohara Lab., Dept. of Sci. and Eng., Waseda Univ., JAPAN
noro@ohara.info.waseda.ac.jp

rwd@NATASHA.MACH.CS.CMU.EDU (Randall Dean) (05/07/91)

I have most of the code written for a shared memory server
whose interface is the system V shm* calls.  It will require
the relinking of programs which use this call against a new
library, the running of the netmsgserver, netmemoryserver and
a new shmserver.  The machine I am actually targeting this for
is the luna88k (omron).  Unfortunately I don't have a working
netmemoryserver or netmsgserver for this yet (both have minor
bugs in them).  When I am less busy and have a chance to
track down these problems and finish the code, I will release it
ASIS.

-rwd