BIO: Allow third parties to use integers instead of pointers for poll descriptors
authorHugo Landau <hlandau@openssl.org>
Wed, 30 Aug 2023 12:45:40 +0000 (13:45 +0100)
committerHugo Landau <hlandau@openssl.org>
Fri, 1 Sep 2023 13:02:50 +0000 (14:02 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21905)

doc/man3/BIO_get_rpoll_descriptor.pod
include/openssl/bio.h.in

index 9de9f1fb014704719e68a712205683e5199037a5..ce33e23f26e481fdde9fdd7a61f5233555543cac 100644 (file)
@@ -10,10 +10,11 @@ can be used to determine when a BIO object can next be read or written
  #include <openssl/bio.h>
 
  typedef struct bio_poll_descriptor_st {
-     int type;
+     uint32_t type;
      union {
-         int     fd;
-         void    *custom;
+         int        fd;
+         void       *custom;
+         uintptr_t  custom_ui;
      } value;
  } BIO_POLL_DESCRIPTOR;
 
@@ -71,9 +72,8 @@ complete a BIO_write() operation.
 =item BIO_POLL_DESCRIPTOR_CUSTOM_START
 
 Type values beginning with this value (inclusive) are reserved for application
-allocation for custom poll descriptor types. The field I<value.custom> in the
-B<BIO_POLL_DESCRIPTOR> is an opaque pointer which can be used by the application
-arbitrarily.
+allocation for custom poll descriptor types. Any of the definitions in the union
+field I<value> can be used by the application arbitrarily as opaque values.
 
 =back
 
index aa05d7d9cf41bd09074d0abf6da69a58f9b1f63e..735361b17b1d070f5b2e71db608fb4a24b9572df 100644 (file)
@@ -387,10 +387,11 @@ typedef struct bio_mmsg_cb_args_st {
 #define BIO_POLL_DESCRIPTOR_CUSTOM_START    8192
 
 typedef struct bio_poll_descriptor_st {
-    int type;
+    uint32_t type;
     union {
-        int     fd;
-        void    *custom;
+        int         fd;
+        void        *custom;
+        uintptr_t   custom_ui;
     } value;
 } BIO_POLL_DESCRIPTOR;