Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/uipc_socket.c,v retrieving revision 1.177.2.3 retrieving revision 1.178 diff -u -p -r1.177.2.3 -r1.178 --- src/sys/kern/uipc_socket.c 2009/04/28 07:37:01 1.177.2.3 +++ src/sys/kern/uipc_socket.c 2008/12/07 20:58:46 1.178 @@ -1,11 +1,11 @@ -/* $NetBSD: uipc_socket.c,v 1.177.2.3 2009/04/28 07:37:01 skrll Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.178 2008/12/07 20:58:46 pooka Exp $ */ /*- - * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. + * Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of Wasabi Systems, Inc, and by Andrew Doran. + * by Jason R. Thorpe of Wasabi Systems, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -63,9 +63,8 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.177.2.3 2009/04/28 07:37:01 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.178 2008/12/07 20:58:46 pooka Exp $"); -#include "opt_compat_netbsd.h" #include "opt_sock_counters.h" #include "opt_sosend_loan.h" #include "opt_mbuftrace.h" @@ -93,11 +92,6 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_socket. #include #include -#ifdef COMPAT_50 -#include -#include -#endif - #include MALLOC_DEFINE(M_SOOPTS, "soopts", "socket options"); @@ -680,7 +674,7 @@ soclose(struct socket *so) if ((so->so_state & SS_ISDISCONNECTING) && so->so_nbio) goto drop; while (so->so_state & SS_ISCONNECTED) { - error = sowait(so, true, so->so_linger * hz); + error = sowait(so, so->so_linger * hz); if (error) break; } @@ -1547,20 +1541,6 @@ soshutdown(struct socket *so, int how) return error; } -int -sodrain(struct socket *so) -{ - int error; - - solock(so); - so->so_state |= SS_ISDRAINING; - cv_broadcast(&so->so_cv); - error = soshutdown(so, SHUT_RDWR); - sounlock(so); - - return error; -} - void sorflush(struct socket *so) { @@ -1596,11 +1576,11 @@ sorflush(struct socket *so) static int sosetopt1(struct socket *so, const struct sockopt *sopt) { - int error = EINVAL, optval, opt; + int error, optval; struct linger l; struct timeval tv; - switch ((opt = sopt->sopt_name)) { + switch (sopt->sopt_name) { case SO_ACCEPTFILTER: error = accept_filt_setopt(so, sopt); @@ -1633,17 +1613,14 @@ sosetopt1(struct socket *so, const struc case SO_REUSEPORT: case SO_OOBINLINE: case SO_TIMESTAMP: -#ifdef SO_OTIMESTAMP - case SO_OTIMESTAMP: -#endif error = sockopt_getint(sopt, &optval); solock(so); if (error) break; if (optval) - so->so_options |= opt; + so->so_options |= sopt->sopt_name; else - so->so_options &= ~opt; + so->so_options &= ~sopt->sopt_name; break; case SO_SNDBUF: @@ -1664,7 +1641,7 @@ sosetopt1(struct socket *so, const struc break; } - switch (opt) { + switch (sopt->sopt_name) { case SO_SNDBUF: if (sbreserve(&so->so_snd, (u_long)optval, so) == 0) { error = ENOBUFS; @@ -1701,26 +1678,9 @@ sosetopt1(struct socket *so, const struc } break; -#ifdef COMPAT_50 - case SO_OSNDTIMEO: - case SO_ORCVTIMEO: { - struct timeval50 otv; - error = sockopt_get(sopt, &otv, sizeof(otv)); - if (error) { - solock(so); - break; - } - timeval50_to_timeval(&otv, &tv); - opt = opt == SO_OSNDTIMEO ? SO_SNDTIMEO : SO_RCVTIMEO; - error = 0; - /*FALLTHROUGH*/ - } -#endif /* COMPAT_50 */ - case SO_SNDTIMEO: case SO_RCVTIMEO: - if (error) - error = sockopt_get(sopt, &tv, sizeof(tv)); + error = sockopt_get(sopt, &tv, sizeof(tv)); solock(so); if (error) break; @@ -1734,7 +1694,7 @@ sosetopt1(struct socket *so, const struc if (optval == 0 && tv.tv_usec != 0) optval = 1; - switch (opt) { + switch (sopt->sopt_name) { case SO_SNDTIMEO: so->so_snd.sb_timeo = optval; break; @@ -1807,11 +1767,11 @@ so_setsockopt(struct lwp *l, struct sock static int sogetopt1(struct socket *so, struct sockopt *sopt) { - int error, optval, opt; + int error, optval; struct linger l; struct timeval tv; - switch ((opt = sopt->sopt_name)) { + switch (sopt->sopt_name) { case SO_ACCEPTFILTER: error = accept_filt_getopt(so, sopt); @@ -1833,10 +1793,8 @@ sogetopt1(struct socket *so, struct sock case SO_BROADCAST: case SO_OOBINLINE: case SO_TIMESTAMP: -#ifdef SO_OTIMESTAMP - case SO_OTIMESTAMP: -#endif - error = sockopt_setint(sopt, (so->so_options & opt) ? 1 : 0); + error = sockopt_setint(sopt, + (so->so_options & sopt->sopt_name) ? 1 : 0); break; case SO_TYPE: @@ -1864,25 +1822,9 @@ sogetopt1(struct socket *so, struct sock error = sockopt_setint(sopt, so->so_rcv.sb_lowat); break; -#ifdef COMPAT_50 - case SO_OSNDTIMEO: - case SO_ORCVTIMEO: { - struct timeval50 otv; - - optval = (opt == SO_OSNDTIMEO ? - so->so_snd.sb_timeo : so->so_rcv.sb_timeo); - - otv.tv_sec = optval / hz; - otv.tv_usec = (optval % hz) * tick; - - error = sockopt_set(sopt, &otv, sizeof(otv)); - break; - } -#endif /* COMPAT_50 */ - case SO_SNDTIMEO: case SO_RCVTIMEO: - optval = (opt == SO_SNDTIMEO ? + optval = (sopt->sopt_name == SO_SNDTIMEO ? so->so_snd.sb_timeo : so->so_rcv.sb_timeo); tv.tv_sec = optval / hz; @@ -2324,7 +2266,7 @@ sysctl_kern_somaxkva(SYSCTLFN_ARGS) } static void -sysctl_kern_somaxkva_setup(void) +sysctl_kern_somaxkva_setup() { KASSERT(socket_sysctllog == NULL);