-
Notifications
You must be signed in to change notification settings - Fork 2
Misc. POSIX shm and sem Incompatibilities Between Linux, Solaris and macOS
Andreas Kersting edited this page Dec 11, 2020
·
3 revisions
- Linux allows names of up to 255 characters, macOS just 31
- on Linux and Solaris we need to link with
-lrt
, but not so on macOS -
fstat
on Linux and Solaris reports the actual size of the object, while on macOS it reports the size in multiples of 4KiB (page size, I guess) - on macOS,
shm_open
withO_TRUNC
(andO_CREAT | O_RDWR
) fails with "Invalid argument" (works on Linux and Solaris) - on macOS, privately mapping a shared memory object fails with "Invalid argument" (works on Linux and Solaris)
- on macOS, "
ftruncate
only works once on the initial creation of the segment" (cf. https://stackoverflow.com/a/25510361)
- recreating an already existing semaphore on Linux returns the identical
sem_t *
, which can be passed tosem_close
twice afterwards; on macOS a differentsem_t *
is returned