Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 2021 10:27:49 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b40b1ae9d59d - stable/13 - lib/libc/tests/rpc: Correctly set timeout
Message-ID:  <202103171027.12HARnvI096121@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=b40b1ae9d59d15ddbb2a7ddd1d5291d3b71e227b

commit b40b1ae9d59d15ddbb2a7ddd1d5291d3b71e227b
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-02-13 13:52:59 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-03-17 09:57:00 +0000

    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)
---
 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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103171027.12HARnvI096121>