vrb_take(3)
π vrb_take(3) β the VRB Programmer's Manual, bestie edition β¨
okay so this one's from the VRB Programmer's Manual, and it's genuinely one of the most "you had to be there" little functions in the whole ring-buffer saga. it's the cleanup bestie. the "yes i took it, thank you" of the whole vibe. let's get into it π«Ά
πΈ NAME
vrb_take β take data from a VRB π
π LIBRARY
-lvrb
β¨ SYNOPSIS
#include <vrb.h>
vrb_p vrb_take(vrb_p vrb, size_t size);
π DESCRIPTION
so vrb_take is literally you telling the buffer "hey bestie, i took this much data out of your data section, k?"
here's the flow, iykyk: you already called vrb_data_len(3) and vrb_data_ptr(3) to get the length of the data in the buffer and a pointer to it. then you went and extracted some data from the buffer β starting from the pointer you got, and extracting no more than the length you got. and now you come back and call vrb_take to say how much you actually took. π
it's giving "receipts". the buffer needs to know. don't leave it hanging π
π¦ ARGUMENTS
vrb_p vrbβ specifies which virtual ring buffer. like, which one. there are many. be specific πsize_t sizeβ specifies the length of data that has been obtained from the virtual ring buffer by the caller. so like, the amount you stole. lovingly. from the buffer. π
π RETURN VALUE
int
on success, 0 is returned. on error, -1 is returned. that's it. that's the whole vibe check. β¨
π₯ ERRORS
if an error is returned, then errno will have one of the following values:
EINVALβ an invalid virtual ring buffer pointer was specified. you handed it a fake ID bestie πENOSPCβ the specified length is greater than the data in the virtual ring buffer. you're claiming you took more than there even was. not the flex you think it is π
fr fr,ENOSPChere means yoursizeis bigger than the actual data sitting in the buffer β no cap, that's a mistake, not a mood.
π SEE ALSO
vrb(3), vrb_capacity(3), vrb_data_len(3), vrb_data_ptr(3), vrb_destroy(3), vrb_get(3), vrb_get_min(3), vrb_give(3), vrb_init(3), vrb_init_opt(3), vrb_is_empty(3), vrb_is_full(3), vrb_is_not_empty(3), vrb_is_not_full(3), vrb_move(3), vrb_new(3), vrb_new_opt(3), vrb_put(3), vrb_put_all(3), vrb_read(3), vrb_read_min(3), vrb_resize(3), vrb_space_len(3), vrb_space_ptr(3), vrb_uninit(3), vrb_write(3), vrb_write_min(3)
π that's the whole page bestie.vrbΒ·2002-09-30Β·vrb_take(3)β dated, iconic, still valid. mwah ππ§ββοΈ
π¦ where this page comes from
- nixos 26.05: vrb 0.5.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms