xcb_shm_attach_fd(3)

πŸ“¦
version 1.17.0 Β· 5 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 with xcb_generate_id(). you gotta birth that ID yourself first, bestie. ✨
  • shm_fd β€” the file descriptor the server should mmap(). yes, the server does the mmap, not you. it's giving teamwork. 🫢
  • read_only β€” True if the segment shall be mapped read only by the X11 server, otherwise false. 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 πŸ’œβœ¨πŸ¦‹