aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2021-02-13 13:52:59 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-02-13 13:53:01 +0000
commit90b5fc95832da64a5f56295e687379732c33718f (patch)
treeb6fc1f9ca38b5d5ad191b5cd714dbffb8037134b /contrib
parent0ff1014944897f4f3ffa4462406cdee920b53400 (diff)
downloadsrc-90b5fc95832da64a5f56295e687379732c33718f.tar.gz
src-90b5fc95832da64a5f56295e687379732c33718f.zip
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
Diffstat (limited to 'contrib')
-rw-r--r--contrib/netbsd-tests/lib/libc/rpc/t_rpc.c10
1 files changed, 10 insertions, 0 deletions
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;