QB_RB_CHUNK_ALLOC(3)
π QB_RB_CHUNK_ALLOC β the "gimme some space bestie" page π
okay so this is libqb's programmer's manual, section 3 (library functions, iykyk), and today's main character is qb_rb_chunk_alloc. she's the one you call when you need a chunk of a ringbuffer and you need it now. π
β¨ NAME β¨
qb_rb_chunk_alloc β allocate space for a chunk of the given size. that's it, that's the whole job, and she does it flawlessly. π
πΈ SYNOPSIS πΈ
#include <qb/qbrb.h>
void * qb_rb_chunk_alloc(
qb_ringbuffer_t *rb, /* ringbuffer instance */
size_t len /* (in) the size to allocate. */
);
so you pull in <qb/qbrb.h> and boom, you got the whole ringbuffer situation. π¦
π«Ά PARAMS π«Ά
rbβ the ringbuffer instance. your girl. your ride or die. the actual buffer you're working with. β¨len(in) β the size to allocate. how much room you're asking for, in bytes. no cap. π
π DESCRIPTION π
okay bestie, listen close because this part actually matters and it's giving caution:
if type == QB_RB_FLAG_OVERWRITE and NULL gets returned, then memory corruption of the memory file has occurred. like, the file is cooked. π and what do you do about it? the ringbuffer should be destroyed. that's it, that's the move, no saving her. πͺ¦
if type == QB_RB_NORMAL then when there's not enough space, it'll just return NULL. chill. no drama. just a polite "nope, no room". π
ngl the overwrite one is the scary one. treat that NULL like a fire alarm, not a typo. π₯
β RETURN VALUE β
a pointer to the chunk you get to write to. π or NULL if there's no space. that's the vibe check, and sometimes she fails it. π
π SEE ALSO π
the whole squad, 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_chunk_write(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_read(3)
π COPYRIGHT π
Copyright (C) 2010-2020 Red Hat, Inc.
and that's the whole page, bestie β¨ this little icon of a manpage comes to you from the libqb programmer's manual (section 3, library girlies only), dated 2025-09-16 β shoutout to the LIBQB source for keeping it real all these years. go allocate something cute. ππ π¦
π¦ 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