Title: | DIGITAL UNIX (FORMERLY KNOWN AS DEC OSF/1) |
Notice: | Welcome to the Digital UNIX Conference |
Moderator: | SMURF::DENHAM |
Created: | Thu Mar 16 1995 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 10068 |
Total number of notes: | 35879 |
I am in search of an obscure interface which may or may not exist: Given an address of a shared-memory segment mapped in by my process, how can I find the ID of the segment, enabling me to pass it to another process? The situation: "I" am a library routine, called by a 3rd-party application. Said application creates a shared-memory region in another process, fills it with data, and hands it to my process (still within 3rd-party code). My process then maps it in, and hands my library routine a pointer to the region. What I need to be able to do is to pass access to this region of shared memory to another process to deal with. (WITHOUT copying the data!!) The application here is backing up a database, and with possibly terabytes of data being moved, a simple bcopy in that path turns into an enormous load. Thanks in advance for any clues! Kevin Farlee
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
9096.1 | COL01::LINNARTZ | Thu Mar 13 1997 16:11 | 32 | ||
Kevin, I'm not sure If I fully understand what you try to achieve. nevertheless, due to some analysis sw we needed, I used the following way to obtain data. first I obtained the memory segments used by the process to look at. via opening the pid in the /procfs ioctl's PIOCNMAP to obtain the number of segments in use allocate prmap_t type space into pmap ptr ((nr of segments + 1) ioctl PIOCMAP to obtain the adresses and size of the segment. use table(2) to obtain info about shared memory first id with SHMINFO, index shmmni than loop from 0 to #shmni obtaining info via table(2) with SHMDS. this will provide you with all shared memory segments in use. my problem was no that the size output of the values obtained above via /proc differs from the output in the shmid_ds structure, so you have to roundup it to the pageboundary. this leaves a window if two processes with the same uid and the same size are using a shared memory segment. I think you've got a slight misunderstanding with the shm-id. if you use the table method, you will obtain the KEY in the shmid_ds structure. use this to call shmget, which will return you the ID for shmat. obtaining the ID is prossible, but it isn't directly in the shmid_ds structure. internal, the perform some masking and shifting to obtain it, but I would follow the way depicted above. hope this helps a bit, Pit | |||||
9096.2 | May be the following pointer can do the job for you (?) | NETRIX::"[email protected]" | Sri | Tue Apr 01 1997 18:12 | 6 |
http://www.zk3.dec.com/~shashi/cda.html (within Digital firewall) -Sri [Posted by WWW Notes gateway] |