BSON_READER_NEW_FROM_FD(3)
π BSON_READER_NEW_FROM_FD(3) π
okay so bestie, we're in the libbson section of the manual, and today's main character is bson_reader_new_from_fd() β literally the glow-up that turns a raw file descriptor into a whole entire reader β¨
πΈ SYNOPSIS πΈ
bson_reader_t *
bson_reader_new_from_fd (int fd, bool close_on_destroy);
π PARAMETERS π
fdβ a valid file-descriptor. like, an actual one. it has to be valid, no cap π«Άclose_on_destroyβ a bool that decides whetherclose()gets called onfdwhen the reader is destroyed. yes-or-no energy π
π¦ DESCRIPTION π¦
so the bson_reader_new_from_fd() function shall create a brand-new bson_reader_t that will read from the file-descriptor you handed it. that's it, that's the vibe π
β οΈ fd MUST be in blocking mode. like, non-negotiable, bestie. blocking mode or nothing π
if close_fd is true, then fd will be closed when the bson_reader_t is destroyed with bson_reader_destroy(). so like, the reader takes care of cleanup for you β iconic behavior honestly π
β¨ RETURNS β¨
a newly allocated bson_reader_t that should be freed with bson_reader_destroy(). don't just leave it lying around, that's not the move π
π AUTHOR π
MongoDB, Inc β the icons behind all of this π«Ά
π COPYRIGHT π
2009-present, MongoDB, Inc. protecting the intellectual property, as they should β
and that's the whole page, bestie! this specific copy of the manual is version 2.5.6, dated Oct 09, 2026, served fresh from the libbson collection β go forth and read those file-descriptors responsibly πππ¦
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms