Cute, 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/... is the trunk version. Seems glibc trunk is the same
http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix...
http://pubs.opengroup.org/onlinepubs/9699919799/functions/op...
[1] http://git.musl-libc.org/cgit/musl/tree/src/mman/shm_open.c