vrb_put(3)
π vrb_put(3) β the VRB Programmer's Manual, bestie edition π
okay so real talk, this is vrb_put(3) from the VRB Programmer's Manual, and it's genuinely one of the most useful little functions in the whole -lvrb library. like, this is the one that actually puts stuff in. main character energy fr fr. π
β¨ NAME β¨
vrb_put β put data into a VRB π«Ά
π LIBRARY π
-lvrb
(she lives there. that's her house. link her in, king.)
π§ SYNOPSIS π§
#include <vrb.h>
size_t vrb_put(vrb_p vrb, char *source, size_t size);
like look at her. three args, one return, no drama. we love a low-maintenance icon. π
πΈ DESCRIPTION πΈ
vrb_put puts caller-provided data into a virtual ring buffer. that's the whole vibe. β¨
but here's the important part, so listen up: if there's less space available in the virtual ring buffer than the amount you're trying to put in, then only as much as can be fit will actually get copied. she doesn't throw a tantrum, she doesn't overflow, she just copies what fits and moves on. lowkey the most emotionally mature function in the library. π¦
ngl, this is the one you gotta watch β she won't tell you she ran out of room except through her return value, so check it. π
π ARGUMENTS π
vrb_p vrbβ specifies which virtual ring buffer. like, which one. there are many VRBs out there, bestie, you gotta say which.char *sourceβ specifies the location where to copy the data from. this is where your data is currently chilling before it gets moved into the ring buffer.size_t sizeβ specifies the length of data provided by the caller. i.e. how much you're bringing to the party. π
π₯ RETURN VALUE π₯
size_t
the actual length of data copied gets returned. and it can be any value from 0 to the specified size β so like, 0 is a completely valid answer (she copied nothing, and she's not sorry), and size means you got everything in. anything in between means she ran out of space partway. so check it. always check it. fr fr. π
π ERRORS π
if an error is returned, then errno will have this value:
EINVALβ an invalid virtual ring buffer pointer was specified. you handed her a bogusvrbpointer and she's like "girl what is this". not the vibe. π
π SEE ALSO π
okay this is the whole squad, the entire friend group, no one gets left out:
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_all(3), vrb_read(3), vrb_read_min(3), vrb_resize(3), vrb_space_len(3), vrb_space_ptr(3), vrb_take(3), vrb_uninit(3), vrb_write(3), vrb_write_min(3)
like, go read vrb_put_all(3) next if vrb_put's "only copy what fits" behaviour is stressing you out. iykyk. π§ββοΈ
and that's the page!! this one's from the vrb manual, dated 2002-09-30, and it's vrb_put(3) all day long. slay, protect your ring buffer, and don't forget to check that return value. periodt. ππ¦πΈ
π¦ 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