From 90b5fc95832da64a5f56295e687379732c33718f Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 13 Feb 2021 13:52:59 +0000 Subject: [PATCH] lib/libc/tests/rpc: Correctly set timeout The rpc_control() API does not accept the CLCR_SET_RPCB_TIMEOUT command, it only accepts RPC_SVC_CONNMAXREC_GET/RPC_SVC_CONNMAXREC_SET, so it was not doing anything. Instead of incorrectly calling this API, use clnt_create_timed() instead. I noticed this because the test was timing out after 120s in the CheriBSD CI. Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28478 --- contrib/netbsd-tests/lib/libc/rpc/t_rpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c index 59bcd5590764..3000f6aec98b 100644 --- a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c +++ b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c @@ -72,11 +72,21 @@ onehost(const char *host, const char *transp) */ tv.tv_sec = 0; tv.tv_usec = 500000; +#ifdef __FreeBSD__ + /* + * FreeBSD does not allow setting the timeout using __rpc_control, + * but does have clnt_create_timed() that allows passing a timeout. + */ + if ((clnt = clnt_create_timed(host, RPCBPROG, RPCBVERS, transp, + &tv)) == NULL) + SKIPX(, "clnt_create (%s)", clnt_spcreateerror("")); +#else #define CLCR_SET_RPCB_TIMEOUT 2 __rpc_control(CLCR_SET_RPCB_TIMEOUT, &tv); if ((clnt = clnt_create(host, RPCBPROG, RPCBVERS, transp)) == NULL) SKIPX(, "clnt_create (%s)", clnt_spcreateerror("")); +#endif tv.tv_sec = 1; tv.tv_usec = 0;