xcb_shm_attach_fd(3)
π xcb_shm_attach_fd π
okay bestie, we're diving into libxcb today and honestly? this one is kind of iconic. it lives in the XCB Requests section of the manual, so it's giving "low-level X11 business" energy, and yes you're gonna slay it.
β¨ NAME β¨
xcb_shm_attach_fd β create a shared memory segment π§
like, it makes a shared memory segment. that's the whole vibe. no cap.
πΈ SYNOPSIS πΈ
#include <xcb/shm.h>
π Request function
xcb_void_cookie_t xcb_shm_attach_fd(xcb_connection_t *conn,
xcb_shm_seg_t shmseg, int32_t shm_fd, uint8_t read_only);
π¦ REQUEST ARGUMENTS π¦
connβ the XCB connection to X11. your link to the mothership, basically. πshmsegβ a shared memory segment ID that you made withxcb_generate_id(). you gotta birth that ID yourself first, bestie. β¨shm_fdβ the file descriptor the server shouldmmap(). yes, the server does the mmap, not you. it's giving teamwork. π«Άread_onlyβTrueif the segment shall be mapped read only by the X11 server, otherwisefalse. so like, do you want the server to have write privileges or nah? π
π DESCRIPTION π
Create a shared memory segment. periodt.
The file descriptor will be mapped at offset zero, and the size will be obtained using fstat(). the way that fstat() just knows the size for you? obsessed.
β οΈ a zero size will result in a Value error. so like, don't hand it an empty file, okay? it will not be cute about it. π
π₯ RETURN VALUE π₯
Returns an xcb_void_cookie_t. Errors (if any) have to be handled in the event loop. so you gotta actually do the event loop thing, bestie, the errors don't come find you on their own.
If you want to handle errors directly with xcb_request_check instead, use xcb_shm_attach_fd_checked. See xcb-requests(3) for details. β¨
π ERRORS π
This request does never generate any errors.
literally not one. not a single one. main character behaviour. π
π SEE ALSO π
π AUTHOR π
Generated from shm.xml. Contact xcb@lists.freedesktop.org for corrections and improvements. so if something's off, tell the mailing list, not me π
okay that's the whole page!! you now know more about xcb_shm_attach_fd than 99% of people on this planet, and that's just facts. this was X Version 11, libxcb 1.17.0, page xcb_shm_attach_fd(3) β go forth and attach those shared memory segments, queen πβ¨π¦
π¦ where this page comes from
- alpine 3.22: libxcb-doc 1.17.0-r0 Β· MIT
- alpine 3.23: libxcb-doc 1.17.0-r1 Β· MIT
- alpine 3.24: libxcb-doc 1.17.0-r2 Β· MIT
- arch rolling: libxcb 1.17.0-1 Β· X11
- centos-stream 10: libxcb-devel 1.17.0-3.el10 Β· X11
- debian trixie: libxcb-doc 1.17.0-2
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- nixpkgs unstable: libxcb 1.17.0
- opensuse-leap 16.0: libxcb-devel-doc 1.17.0-160000.2.2 Β· MIT
- ubuntu questing: libxcb-doc 1.17.0-2build1
- ubuntu resolute: libxcb-doc 1.17.0-2ubuntu1
- ubuntu stonking: libxcb-doc 1.17.0-2ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms