6 ms·
I was curious whether the fact that shm_open() essentially calls open() is true, and in fact it is, at least with eglibc on Linux: http://sources.debian.net/sr
by secure 13y ago
I was curious whether the fact that shm_open() essentially calls open() is true, and in fact it is, at least with eglibc on Linux:
http://sources.debian.net/src/eglibc/2.17-3/sysdeps/posix/shm_open.c?hl=1#L1 http://sources.debian.net/src/eglibc/2.17-3/sysdeps/posix/sh...
- hosay123 13y agoCute, it doesn't even try to use the race-free O_CLOEXEC variant, which was introduced "only" 6 years ago. http://www.eglibc.org/cgi-bin/viewvc.cgi/trunk/libc/sysdeps/posix/shm_open.c?view=markup http://www.eglibc.org/cgi-bin/viewvc.cgi/trunk/libc/sysdeps/... is the trunk version. Seems glibc trunk is the same
- lelf 13y ago“It” (that is POSIX fall-back) don't try it because O_CLOEXEC is not POSIX. And you don't know how to look properly http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/shm_open.c http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix...
- ksherlock 13y agoO_CLOEXEC was recently added to POSIX. http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/op...
- justincormack 13y agoIf you want a C library that takes that sort of thing seriously you should be using Musl[1] as they do care about things like that. [1] http://git.musl-libc.org/cgit/musl/tree/src/mman/shm_open.c http://git.musl-libc.org/cgit/musl/tree/src/mman/shm_open.c