BIO_GET_RPOLL_DESCRIPTOR(3SSL)
π BIO_GET_RPOLL_DESCRIPTOR(3SSL) π
okay bestie so this is a page from the OpenSSL manual, section 3SSL, and it's all about two lil functions that tell you when a BIO is gonna be ready for reads or writes. no cap, this is the "hey is it my turn yet" API. π
β¨ NAME β¨
BIO_get_rpoll_descriptor, BIO_get_wpoll_descriptor β grab yourself a structure that you can use to figure out when a BIO object can next be read from or written to. it's giving "poll me, bestie" energy fr fr.
β¨ SYNOPSIS β¨
#include <openssl/bio.h>
typedef struct bio_poll_descriptor_st {
uint32_t type;
union {
int fd;
void *custom;
uintptr_t custom_ui;
} value;
} BIO_POLL_DESCRIPTOR;
int BIO_get_rpoll_descriptor(BIO *b, BIO_POLL_DESCRIPTOR *desc);
int BIO_get_wpoll_descriptor(BIO *b, BIO_POLL_DESCRIPTOR *desc);
β¨ DESCRIPTION β¨
so like, on success, BIO_get_rpoll_descriptor() and BIO_get_wpoll_descriptor() fill in *desc with a poll descriptor. π
a poll descriptor is a tagged union structure, which is a fancy way of saying "it's a thing that says what kind of thing it is, and then the thing". it represents some kind of OS or non-OS resource that you can use to synchronise on I/O availability events. iykyk.
BIO_get_rpoll_descriptor() hands you a descriptor you can use to determine when the BIO can (potentially) next be read. BIO_get_wpoll_descriptor() hands you one you can use to determine when the BIO can (potentially) next be written. π
and yes, it's totally permissible for BIO_get_rpoll_descriptor() and BIO_get_wpoll_descriptor() to output the same descriptor. no drama, they can share. π«Ά
poll descriptors can represent different kinds of information. a typical kind of resource they might represent is an OS file descriptor, which you can use with APIs such as select(). classic.
the kinds of poll descriptor that OpenSSL defines are:
BIO_POLL_DESCRIPTOR_TYPE_NONEβ represents the absence of a valid poll descriptor. it might be used byBIO_get_rpoll_descriptor()orBIO_get_wpoll_descriptor()to say "nah this BIO is not pollable for readability or writeability respectively". for this type, no field inside thevaluefield of theBIO_POLL_DESCRIPTORis valid. like, none of them. don't touch. π«BIO_POLL_DESCRIPTOR_TYPE_SOCK_FDβ this poll descriptor represents an OS socket resource. the fieldvalue.fdin theBIO_POLL_DESCRIPTORis valid if it's not set to-1. the resource is whatever kind of handle a given OS uses to represent sockets, which β surprise β can vary by OS. for example, on Windows, the value is aSOCKETfor use with the Winsock API. on POSIX-like platforms, it's a file descriptor. π
where a poll descriptor of this type is output by BIO_get_rpoll_descriptor(), it should be polled for readability to determine when the BIO might next be able to successfully complete a BIO_read() operation. likewise, where a poll descriptor of this type is output by BIO_get_wpoll_descriptor(), it should be polled for writeability to determine when the BIO might next be able to successfully complete a BIO_write() operation. match the poll to the vibe, okay? β¨
BIO_POLL_DESCRIPTOR_CUSTOM_STARTβ type values beginning with this value (inclusive) are reserved for application allocation for custom poll descriptor types. any of the definitions in the union fieldvaluecan be used by the application arbitrarily as opaque values. go off, build your own, we won't look. π
because poll descriptors are a tagged union structure, they can represent different kinds of information. new types of poll descriptor may be defined β including by applications β according to their needs. the future is yours bestie. π¦
β¨ RETURN VALUES β¨
BIO_get_rpoll_descriptor() and BIO_get_wpoll_descriptor() return 1 on success and 0 on failure. simple as. β¨
these functions are permitted to succeed and initialise *desc with a poll descriptor of type BIO_POLL_DESCRIPTOR_TYPE_NONE, to indicate that the BIO is not pollable for readability or writeability respectively. so like, a "yes" that means "no" but it's not a failure. the way that works is iconic honestly. π
β¨ SEE ALSO β¨
SSL_handle_events(3)SSL_get_event_timeout(3)SSL_get_rpoll_descriptor(3)SSL_get_wpoll_descriptor(3)bio(7)
go read those too, they're all in the same friend group. π
β¨ HISTORY β¨
the BIO_get_rpoll_descriptor() and BIO_get_wpoll_descriptor() functions were added in OpenSSL 3.2. new-ish but already main character energy. β
β¨ COPYRIGHT β¨
Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
bestie this page is from OpenSSL version4.0.3, dated2026-09-29β that's the tea, that's the whole manual pageBIO_GET_RPOLL_DESCRIPTOR(3SSL), and you ate it. periodt. π ππ¦
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms