Skip to content

Introduce xcb_aux_alloc_shm() to create anonymous files in RAM

Alexander Volkov requested to merge avolkov/libxcb-util:master into master

The X.Org Server 1.15 added support for using POSIX shared memory with MIT-SHM extension (with AttachFd and CreateSegment requests). Access to POSIX shared memory is based on file descriptors, thus it allows оn one hand to hide a segment of shared memory from other applications running from the same user and on the other hand give access to the X server even running from another user.

On the client side SysV shared memory is typically used by the following call chain: shmget() -> shmat() -> xcb_shm_attach()

For POSIX shared memory it will be: xcb_aux_alloc_shm() -> mmap() -> xcb_shm_attach_fd()

The implementation of xcb_aux_alloc_shm() is based on the code of shm_tmpfile() from X.Org Server.

Signed-off-by: Alexander Volkov

Edited by Alexander Volkov

Merge request reports