QB_RB_CHUNK_WRITE(3)

✨ QB_RB_CHUNK_WRITE(3) ✨

okay bestie, welcome to the libqb Programmer's Manual πŸŽ€ this one is qb_rb_chunk_write and it is, lowkey, the moment you've been waiting for. it's in section 3, it's a C function, and it's about to write a whole chunk into a ring buffer. no cap. πŸ’…


🌸 NAME 🌸

qb_rb_chunk_write β€” Write a chunk to the ring buffer.

like. that's the whole job. she writes a chunk. to the ring buffer. she's an icon, she's a legend, and she is literally just doing one thing. 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <qb/qbrb.h>

ssize_t qb_rb_chunk_write(
    qb_ringbuffer_t   *rb,    /* ringbuffer instance */
    const void        *data,  /* (in) the data to write */
    size_t             len    /* (in) the size of the chunk. */
);

so first things first, you gotta #include <qb/qbrb.h> β€” that's the ring buffer header, she's the plug πŸ”Œ β€” and then you call her. three things in, one ssize_t out. that's the whole vibe.


🧚 PARAMS 🧚

  • rb β€” your ringbuffer instance. the actual ring buffer you're writing into. she's the main character here, everybody else is just visiting. πŸ‘‘
  • data (in) β€” the data to write. that's your payload, your little bundle of bytes, going in. πŸ“¦
  • len (in) β€” the size of the chunk. how many bytes of data you're actually trying to push through. be honest about it, the buffer is counting. πŸ”’

πŸ’– DESCRIPTION πŸ’–

okay so the way that this works is genuinely so simple it's giving "why is there even a manpage" energy, but here we are.

this function simply calls qb_rb_chunk_alloc() and then calls qb_rb_chunk_commit(). that's it. that's the whole function. alloc, then commit. ✨

it's like: she books the space, she fills the space, she locks it in. two steps, one function, zero drama. if you were out here thinking there's some secret third thing happening β€” there is not. she's a wrapper and she's thriving. πŸ’…


⭐ RETURN VALUE ⭐

she returns the amount of bytes actually buffered β€” so either len, or -1. that's it, those are the options.

so if you get your len back, slay, the chunk went in. if you get -1, something went sideways and you should absolutely go check on that before you keep going. do not ignore the -1. the -1 is not a vibe. 😭

🌈 SEE ALSO 🌈

she does not run this town alone, bestie. here's the whole friend group, fr fr:

go read those too, iykyk. πŸ“š


Copyright (C) 2010-2020 Red Hat, Inc.


aaaand that's the page, bestie πŸ’œ she's from the libqb crew, this version is dated 2025-09-16, and that's your QB_RB_CHUNK_WRITE(3) moment. go write some chunks. periodt. πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from