QB_RB_CHUNK_PEEK(3)
π QB_RB_CHUNK_PEEK π
okay bestie, sit down, hydrate, and let me tell you about this little icon from the libqb Programmer's Manual. it's qb_rb_chunk_peek(3) and it is lowkey the "look but don't touch" girl of ringbuffers. πβ¨
β¨ NAME β¨
qb_rb_chunk_peek β Read (without reclaiming) the last chunk.
likeβ¦ you get to see the chunk. you do not get to keep it yet. it's giving window shopping at the mall. ποΈ
β¨ SYNOPSIS β¨
#include <qb/qbrb.h>
ssize_t qb_rb_chunk_peek(
qb_ringbuffer_t *rb, /* ringbuffer instance */
/*
* (out) a pointer to the next chunk to read (not copied).
*/
void **data_out,
int32_t ms_timeout /* (in) time to wait for new data.*/
);
no cap, that's the whole vibe. one function, three args, zero drama. π«Ά
β¨ PARAMS β¨
rbβ ringbuffer instance. your main character, the ringbuffer herself. πdata_outβ (out) a pointer to the next chunk to read (not copied). it's an out param, so she's handing you a pointer back, not a copy. ngl that's the whole point.ms_timeoutβ (in) time to wait for new data. in milliseconds. she'll wait. she's patient. but only for that long. β³
β¨ DESCRIPTION β¨
so this function is a way of accessing the next chunk without a memcpy(). you literally read the chunk data in place. no copying, no extra allocation, no nonsense. it's efficient and honestly kind of iconic. π₯
think of it like this: instead of someone photocopying the homework and handing you the photocopy, they just point at the homework and go "it's right there bestie." π
β¨ RETURN VALUE β¨
the size of the chunk (0 if buffer empty).
that's it. that's the return. and yes, 0 means empty β so if you get a 0 back, don't panic, she's just not talking to you right now. π
β¨ NOTE β¨
β οΈ okay this part matters, do not skim: this function will not "pop" the chunk. you will need to call qb_rb_chunk_reclaim(). π¨
like, peeking is peeking. the chunk is still sitting there in the buffer being all "hello yes I am still here." if you want it gone, that's a whole different function, bestie. don't forget the reclaim or you'll be confused later. π
β¨ SEE ALSO β¨
the whole girl gang, 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_space_free(3)qb_rb_name_get(3)qb_rb_chunk_alloc(3)qb_rb_chunk_read(3)
β¨ COPYRIGHT β¨
Copyright (C) 2010-2020 Red Hat, Inc.
and that's the whole page, bestie!! π this was libqb, dated 2025-09-16, page QB_RB_CHUNK_PEEK(3) β go forth and peek responsibly, and don't forget to qb_rb_chunk_reclaim() afterwards, i am literally begging you. π«Άπβ¨
π¦ 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