Download raw body.
rpc: fix dispatch() in svc_register()
On Thu, Aug 06, 2026 at 10:58:03AM +0200, Theo Buehler wrote:
> The rpc/svc.h header declares svc_register() as follows:
>
> extern bool_t svc_register(SVCXPRT *, unsigned long, unsigned long,
> void (*)(struct svc_req *, SVCXPRT *), int);
>
> The diff below adjusts the function definition to match and does the
> same with the sc_dispatch() member of struct svc_callout.
>
> The rpc(3) documentation already says this further down:
>
> The procedure dispatch has the following
> form: int dispatch(struct svc_req *request, SVCXPRT *xprt) The
> svc_register() routine returns one if it succeeds, and zero otherwise.
>
> All svc_register() callers (in C code or generated code) pass a function
> pointer of the correct signature.
>
> The diff does not change the generated assembly on aarch64 and silences
> a -Wdeprecated-non-prototype warning.
Makes sense to me. OK claudio@
> Index: lib/libc/rpc/rpc.3
> ===================================================================
> RCS file: /cvs/src/lib/libc/rpc/rpc.3,v
> diff -u -p -r1.50 rpc.3
> --- lib/libc/rpc/rpc.3 13 Jun 2025 18:34:00 -0000 1.50
> +++ lib/libc/rpc/rpc.3 9 Jul 2026 19:40:41 -0000
> @@ -201,7 +201,7 @@
> .Ft int
> .Fn svc_getreq "int rdfds"
> .Ft int
> -.Fn svc_register "SVCXPRT *xprt" "u_long prognum" "u_long versnum" "void (*dispatch)()" "u_long protocol"
> +.Fn svc_register "SVCXPRT *xprt" "u_long prognum" "u_long versnum" "void (*dispatch)(struct svc_req *, SVCXPRT *)" "u_long protocol"
> .Ft int
> .Fn svc_run "void"
> .Ft int
> Index: lib/libc/rpc/svc.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/rpc/svc.c,v
> diff -u -p -r1.29 svc.c
> --- lib/libc/rpc/svc.c 5 Oct 2015 01:23:17 -0000 1.29
> +++ lib/libc/rpc/svc.c 10 Jul 2026 11:20:11 -0000
> @@ -63,7 +63,7 @@ static struct svc_callout {
> struct svc_callout *sc_next;
> u_long sc_prog;
> u_long sc_vers;
> - void (*sc_dispatch)();
> + void (*sc_dispatch)(struct svc_req *, SVCXPRT *);
> } *svc_head;
>
> static struct svc_callout *svc_find(u_long, u_long, struct svc_callout **);
> @@ -289,8 +289,8 @@ DEF_WEAK(xprt_unregister);
> * program number comes in.
> */
> bool_t
> -svc_register(SVCXPRT *xprt, u_long prog, u_long vers, void (*dispatch)(),
> - int protocol)
> +svc_register(SVCXPRT *xprt, u_long prog, u_long vers,
> + void (*dispatch)(struct svc_req *, SVCXPRT *), int protocol)
> {
> struct svc_callout *prev;
> struct svc_callout *s;
>
--
:wq Claudio
rpc: fix dispatch() in svc_register()