Deleted Added
sdiff udiff text old ( 191917 ) new ( 193272 )
full compact
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California.
4 * Copyright (c) 2004 The FreeBSD Foundation
5 * Copyright (c) 2004-2008 Robert N. M. Watson
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 81 unchanged lines hidden (view full) ---

90 * calls to explicitly manage socket references, soref(), and sorele().
91 * Currently, these are generally required only when transitioning a socket
92 * from a listen queue to a file descriptor, in order to prevent garbage
93 * collection of the socket at an untimely moment. For a number of reasons,
94 * these interfaces are not preferred, and should be avoided.
95 */
96
97#include <sys/cdefs.h>
98__FBSDID("$FreeBSD: head/sys/kern/uipc_socket.c 191917 2009-05-08 14:34:25Z zec $");
99
100#include "opt_inet.h"
101#include "opt_inet6.h"
102#include "opt_mac.h"
103#include "opt_zero.h"
104#include "opt_compat.h"
105
106#include <sys/param.h>

--- 2942 unchanged lines hidden (view full) ---

3049 so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING);
3050 so->so_state |= SS_ISCONNECTING;
3051 SOCK_UNLOCK(so);
3052}
3053
3054void
3055soisconnected(struct socket *so)
3056{
3057 struct socket *head;
3058
3059 ACCEPT_LOCK();
3060 SOCK_LOCK(so);
3061 so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
3062 so->so_state |= SS_ISCONNECTED;
3063 head = so->so_head;
3064 if (head != NULL && (so->so_qstate & SQ_INCOMP)) {
3065 if ((so->so_options & SO_ACCEPTFILTER) == 0) {
3066 SOCK_UNLOCK(so);
3067 TAILQ_REMOVE(&head->so_incomp, so, so_list);
3068 head->so_incqlen--;
3069 so->so_qstate &= ~SQ_INCOMP;
3070 TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
3071 head->so_qlen++;
3072 so->so_qstate |= SQ_COMP;
3073 ACCEPT_UNLOCK();
3074 sorwakeup(head);
3075 wakeup_one(&head->so_timeo);
3076 } else {
3077 ACCEPT_UNLOCK();
3078 so->so_upcall =
3079 head->so_accf->so_accept_filter->accf_callback;
3080 so->so_upcallarg = head->so_accf->so_accept_filter_arg;
3081 so->so_rcv.sb_flags |= SB_UPCALL;
3082 so->so_options &= ~SO_ACCEPTFILTER;
3083 SOCK_UNLOCK(so);
3084 so->so_upcall(so, so->so_upcallarg, M_DONTWAIT);
3085 }
3086 return;
3087 }
3088 SOCK_UNLOCK(so);
3089 ACCEPT_UNLOCK();
3090 wakeup(&so->so_timeo);
3091 sorwakeup(so);
3092 sowwakeup(so);

--- 48 unchanged lines hidden (view full) ---

3141
3142 sa2 = malloc(sa->sa_len, M_SONAME, mflags);
3143 if (sa2)
3144 bcopy(sa, sa2, sa->sa_len);
3145 return sa2;
3146}
3147
3148/*
3149 * Create an external-format (``xsocket'') structure using the information in
3150 * the kernel-format socket structure pointed to by so. This is done to
3151 * reduce the spew of irrelevant information over this interface, to isolate
3152 * user code from changes in the kernel structure, and potentially to provide
3153 * information-hiding if we decide that some of this information should be
3154 * hidden from users.
3155 */
3156void

--- 162 unchanged lines hidden ---