From 97c8a17c7ceb3b98b9618cc5aad821417833fbdc Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Wed, 15 Jan 2020 13:17:36 +0000 Subject: Keep socket timeout intervals in nsecs and use them with tsleep_nsec(9). Introduce and use TIMEVAL_TO_NSEC() to convert SO_RCVTIMEO/SO_SNDTIMEO specified values into nanoseconds. As a side effect it is now possible to specify a timeout larger that (USHRT_MAX / 100) seconds. To keep code simple `so_linger' now represents a number of seconds with 0 meaning no timeout or 'infinity'. Yes, the 0 -> INFSLP API change makes conversions complicated as many timeout holders are still memset()'d. Inputs from cheloha@ and bluhm@, ok bluhm@ --- sys/nfs/nfs_syscalls.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/nfs/nfs_syscalls.c') diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 4a5a30c13df..637ef9d6dc3 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.115 2019/12/05 10:41:57 mpi Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.116 2020/01/15 13:17:35 mpi Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -276,9 +276,9 @@ nfssvc_addsock(struct file *fp, struct mbuf *mynam) m_freem(m); } so->so_rcv.sb_flags &= ~SB_NOINTR; - so->so_rcv.sb_timeo = 0; + so->so_rcv.sb_timeo_nsecs = INFSLP; so->so_snd.sb_flags &= ~SB_NOINTR; - so->so_snd.sb_timeo = 0; + so->so_snd.sb_timeo_nsecs = INFSLP; sounlock(so, s); if (tslp) slp = tslp; -- cgit v1.2.3