aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2021-02-13 13:52:59 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-03-17 09:57:00 +0000
commitb40b1ae9d59d15ddbb2a7ddd1d5291d3b71e227b (patch)
treec2dbc0ff66f56c650e5a975b1741f628abbbd10b
parent2f0161f405d74974f9ac74d8502de9ce6ba31728 (diff)
downloadsrc-b40b1ae9d59d15ddbb2a7ddd1d5291d3b71e227b.tar.gz
src-b40b1ae9d59d15ddbb2a7ddd1d5291d3b71e227b.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 (cherry picked from commit 90b5fc95832da64a5f56295e687379732c33718f)
-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;