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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user