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 ofdatayou'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 yourlenback, 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-1is not a vibe. π
π SEE ALSO π
she does not run this town alone, bestie. here's the whole friend group, fr fr:
qb_rb_close(3)qb_rb_refcount_get(3)qb_rb_chmod(3)qb_rb_chown(3)qb_rb_open(3)qb_rb_write_to_file(3)qb_rb_create_from_file(3)qb_rb_chunks_used(3)qb_rb_chunk_reclaim(3)qb_rb_space_used(3)qb_rb_shared_user_data_get(3)qb_rb_chunk_commit(3)qb_rb_chunk_peek(3)qb_rb_space_free(3)qb_rb_name_get(3)qb_rb_chunk_alloc(3)qb_rb_chunk_read(3)
go read those too, iykyk. π
π COPYRIGHT π
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
- fedora 44: libqb-devel 2.0.9-2.fc44 Β· LGPL-2.1-or-later
- fedora 44: libqb-devel 2.0.9-2.fc44 Β· LGPL-2.1-or-later
- ubuntu resolute: libqb-dev 2.0.9-1ubuntu1 Β· LGPL-2.1-or-later
- ubuntu stonking: libqb-dev 2.0.9-1ubuntu1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms