Date: Tue, 8 Jan 2008 21:58:16 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/gen Makefile.inc posixshm.c shm_open.3 src/lib/libc/sys Makefile.inc shm_open.2 src/sys/compat/freebsd32 syscalls.master src/sys/conf files src/sys/kern kern_descrip.c syscalls.master uipc_shm.c src/sys/security/mac mac_framework.h ... Message-ID: <200801082158.m08LwGXh035451@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
jhb 2008-01-08 21:58:16 UTC FreeBSD src repository Modified files: lib/libc/gen Makefile.inc lib/libc/sys Makefile.inc shm_open.2 sys/compat/freebsd32 syscalls.master sys/conf files sys/kern kern_descrip.c syscalls.master sys/security/mac mac_framework.h mac_policy.h sys/security/mac_stub mac_stub.c sys/security/mac_test mac_test.c sys/sys fcntl.h file.h mman.h sys/vm vm_mmap.c Added files: sys/kern uipc_shm.c sys/security/mac mac_posix_shm.c Removed files: lib/libc/gen posixshm.c shm_open.3 Log: Add a new file descriptor type for IPC shared memory objects and use it to implement shm_open(2) and shm_unlink(2) in the kernel: - Each shared memory file descriptor is associated with a swap-backed vm object which provides the backing store. Each descriptor starts off with a size of zero, but the size can be altered via ftruncate(2). The shared memory file descriptors also support fstat(2). read(2), write(2), ioctl(2), select(2), poll(2), and kevent(2) are not supported on shared memory file descriptors. - shm_open(2) and shm_unlink(2) are now implemented as system calls that manage shared memory file descriptors. The virtual namespace that maps pathnames to shared memory file descriptors is implemented as a hash table where the hash key is generated via the 32-bit Fowler/Noll/Vo hash of the pathname. - As an extension, the constant 'SHM_ANON' may be specified in place of the path argument to shm_open(2). In this case, an unnamed shared memory file descriptor will be created similar to the IPC_PRIVATE key for shmget(2). Note that the shared memory object can still be shared among processes by sharing the file descriptor via fork(2) or sendmsg(2), but it is unnamed. This effectively serves to implement the getmemfd() idea bandied about the lists several times over the years. - The backing store for shared memory file descriptors are garbage collected when they are not referenced by any open file descriptors or the shm_open(2) virtual namespace. Submitted by: dillon, peter (previous versions) Submitted by: rwatson (I based this on his version) Reviewed by: alc (suggested converting getmemfd() to shm_open()) Revision Changes Path 1.129 +2 -3 src/lib/libc/gen/Makefile.inc 1.5 +0 -72 src/lib/libc/gen/posixshm.c (dead) 1.13 +0 -192 src/lib/libc/gen/shm_open.3 (dead) 1.128 +2 -1 src/lib/libc/sys/Makefile.inc 1.13 +158 -68 src/lib/libc/sys/shm_open.2 1.94 +3 -0 src/sys/compat/freebsd32/syscalls.master 1.1262 +2 -0 src/sys/conf/files 1.318 +2 -0 src/sys/kern/kern_descrip.c 1.235 +3 -0 src/sys/kern/syscalls.master 1.1 +608 -0 src/sys/kern/uipc_shm.c (new) 1.96 +13 -0 src/sys/security/mac/mac_framework.h 1.106 +28 -0 src/sys/security/mac/mac_policy.h 1.1 +146 -0 src/sys/security/mac/mac_posix_shm.c (new) 1.80 +56 -0 src/sys/security/mac_stub/mac_stub.c 1.94 +96 -0 src/sys/security/mac_test/mac_test.c 1.17 +12 -7 src/sys/sys/fcntl.h 1.76 +1 -0 src/sys/sys/file.h 1.41 +32 -1 src/sys/sys/mman.h 1.216 +53 -3 src/sys/vm/vm_mmap.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801082158.m08LwGXh035451>