Index: sys/kern/uipc_debug.c =================================================================== --- sys/kern/uipc_debug.c (revision 254897) +++ sys/kern/uipc_debug.c (working copy) @@ -411,7 +411,7 @@ db_print_sockbuf(struct sockbuf *sb, const char *s db_print_indent(indent); db_printf("sb_ctl: %u ", sb->sb_ctl); db_printf("sb_lowat: %d ", sb->sb_lowat); - db_printf("sb_timeo: %d\n", sb->sb_timeo); + db_printf("sb_timeo: %jd\n", sb->sb_timeo); db_print_indent(indent); db_printf("sb_flags: 0x%x (", sb->sb_flags); Index: sys/kern/uipc_sockbuf.c =================================================================== --- sys/kern/uipc_sockbuf.c (revision 254897) +++ sys/kern/uipc_sockbuf.c (working copy) @@ -127,9 +127,9 @@ sbwait(struct sockbuf *sb) SOCKBUF_LOCK_ASSERT(sb); sb->sb_flags |= SB_WAIT; - return (msleep(&sb->sb_cc, &sb->sb_mtx, + return (msleep_sbt(&sb->sb_cc, &sb->sb_mtx, (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK | PCATCH, "sbwait", - sb->sb_timeo)); + sb->sb_timeo, 0, 0)); } int Index: sys/kern/uipc_socket.c =================================================================== --- sys/kern/uipc_socket.c (revision 254897) +++ sys/kern/uipc_socket.c (working copy) @@ -2541,7 +2541,7 @@ sosetopt(struct socket *so, struct sockopt *sopt) int error, optval; struct linger l; struct timeval tv; - u_long val; + sbintime_t val; uint32_t val32; #ifdef MAC struct mac extmac; @@ -2699,16 +2699,12 @@ sosetopt(struct socket *so, struct sockopt *sopt) if (error) goto bad; - if (tv.tv_sec < 0 || tv.tv_sec > INT_MAX / hz || + if (tv.tv_sec < 0 || tv.tv_sec > INT_MAX || tv.tv_usec < 0 || tv.tv_usec >= 1000000) { error = EDOM; goto bad; } - val = tvtohz(&tv); - if (val == INT_MAX) { - error = EDOM; - goto bad; - } + val = tvtosbt(tv); switch (sopt->sopt_name) { case SO_SNDTIMEO: Index: sys/sys/sockbuf.h =================================================================== --- sys/sys/sockbuf.h (revision 254897) +++ sys/sys/sockbuf.h (working copy) @@ -97,7 +97,7 @@ struct sockbuf { u_int sb_mbmax; /* (c/d) max chars of mbufs to use */ u_int sb_ctl; /* (c/d) non-data chars in buffer */ int sb_lowat; /* (c/d) low water mark */ - int sb_timeo; /* (c/d) timeout for read/write */ + sbintime_t sb_timeo; /* (c/d) timeout for read/write */ short sb_flags; /* (c/d) flags, see below */ int (*sb_upcall)(struct socket *, void *, int); /* (c/d) */ void *sb_upcallarg; /* (c/d) */