Skip to contentSkip to conversation

mapping parts of shared memory

RFC Bruno Haible 3 participants 3 messages Dec 2, 1999 – Dec 3, 1999 1 message not in the archive Memory management

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines

I was investigating for some time about the possibility to create some object which allows me to map and unmap parts of it it in different processes.

5) Use the proc filesystem. Implement a file /proc/ipc/shm/42 as being equivalent to the shared memory segment with id 42.
File type: regular file
File size: the shm segment's size
File contents (for use by read, write, mmap): the shm segment's data File owner/group: the shm segment's owner and group truncate(): return -EINVAL

Not only would this solve your "mmap of shared memory" problem, it would become possible to view and edit shared memory using "cat", "hexdump" and "vi". Benefits of the "everything is a file" philosophy.

Bruno
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

#1 lore raw
Quoted 11 lines · Bruno Haible

5) Use the proc filesystem. Implement a file /proc/ipc/shm/42 as being equivalent to the shared memory segment with id 42.
File type: regular file
File size: the shm segment's size
File contents (for use by read, write, mmap): the shm segment's data File owner/group: the shm segment's owner and group truncate(): return -EINVAL

Not only would this solve your "mmap of shared memory" problem, it would become possible to view and edit shared memory using "cat", "hexdump" and "vi". Benefits of the "everything is a file" philosophy.

Don't do it in procfs. Make a separate filesystem and mount it on the empty directory in /proc, if you really need it (I'ld rather use some other location - even /dev/shm would be better). This filesystem will have _nothing_ with proc in terms of code. There is enough mess in procfs already. Keep this one separate.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

A message that is not in the archive (sent off-list or not yet received): [email protected]'s

#3 lore raw
Quoted 14 lines · [email protected] (Alexander Viro) writes:
Quoted 11 lines · Bruno Haible

5) Use the proc filesystem. Implement a file /proc/ipc/shm/42 as being equivalent to the shared memory segment with id 42.
File type: regular file
File size: the shm segment's size
File contents (for use by read, write, mmap): the shm segment's data File owner/group: the shm segment's owner and group truncate(): return -EINVAL

Not only would this solve your "mmap of shared memory" problem, it would become possible to view and edit shared memory using "cat", "hexdump" and "vi". Benefits of the "everything is a file" philosophy.

Quoted 5 lines

Don't do it in procfs. Make a separate filesystem and mount it on the empty directory in /proc, if you really need it (I'ld rather use some other location - even /dev/shm would be better). This filesystem will have _nothing_ with proc in terms of code. There is enough mess in procfs already. Keep this one separate.

I totally agree. After looking at the shm code I concluded that making a filesystem out of it will cleanup the code a lot. There is much duplication of code from the mm layer.

I am just working on this filesystem.

Greetings
Christoph

Signature · 7 lines
Christoph Rohland
SAP AG           
LinuxLab                        Email: [email protected]
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/