version 1.177.2.3, 2009/04/28 07:37:01 |
version 1.182, 2009/01/15 15:25:37 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
|
|
/*- |
/*- |
* Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. |
* Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc. |
* All rights reserved. |
* All rights reserved. |
* |
* |
* This code is derived from software contributed to The NetBSD Foundation |
* 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 |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* modification, are permitted provided that the following conditions |
Line 95 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 95 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
#ifdef COMPAT_50 |
#ifdef COMPAT_50 |
#include <compat/sys/time.h> |
#include <compat/sys/time.h> |
#include <compat/sys/socket.h> |
#define SO_OSNDTIMEO 0x1005 |
|
#define SO_ORCVTIMEO 0x1006 |
#endif |
#endif |
|
|
#include <uvm/uvm.h> |
#include <uvm/uvm.h> |
Line 680 soclose(struct socket *so) |
|
Line 681 soclose(struct socket *so) |
|
if ((so->so_state & SS_ISDISCONNECTING) && so->so_nbio) |
if ((so->so_state & SS_ISDISCONNECTING) && so->so_nbio) |
goto drop; |
goto drop; |
while (so->so_state & SS_ISCONNECTED) { |
while (so->so_state & SS_ISCONNECTED) { |
error = sowait(so, true, so->so_linger * hz); |
error = sowait(so, so->so_linger * hz); |
if (error) |
if (error) |
break; |
break; |
} |
} |
Line 1547 soshutdown(struct socket *so, int how) |
|
Line 1548 soshutdown(struct socket *so, int how) |
|
return error; |
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 |
void |
sorflush(struct socket *so) |
sorflush(struct socket *so) |
{ |
{ |
Line 1633 sosetopt1(struct socket *so, const struc |
|
Line 1620 sosetopt1(struct socket *so, const struc |
|
case SO_REUSEPORT: |
case SO_REUSEPORT: |
case SO_OOBINLINE: |
case SO_OOBINLINE: |
case SO_TIMESTAMP: |
case SO_TIMESTAMP: |
#ifdef SO_OTIMESTAMP |
|
case SO_OTIMESTAMP: |
|
#endif |
|
error = sockopt_getint(sopt, &optval); |
error = sockopt_getint(sopt, &optval); |
solock(so); |
solock(so); |
if (error) |
if (error) |
Line 1706 sosetopt1(struct socket *so, const struc |
|
Line 1690 sosetopt1(struct socket *so, const struc |
|
case SO_ORCVTIMEO: { |
case SO_ORCVTIMEO: { |
struct timeval50 otv; |
struct timeval50 otv; |
error = sockopt_get(sopt, &otv, sizeof(otv)); |
error = sockopt_get(sopt, &otv, sizeof(otv)); |
if (error) { |
|
solock(so); |
|
break; |
|
} |
|
timeval50_to_timeval(&otv, &tv); |
timeval50_to_timeval(&otv, &tv); |
opt = opt == SO_OSNDTIMEO ? SO_SNDTIMEO : SO_RCVTIMEO; |
opt = opt == SO_OSNDTIMEO ? SO_SNDTIMEO : SO_RCVTIMEO; |
error = 0; |
error = 0; |
Line 1833 sogetopt1(struct socket *so, struct sock |
|
Line 1813 sogetopt1(struct socket *so, struct sock |
|
case SO_BROADCAST: |
case SO_BROADCAST: |
case SO_OOBINLINE: |
case SO_OOBINLINE: |
case SO_TIMESTAMP: |
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 & opt) ? 1 : 0); |
break; |
break; |
|
|
Line 2324 sysctl_kern_somaxkva(SYSCTLFN_ARGS) |
|
Line 2301 sysctl_kern_somaxkva(SYSCTLFN_ARGS) |
|
} |
} |
|
|
static void |
static void |
sysctl_kern_somaxkva_setup(void) |
sysctl_kern_somaxkva_setup() |
{ |
{ |
|
|
KASSERT(socket_sysctllog == NULL); |
KASSERT(socket_sysctllog == NULL); |