As per subject imsg_get is not documented although it's used
extensively in the OpenBSD sources (288 counts including about 50%
error messages). "apropos imsg_get" lists the imsg_init(3) manpage
but "man imsg_get" doesn't open it (a kind of reverse scunthorpe
problem).

Is this by design or an oversight? If the former what should we be
using instead?

Matthew

ps. I'm not at all tied to the wording below (and should the
introductory "The accessors" phrase be moved to this now-first
paragraph?) I just didn't want to send in such a trivial bug report
without a complete patch.

--- /usr/src/lib/libutil/imsg_init.3    Thu May  7 17:09:01 2026
+++ /home/chohag/src/imsg_init.3        Tue Jul 21 20:11:36 2026
@@ -27,6 +27,7 @@
 .Nm imsg_create ,
 .Nm imsg_forward ,
 .Nm imsg_free ,
+.Nm imsg_get ,
 .Nm imsg_get_buf ,
 .Nm imsg_get_data ,
 .Nm imsg_get_fd ,
@@ -72,6 +73,8 @@
 .Ft void
 .Fn imsg_free "struct imsg *imsg"
 .Ft int
+.Fn imsg_get "struct imsgbuf *imsgbuf" "struct imsg *imsg"
+.Ft int
 .Fn imsg_get_buf "struct imsg *imsg" "void *data" "size_t len"
 .Ft int
 .Fn imsg_get_data "struct imsg *imsg" "void *data" "size_t len"
@@ -311,6 +314,19 @@
 It is possible to call
 .Fn imsg_forward
 more than once per message.
+.Pp
+.Fn imsg_get
+works identically to
+.Fn imsgbuf_get
+except for the return value: if a message is waiting then it is
+filled into the structure pointed to by
+.Em struct imsg
+which must be freed by
+.Fn imsg_free
+when no longer required.
+Otherwise the value 0 is returned if there are no messages in
+.Fa imsgbuf
+or \-1 if an error occurred.
 .Pp
 The accessors
 .Fn imsg_get_type ,

Reply via email to