kernel -- Convert sb_timeo for socket timeout from short -> int.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Tue, 10 May 2011 19:54:07 +0000 (12:54 -0700)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Tue, 10 May 2011 19:54:07 +0000 (12:54 -0700)
Allows socket timeouts longer than 327; allows Varnish to run w/ default
configuration.

sys/kern/uipc_socket.c
sys/sys/socketvar.h

index f523a21..ff5236a 100644 (file)
@@ -1228,7 +1228,6 @@ sorflush(struct socket *so)
         */
        bzero(&ssb->sb, sizeof(ssb->sb));
        ssb->ssb_timeo = 0;
-       ssb->ssb_unused01 = 0;
        ssb->ssb_lowat = 0;
        ssb->ssb_hiwat = 0;
        ssb->ssb_mbmax = 0;
@@ -1473,15 +1472,15 @@ sosetopt(struct socket *so, struct sockopt *sopt)
                                goto bad;
 
                        /* assert(hz > 0); */
-                       if (tv.tv_sec < 0 || tv.tv_sec > SHRT_MAX / hz ||
+                       if (tv.tv_sec < 0 || tv.tv_sec > INT_MAX / hz ||
                            tv.tv_usec < 0 || tv.tv_usec >= 1000000) {
                                error = EDOM;
                                goto bad;
                        }
                        /* assert(tick > 0); */
-                       /* assert(ULONG_MAX - SHRT_MAX >= 1000000); */
+                       /* assert(ULONG_MAX - INT_MAX >= 1000000); */
                        val = (u_long)(tv.tv_sec * hz) + tv.tv_usec / ustick;
-                       if (val > SHRT_MAX) {
+                       if (val > INT_MAX) {
                                error = EDOM;
                                goto bad;
                        }
index 4768c69..f5ac9a7 100644 (file)
@@ -69,8 +69,7 @@ struct signalsockbuf {
        struct sockbuf sb;
        struct kqinfo ssb_kq;   /* process selecting read/write */
        uint32_t ssb_flags;     /* flags, see below (use atomic ops) */
-       short   ssb_timeo;      /* timeout for read/write */
-       short   ssb_unused01;
+       u_int   ssb_timeo;      /* timeout for read/write */
        long    ssb_lowat;      /* low water mark */
        u_long  ssb_hiwat;      /* high water mark / max actual char count */
        u_long  ssb_mbmax;      /* max chars of mbufs to use */
@@ -203,8 +202,8 @@ struct      xsocket {
                u_long  sb_mbcnt;
                u_long  sb_mbmax;
                long    sb_lowat;
+               u_int   sb_timeo;
                short   sb_flags;
-               short   sb_timeo;
        } so_rcv, so_snd;
        uid_t   so_uid;         /* XXX */
 };