xcb_shm_create_segment(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

πŸ’– NAME πŸ’–

xcb_shm_create_segment β€” bestie, this one literally asks the server to allocate a shared memory segment for you 🫢


✨ SYNOPSIS ✨

#include <xcb/shm.h>

πŸŽ€ Request function

xcb_shm_create_segment_cookie_t
       xcb_shm_create_segment(xcb_connection_t *conn,
       xcb_shm_seg_t shmseg, uint32_t size, uint8_t read_only);

πŸ¦‹ Reply datastructure

typedef struct xcb_shm_create_segment_reply_t {
    uint8_t  response_type;
    uint8_t  nfd;
    uint16_t sequence;
    uint32_t length;
    uint8_t  pad0[24];
} xcb_shm_create_segment_reply_t;

🌸 Reply function

xcb_shm_create_segment_reply_t
       *xcb_shm_create_segment_reply(xcb_connection_t *conn,
       xcb_shm_create_segment_cookie_t cookie, xcb_generic_error_t **e);

πŸ’… REQUEST ARGUMENTS πŸ’…

  • conn β€” the XCB connection to X11, obvs. your lil hotline to the server πŸ“ž
  • shmseg β€” a shared memory segment ID that you made with xcb_generate_id(). gotta generate it first, no skipping steps bestie ✨
  • size β€” how big the segment you're creating should be. the size, the moment, the everything πŸ’–
  • read_only β€” True if the server should map the segment read-only; otherwise false. so like... can the server touch it or just look respectfully πŸ‘€

πŸ‘‘ REPLY FIELDS πŸ‘‘

  • response_type β€” the type of this reply, which in this case is XCB_SHM_CREATE_SEGMENT. this field also lives in the xcb_generic_reply_t and it's how you tell your replies apart from each other, iykyk 🏷️
  • sequence β€” the sequence number of the last request the X11 server processed πŸ”’
  • length β€” the length of the reply, in words. and a word is 4 bytes, periodt πŸ“
  • nfd β€” the number of file descriptors sent by the server. it will always be 1. no cap, always one 🀝
  • shm_fd β€” TODO: NOT YET DOCUMENTED. the docs simply have not caught up yet, we love an unfinished icon πŸ’€

🌈 DESCRIPTION 🌈

It asks the server to allocate a shared memory segment. and the server's reply? it will include a file descriptor for the client to pass to mmap(). that's the whole point, that's the moment, that's the vibe 🧚


πŸ”₯ RETURN VALUE πŸ”₯

It returns an xcb_shm_create_segment_cookie_t. errors have to be handled when you call the reply function xcb_shm_create_segment_reply. so don't just ghost the cookie, bestie 😭

If you'd rather handle errors in the event loop instead, use xcb_shm_create_segment_unchecked. see xcb-requests(3) for the details on that whole situation.


πŸ’€ ERRORS πŸ’€

This request does never generate any errors. zero. none. she's chill like that πŸ™ˆ


🫢 SEE ALSO 🫢


πŸ’œ AUTHOR πŸ’œ

Generated from shm.xml. Contact xcb@lists.freedesktop.org for corrections and improvements. they're literally asking for your feedback, so slay ✨


okay that's the whole page, you ate that πŸ’… this was xcb_shm_create_segment(3), part of libxcb 1.17.0 from X Version 11 β€” mwah, go mmap something iconic πŸ’–βœ¨πŸŽ€