The branch main has been updated by brooks:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e236502a997da6bc94d018d5c5f79bfe17f0f1e7

commit e236502a997da6bc94d018d5c5f79bfe17f0f1e7
Author:     Brooks Davis <[email protected]>
AuthorDate: 2026-02-02 21:20:10 +0000
Commit:     Brooks Davis <[email protected]>
CommitDate: 2026-02-02 21:20:10 +0000

    clnt_broadcast(3): fix eachresult argument type
    
    The `eachresult` argument is documented to take a function pointer of
    type:
    
            bool_t (*)(caddr_t, struct sockaddr_in *)
    
    It was declared to take a resultproc_t which has historically been
    declared to be:
    
            bool_t (*resultproc_t)(caddr_t, ...);
    
    This overlapped well enough for currently supported ABIs where variadic
    arguments are passed in registers, but this declaration is misaligned
    with the documentation (resultproc_t takes three arguments) and will be
    fixed in a followup commit.
    
    Fix the type to be non-variadic, matching callbacks, and define a
    convenience type of as most callbacks take something other than a char *
    as their first argument and need to be cast.
    
    Effort:         CHERI upstreaming
    Reviewed by:    ngie, glebius, jhb
    Sponsored by:   DARPA, AFRL
    Differential Revision:  https://reviews.freebsd.org/D54940
---
 include/rpc/pmap_clnt.h                   | 4 +++-
 lib/libc/rpc/rpc_soc.c                    | 5 +++--
 usr.bin/rup/rup.c                         | 2 +-
 usr.bin/rusers/rusers.c                   | 2 +-
 usr.sbin/bootparamd/callbootd/callbootd.c | 4 ++--
 usr.sbin/ypbind/ypbind.c                  | 2 +-
 6 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index d3a67778530b..7d6cee307573 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -64,6 +64,8 @@
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
+typedef bool_t (*clnt_broadcast_resultproc_t)(caddr_t, struct sockaddr_in *);
+
 extern bool_t          pmap_set(u_long, u_long, int, int);
 extern bool_t          pmap_unset(u_long, u_long);
 extern struct pmaplist *pmap_getmaps(struct sockaddr_in *);
@@ -75,7 +77,7 @@ extern enum clnt_stat pmap_rmtcall(struct sockaddr_in *,
 extern enum clnt_stat  clnt_broadcast(u_long, u_long, u_long,
                                       xdrproc_t, void *,
                                       xdrproc_t, void *,
-                                      resultproc_t);
+                                      clnt_broadcast_resultproc_t);
 extern u_short         pmap_getport(struct sockaddr_in *,
                                     u_long, u_long, u_int);
 __END_DECLS
diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c
index 21a36cedf69f..e986593badf4 100644
--- a/lib/libc/rpc/rpc_soc.c
+++ b/lib/libc/rpc/rpc_soc.c
@@ -310,7 +310,7 @@ registerrpc(int prognum, int versnum, int procnum,
  * Support the earlier calling style of the callback function with a
  * per-thread temporary copy of the real callback.
  */
-static _Thread_local resultproc_t      clnt_broadcast_result;
+static _Thread_local clnt_broadcast_resultproc_t clnt_broadcast_result;
 
 /*
  * Need to translate the netbuf address into sockaddr_in address.
@@ -336,7 +336,8 @@ rpc_wrap_bcast(char *resultp, struct netbuf *addr, struct 
netconfig *nconf)
  */
 enum clnt_stat
 clnt_broadcast(u_long prog, u_long vers, u_long proc, xdrproc_t xargs,
-    void *argsp, xdrproc_t xresults, void *resultsp, resultproc_t eachresult)
+    void *argsp, xdrproc_t xresults, void *resultsp,
+    clnt_broadcast_resultproc_t eachresult)
 /*
  *     u_long          prog;           // program number
  *     u_long          vers;           // version number
diff --git a/usr.bin/rup/rup.c b/usr.bin/rup/rup.c
index 5f605f55b413..d53d4ebcd28e 100644
--- a/usr.bin/rup/rup.c
+++ b/usr.bin/rup/rup.c
@@ -206,7 +206,7 @@ allhosts(void)
        clnt_stat = clnt_broadcast(RSTATPROG, RSTATVERS_TIME, RSTATPROC_STATS,
                                   (xdrproc_t)xdr_void, NULL,
                                   (xdrproc_t)xdr_statstime, &host_stat,
-                                  (resultproc_t)rstat_reply);
+                                  (clnt_broadcast_resultproc_t)rstat_reply);
        if (clnt_stat != RPC_SUCCESS && clnt_stat != RPC_TIMEDOUT)
                errx(1, "%s", clnt_sperrno(clnt_stat));
 }
diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c
index 413de53c304b..c23b79240fad 100644
--- a/usr.bin/rusers/rusers.c
+++ b/usr.bin/rusers/rusers.c
@@ -208,7 +208,7 @@ allhosts(void)
        clnt_stat = clnt_broadcast(RUSERSPROG, RUSERSVERS_IDLE,
            RUSERSPROC_NAMES, (xdrproc_t)xdr_void, NULL,
            (xdrproc_t)xdr_utmpidlearr, (char *)&up,
-           (resultproc_t)rusers_reply);
+           (clnt_broadcast_resultproc_t)rusers_reply);
        if (clnt_stat != RPC_SUCCESS && clnt_stat != RPC_TIMEDOUT)
                errx(1, "%s", clnt_sperrno(clnt_stat));
 }
diff --git a/usr.sbin/bootparamd/callbootd/callbootd.c 
b/usr.sbin/bootparamd/callbootd/callbootd.c
index f9939d83cab9..69d62f0c4bee 100644
--- a/usr.sbin/bootparamd/callbootd/callbootd.c
+++ b/usr.sbin/bootparamd/callbootd/callbootd.c
@@ -111,7 +111,7 @@ main(int argc, char **argv)
                               (char *)&whoami_arg,
                               (xdrproc_t)xdr_bp_whoami_res,
                               (char *)&stat_whoami_res,
-                              (resultproc_t)eachres_whoami);
+                              (clnt_broadcast_resultproc_t)eachres_whoami);
        exit(0);
      }
 
@@ -134,7 +134,7 @@ main(int argc, char **argv)
                               (char *)&getfile_arg,
                               (xdrproc_t)xdr_bp_getfile_res,
                               (char *)&stat_getfile_res,
-                              (resultproc_t)eachres_getfile);
+                              (clnt_broadcast_resultproc_t)eachres_getfile);
       exit(0);
     }
 
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c
index 2aacfa5c87d6..6ed45eeb8dc6 100644
--- a/usr.sbin/ypbind/ypbind.c
+++ b/usr.sbin/ypbind/ypbind.c
@@ -748,7 +748,7 @@ broadcast(struct _dom_binding *ypdb)
                stat = clnt_broadcast(YPPROG, YPVERS, YPPROC_DOMAIN_NONACK,
                        (xdrproc_t)xdr_domainname, &ptr,
                        (xdrproc_t)xdr_bool, &out,
-                       (resultproc_t)broadcast_result);
+                       (clnt_broadcast_resultproc_t)broadcast_result);
        }
 
        if (stat != RPC_SUCCESS) {

Reply via email to