\hypertarget{uipc__socket_8c_source}{}\doxysection{uipc\+\_\+socket.\+c}
\label{uipc__socket_8c_source}\index{kern/uipc\_socket.c@{kern/uipc\_socket.c}}
\mbox{\hyperlink{uipc__socket_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/3-\/Clause}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 1982, 1986, 1988, 1990, 1993}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00005}00005 \textcolor{comment}{ *      The Regents of the University of California.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 2004 The FreeBSD Foundation}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00007}00007 \textcolor{comment}{ * Copyright (c) 2004-\/2008 Robert N. M. Watson}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00008}00008 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00009}00009 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00010}00010 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00011}00011 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00012}00012 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00013}00013 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00014}00014 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00015}00015 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00016}00016 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00017}00017 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00018}00018 \textcolor{comment}{ * 3. Neither the name of the University nor the names of its contributors}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00019}00019 \textcolor{comment}{ *    may be used to endorse or promote products derived from this software}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00020}00020 \textcolor{comment}{ *    without specific prior written permission.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00021}00021 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00022}00022 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00023}00023 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00024}00024 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00025}00025 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00026}00026 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00027}00027 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00028}00028 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00029}00029 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00030}00030 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00031}00031 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00032}00032 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00033}00033 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00034}00034 \textcolor{comment}{ *      @(\#)uipc\_socket.c       8.3 (Berkeley) 4/15/94}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00035}00035 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00036}00036 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00037}00037 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00038}00038 \textcolor{comment}{ * Comments on the socket life cycle:}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00039}00039 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00040}00040 \textcolor{comment}{ * soalloc() sets of socket layer state for a socket, called only by}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00041}00041 \textcolor{comment}{ * socreate() and sonewconn().  Socket layer private.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00042}00042 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00043}00043 \textcolor{comment}{ * sodealloc() tears down socket layer state for a socket, called only by}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00044}00044 \textcolor{comment}{ * sofree() and sonewconn().  Socket layer private.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00045}00045 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00046}00046 \textcolor{comment}{ * pru\_attach() associates protocol layer state with an allocated socket;}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00047}00047 \textcolor{comment}{ * called only once, may fail, aborting socket allocation.  This is called}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00048}00048 \textcolor{comment}{ * from socreate() and sonewconn().  Socket layer private.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00049}00049 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00050}00050 \textcolor{comment}{ * pru\_detach() disassociates protocol layer state from an attached socket,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00051}00051 \textcolor{comment}{ * and will be called exactly once for sockets in which pru\_attach() has}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00052}00052 \textcolor{comment}{ * been successfully called.  If pru\_attach() returned an error,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00053}00053 \textcolor{comment}{ * pru\_detach() will not be called.  Socket layer private.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00054}00054 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00055}00055 \textcolor{comment}{ * pru\_abort() and pru\_close() notify the protocol layer that the last}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00056}00056 \textcolor{comment}{ * consumer of a socket is starting to tear down the socket, and that the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00057}00057 \textcolor{comment}{ * protocol should terminate the connection.  Historically, pru\_abort() also}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00058}00058 \textcolor{comment}{ * detached protocol state from the socket state, but this is no longer the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00059}00059 \textcolor{comment}{ * case.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00060}00060 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00061}00061 \textcolor{comment}{ * socreate() creates a socket and attaches protocol state.  This is a public}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00062}00062 \textcolor{comment}{ * interface that may be used by socket layer consumers to create new}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00063}00063 \textcolor{comment}{ * sockets.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00064}00064 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00065}00065 \textcolor{comment}{ * sonewconn() creates a socket and attaches protocol state.  This is a}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00066}00066 \textcolor{comment}{ * public interface  that may be used by protocols to create new sockets when}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00067}00067 \textcolor{comment}{ * a new connection is received and will be available for accept() on a}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00068}00068 \textcolor{comment}{ * listen socket.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00069}00069 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00070}00070 \textcolor{comment}{ * soclose() destroys a socket after possibly waiting for it to disconnect.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00071}00071 \textcolor{comment}{ * This is a public interface that socket consumers should use to close and}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00072}00072 \textcolor{comment}{ * release a socket when done with it.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00073}00073 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00074}00074 \textcolor{comment}{ * soabort() destroys a socket without waiting for it to disconnect (used}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00075}00075 \textcolor{comment}{ * only for incoming connections that are already partially or fully}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00076}00076 \textcolor{comment}{ * connected).  This is used internally by the socket layer when clearing}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00077}00077 \textcolor{comment}{ * listen socket queues (due to overflow or close on the listen socket), but}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00078}00078 \textcolor{comment}{ * is also a public interface protocols may use to abort connections in}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00079}00079 \textcolor{comment}{ * their incomplete listen queues should they no longer be required.  Sockets}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00080}00080 \textcolor{comment}{ * placed in completed connection listen queues should not be aborted for}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00081}00081 \textcolor{comment}{ * reasons described in the comment above the soclose() implementation.  This}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00082}00082 \textcolor{comment}{ * is not a general purpose close routine, and except in the specific}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00083}00083 \textcolor{comment}{ * circumstances described here, should not be used.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00084}00084 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00085}00085 \textcolor{comment}{ * sofree() will free a socket and its protocol state if all references on}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00086}00086 \textcolor{comment}{ * the socket have been released, and is the public interface to attempt to}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00087}00087 \textcolor{comment}{ * free a socket when a reference is removed.  This is a socket layer private}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00088}00088 \textcolor{comment}{ * interface.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00089}00089 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00090}00090 \textcolor{comment}{ * NOTE: In addition to socreate() and soclose(), which provide a single}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00091}00091 \textcolor{comment}{ * socket reference to the consumer to be managed as required, there are two}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00092}00092 \textcolor{comment}{ * calls to explicitly manage socket references, soref(), and sorele().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00093}00093 \textcolor{comment}{ * Currently, these are generally required only when transitioning a socket}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00094}00094 \textcolor{comment}{ * from a listen queue to a file descriptor, in order to prevent garbage}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00095}00095 \textcolor{comment}{ * collection of the socket at an untimely moment.  For a number of reasons,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00096}00096 \textcolor{comment}{ * these interfaces are not preferred, and should be avoided.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00097}00097 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00098}00098 \textcolor{comment}{ * NOTE: With regard to VNETs the general rule is that callers do not set}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00099}00099 \textcolor{comment}{ * curvnet. Exceptions to this rule include soabort(), sodisconnect(),}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00100}00100 \textcolor{comment}{ * sofree() (and with that sorele(), sotryfree()), as well as sonewconn()}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00101}00101 \textcolor{comment}{ * and sorflush(), which are usually called from a pre-\/set VNET context.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00102}00102 \textcolor{comment}{ * sopoll() currently does not need a VNET context to be set.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00103}00103 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00104}00104 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00105}00105 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00106}\mbox{\hyperlink{uipc__socket_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00106}} \mbox{\hyperlink{uipc__socket_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00107}00107 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00108}00108 \textcolor{preprocessor}{\#include "{}opt\_inet.h"{}}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00109}00109 \textcolor{preprocessor}{\#include "{}opt\_inet6.h"{}}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00110}00110 \textcolor{preprocessor}{\#include "{}opt\_kern\_tls.h"{}}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00111}00111 \textcolor{preprocessor}{\#include "{}opt\_sctp.h"{}}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00112}00112 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00113}00113 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00114}00114 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00115}00115 \textcolor{preprocessor}{\#include <sys/capsicum.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00116}00116 \textcolor{preprocessor}{\#include <sys/fcntl.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00117}00117 \textcolor{preprocessor}{\#include <sys/limits.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00118}00118 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00119}00119 \textcolor{preprocessor}{\#include <sys/mac.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00120}00120 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00121}00121 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00122}00122 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00123}00123 \textcolor{preprocessor}{\#include <sys/domain.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00124}00124 \textcolor{preprocessor}{\#include <sys/file.h>}                   \textcolor{comment}{/* for struct knote */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00125}00125 \textcolor{preprocessor}{\#include <sys/hhook.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00126}00126 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00127}00127 \textcolor{preprocessor}{\#include <sys/khelp.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00128}00128 \textcolor{preprocessor}{\#include <sys/ktls.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00129}00129 \textcolor{preprocessor}{\#include <sys/event.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00130}00130 \textcolor{preprocessor}{\#include <sys/eventhandler.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00131}00131 \textcolor{preprocessor}{\#include <sys/poll.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00132}00132 \textcolor{preprocessor}{\#include <sys/proc.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00133}00133 \textcolor{preprocessor}{\#include <sys/protosw.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00134}00134 \textcolor{preprocessor}{\#include <sys/sbuf.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00135}00135 \textcolor{preprocessor}{\#include <sys/socket.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00136}00136 \textcolor{preprocessor}{\#include <sys/socketvar.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00137}00137 \textcolor{preprocessor}{\#include <sys/resourcevar.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00138}00138 \textcolor{preprocessor}{\#include <net/route.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00139}00139 \textcolor{preprocessor}{\#include <sys/signalvar.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00140}00140 \textcolor{preprocessor}{\#include <sys/stat.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00141}00141 \textcolor{preprocessor}{\#include <sys/sx.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00142}00142 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00143}00143 \textcolor{preprocessor}{\#include <sys/taskqueue.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00144}00144 \textcolor{preprocessor}{\#include <sys/uio.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00145}00145 \textcolor{preprocessor}{\#include <sys/un.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00146}00146 \textcolor{preprocessor}{\#include <sys/unpcb.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00147}00147 \textcolor{preprocessor}{\#include <sys/jail.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00148}00148 \textcolor{preprocessor}{\#include <sys/syslog.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00149}00149 \textcolor{preprocessor}{\#include <netinet/in.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00150}00150 \textcolor{preprocessor}{\#include <netinet/in\_pcb.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00151}00151 \textcolor{preprocessor}{\#include <netinet/tcp.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00152}00152 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00153}00153 \textcolor{preprocessor}{\#include <net/vnet.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00154}00154 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00155}00155 \textcolor{preprocessor}{\#include <security/mac/mac\_framework.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00156}00156 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00157}00157 \textcolor{preprocessor}{\#include <vm/uma.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00158}00158 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00159}00159 \textcolor{preprocessor}{\#ifdef COMPAT\_FREEBSD32}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00160}00160 \textcolor{preprocessor}{\#include <sys/mount.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00161}00161 \textcolor{preprocessor}{\#include <sys/sysent.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00162}00162 \textcolor{preprocessor}{\#include <compat/freebsd32/freebsd32.h>}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00163}00163 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00164}00164 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00165}00165 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{uipc__socket_8c_a1a84488eb16148a193fba8ba73f0f8c2}{soreceive\_rcvoob}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00166}00166                     \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00167}00167 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{uipc__socket_8c_a73ec27450488af1257b58c83f3c09c26}{so\_rdknl\_lock}}(\textcolor{keywordtype}{void} *);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00168}00168 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{uipc__socket_8c_ab8ffe6ae588b7e5252b6073701e4ee48}{so\_rdknl\_unlock}}(\textcolor{keywordtype}{void} *);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00169}00169 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{uipc__socket_8c_a44baa810e5996c29a9784e8f29d2b156}{so\_rdknl\_assert\_lock}}(\textcolor{keywordtype}{void} *, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00170}00170 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{uipc__socket_8c_a07eaf32fb3031b83c272475a7617ccf1}{so\_wrknl\_lock}}(\textcolor{keywordtype}{void} *);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00171}00171 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{uipc__socket_8c_a3ed2a2de261da401d25b9c2e78330b90}{so\_wrknl\_unlock}}(\textcolor{keywordtype}{void} *);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00172}00172 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{uipc__socket_8c_a1f6c3f66e4c47be4f6369e5b7fcbb57d}{so\_wrknl\_assert\_lock}}(\textcolor{keywordtype}{void} *, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00173}00173 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00174}00174 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{uipc__socket_8c_ab904746cda39b2a4cd2db4e263dc0595}{filt\_sordetach}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00175}00175 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{uipc__socket_8c_a24128d6a35a551e13cae73be5805600b}{filt\_soread}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn, \textcolor{keywordtype}{long} hint);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00176}00176 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{uipc__socket_8c_ab07a80d978fbb33500a81446ec9db479}{filt\_sowdetach}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00177}00177 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{uipc__socket_8c_acefec058a8a2fbc2c4192f3bcb50308a}{filt\_sowrite}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn, \textcolor{keywordtype}{long} hint);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00178}00178 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{uipc__socket_8c_a4718e9e26afe05c4e00c865a857083fc}{filt\_soempty}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn, \textcolor{keywordtype}{long} hint);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00179}00179 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \textcolor{keyword}{inline} \mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{hhook\_run\_socket}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{void} *hctx, int32\_t h\_id);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00180}\mbox{\hyperlink{sys__socket_8c_a19859e8ced8e323811f87176dd657df6}{00180}} fo\_kqfilter\_t   \mbox{\hyperlink{uipc__socket_8c_a19859e8ced8e323811f87176dd657df6}{soo\_kqfilter}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00181}00181 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00182}\mbox{\hyperlink{uipc__socket_8c_a539d0c7b1e25821a20b1f2da269f383e}{00182}} \textcolor{keyword}{static} \textcolor{keyword}{struct }filterops \mbox{\hyperlink{uipc__socket_8c_a539d0c7b1e25821a20b1f2da269f383e}{soread\_filtops}} = \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00183}00183         .f\_isfd = 1,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00184}00184         .f\_detach = \mbox{\hyperlink{uipc__socket_8c_ab904746cda39b2a4cd2db4e263dc0595}{filt\_sordetach}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00185}00185         .f\_event = \mbox{\hyperlink{uipc__socket_8c_a24128d6a35a551e13cae73be5805600b}{filt\_soread}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00186}00186 \};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00187}\mbox{\hyperlink{uipc__socket_8c_a09610123e61eaff5a53b986c07b71d35}{00187}} \textcolor{keyword}{static} \textcolor{keyword}{struct }filterops \mbox{\hyperlink{uipc__socket_8c_a09610123e61eaff5a53b986c07b71d35}{sowrite\_filtops}} = \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00188}00188         .f\_isfd = 1,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00189}00189         .f\_detach = \mbox{\hyperlink{uipc__socket_8c_ab07a80d978fbb33500a81446ec9db479}{filt\_sowdetach}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00190}00190         .f\_event = \mbox{\hyperlink{uipc__socket_8c_acefec058a8a2fbc2c4192f3bcb50308a}{filt\_sowrite}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00191}00191 \};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00192}\mbox{\hyperlink{uipc__socket_8c_ab0c972a5e8d8bf81a8817c494f28d83b}{00192}} \textcolor{keyword}{static} \textcolor{keyword}{struct }filterops \mbox{\hyperlink{uipc__socket_8c_ab0c972a5e8d8bf81a8817c494f28d83b}{soempty\_filtops}} = \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00193}00193         .f\_isfd = 1,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00194}00194         .f\_detach = \mbox{\hyperlink{uipc__socket_8c_ab07a80d978fbb33500a81446ec9db479}{filt\_sowdetach}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00195}00195         .f\_event = \mbox{\hyperlink{uipc__socket_8c_a4718e9e26afe05c4e00c865a857083fc}{filt\_soempty}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00196}00196 \};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00197}00197 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00198}\mbox{\hyperlink{uipc__socket_8c_afd7f16a65a079c7d1516246548a76a90}{00198}} so\_gen\_t        \mbox{\hyperlink{uipc__socket_8c_afd7f16a65a079c7d1516246548a76a90}{so\_gencnt}};     \textcolor{comment}{/* generation count for sockets */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00199}00199 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00200}\mbox{\hyperlink{uipc__socket_8c_a381d5792b68d280721420916d5a0cb55}{00200}} \mbox{\hyperlink{uipc__socket_8c_a381d5792b68d280721420916d5a0cb55}{MALLOC\_DEFINE}}(M\_SONAME, \textcolor{stringliteral}{"{}soname"{}}, \textcolor{stringliteral}{"{}socket name"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00201}\mbox{\hyperlink{uipc__socket_8c_a84450523489ac42abfbea861f4d3d910}{00201}} \mbox{\hyperlink{uipc__socket_8c_a381d5792b68d280721420916d5a0cb55}{MALLOC\_DEFINE}}(M\_PCB, \textcolor{stringliteral}{"{}pcb"{}}, \textcolor{stringliteral}{"{}protocol control block"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00202}00202 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00203}\mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{00203}} \textcolor{preprocessor}{\#define VNET\_SO\_ASSERT(so)                                              \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00204}00204 \textcolor{preprocessor}{        VNET\_ASSERT(curvnet != NULL,                                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00205}00205 \textcolor{preprocessor}{            ("{}\%s:\%d curvnet is NULL, so=\%p"{}}, \_\_func\_\_, \_\_LINE\_\_, (so)));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00206}00206 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00207}\mbox{\hyperlink{uipc__socket_8c_a7338c4b9f227f1b5ce91adafcc2fc360}{00207}} \mbox{\hyperlink{uipc__socket_8c_a7338c4b9f227f1b5ce91adafcc2fc360}{VNET\_DEFINE}}(\textcolor{keyword}{struct} hhook\_head *, socket\_hhh[HHOOK\_SOCKET\_LAST + 1]);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00208}\mbox{\hyperlink{uipc__socket_8c_aedc0c0c5e6c3ac244635a279b54a0c21}{00208}} \textcolor{preprocessor}{\#define V\_socket\_hhh            VNET(socket\_hhh)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00209}00209 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00210}00210 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00211}00211 \textcolor{comment}{ * Limit on the number of connections in the listen queue waiting}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00212}00212 \textcolor{comment}{ * for accept(2).}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00213}00213 \textcolor{comment}{ * NB: The original sysctl somaxconn is still available but hidden}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00214}00214 \textcolor{comment}{ * to prevent confusion about the actual purpose of this number.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00215}00215 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00216}\mbox{\hyperlink{uipc__socket_8c_adb33baa4b4952b0cd4bc715b8cf95d98}{00216}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{uipc__socket_8c_adb33baa4b4952b0cd4bc715b8cf95d98}{somaxconn}} = SOMAXCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00217}00217 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00218}00218 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00219}\mbox{\hyperlink{uipc__socket_8c_a3b0a4419109c89f103e6b7dbd86dde0c}{00219}} \mbox{\hyperlink{uipc__socket_8c_a3b0a4419109c89f103e6b7dbd86dde0c}{sysctl\_somaxconn}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00220}00220 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00221}00221         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00222}00222         \textcolor{keywordtype}{int} val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00223}00223 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00224}00224         val = \mbox{\hyperlink{uipc__socket_8c_adb33baa4b4952b0cd4bc715b8cf95d98}{somaxconn}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00225}00225         error = \mbox{\hyperlink{kern__sysctl_8c_aab82ede27ea5d6975c4e91eb6c6111b7}{sysctl\_handle\_int}}(oidp, \&val, 0, req);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00226}00226         \textcolor{keywordflow}{if} (error || !req-\/>newptr )}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00227}00227                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00228}00228 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00229}00229         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00230}00230 \textcolor{comment}{         * The purpose of the UINT\_MAX / 3 limit, is so that the formula}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00231}00231 \textcolor{comment}{         *   3 * so\_qlimit / 2}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00232}00232 \textcolor{comment}{         * below, will not overflow.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00233}00233 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00234}00234 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00235}00235         \textcolor{keywordflow}{if} (val < 1 || val > UINT\_MAX / 3)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00236}00236                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00237}00237 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00238}00238         \mbox{\hyperlink{uipc__socket_8c_adb33baa4b4952b0cd4bc715b8cf95d98}{somaxconn}} = val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00239}00239         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00240}00240 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00241}\mbox{\hyperlink{uipc__socket_8c_ada82a008e41aeb7bacc582c2a6aec2fc}{00241}} \mbox{\hyperlink{uipc__socket_8c_ada82a008e41aeb7bacc582c2a6aec2fc}{SYSCTL\_PROC}}(\_kern\_ipc, OID\_AUTO, soacceptqueue,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00242}00242     CTLTYPE\_UINT | CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0, \textcolor{keyword}{sizeof}(\textcolor{keywordtype}{int}),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00243}00243     \mbox{\hyperlink{uipc__socket_8c_a3b0a4419109c89f103e6b7dbd86dde0c}{sysctl\_somaxconn}}, \textcolor{stringliteral}{"{}I"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00244}00244     \textcolor{stringliteral}{"{}Maximum listen socket pending connection accept queue size"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00245}\mbox{\hyperlink{uipc__socket_8c_afe09149b926171d4538400c45af4424a}{00245}} \mbox{\hyperlink{uipc__socket_8c_ada82a008e41aeb7bacc582c2a6aec2fc}{SYSCTL\_PROC}}(\_kern\_ipc, KIPC\_SOMAXCONN, \mbox{\hyperlink{uipc__socket_8c_adb33baa4b4952b0cd4bc715b8cf95d98}{somaxconn}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00246}00246     CTLTYPE\_UINT | CTLFLAG\_RW | CTLFLAG\_SKIP | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00247}00247     \textcolor{keyword}{sizeof}(\textcolor{keywordtype}{int}), \mbox{\hyperlink{uipc__socket_8c_a3b0a4419109c89f103e6b7dbd86dde0c}{sysctl\_somaxconn}}, \textcolor{stringliteral}{"{}I"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00248}00248     \textcolor{stringliteral}{"{}Maximum listen socket pending connection accept queue size (compat)"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00249}00249 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00250}\mbox{\hyperlink{uipc__socket_8c_a20987135ac30863baa1d63a271ecf650}{00250}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{uipc__socket_8c_a20987135ac30863baa1d63a271ecf650}{numopensockets}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00251}\mbox{\hyperlink{uipc__socket_8c_a9980cd9e3409f197317d9e7135608be8}{00251}} \mbox{\hyperlink{uipc__socket_8c_a9980cd9e3409f197317d9e7135608be8}{SYSCTL\_INT}}(\_kern\_ipc, OID\_AUTO, \mbox{\hyperlink{uipc__socket_8c_a20987135ac30863baa1d63a271ecf650}{numopensockets}}, CTLFLAG\_RD,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00252}00252     \&\mbox{\hyperlink{uipc__socket_8c_a20987135ac30863baa1d63a271ecf650}{numopensockets}}, 0, \textcolor{stringliteral}{"{}Number of open sockets"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00253}00253 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00254}00254 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00255}00255 \textcolor{comment}{ * accept\_mtx locks down per-\/socket fields relating to accept queues.  See}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00256}00256 \textcolor{comment}{ * socketvar.h for an annotation of the protected fields of struct socket.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00257}00257 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00258}\mbox{\hyperlink{uipc__socket_8c_afe6342ea5e11c236ee7b4df959bd5eb3}{00258}} \textcolor{keyword}{struct }\mbox{\hyperlink{uipc__ktls_8c_a7b5de10a04be6deb16c42cef5da02110}{mtx}} \mbox{\hyperlink{uipc__socket_8c_afe6342ea5e11c236ee7b4df959bd5eb3}{accept\_mtx}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00259}\mbox{\hyperlink{uipc__socket_8c_a8e573df3401203f02460965cf9f639da}{00259}} \mbox{\hyperlink{uipc__socket_8c_a8e573df3401203f02460965cf9f639da}{MTX\_SYSINIT}}(\mbox{\hyperlink{uipc__socket_8c_afe6342ea5e11c236ee7b4df959bd5eb3}{accept\_mtx}}, \&\mbox{\hyperlink{uipc__socket_8c_afe6342ea5e11c236ee7b4df959bd5eb3}{accept\_mtx}}, \textcolor{stringliteral}{"{}accept"{}}, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00260}00260 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00261}00261 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00262}00262 \textcolor{comment}{ * so\_global\_mtx protects so\_gencnt, numopensockets, and the per-\/socket}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00263}00263 \textcolor{comment}{ * so\_gencnt field.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00264}00264 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00265}\mbox{\hyperlink{uipc__socket_8c_a49d560e52803d1ee5076ef9e7a0bdd78}{00265}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{uipc__ktls_8c_a7b5de10a04be6deb16c42cef5da02110}{mtx}} \mbox{\hyperlink{uipc__socket_8c_a49d560e52803d1ee5076ef9e7a0bdd78}{so\_global\_mtx}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00266}\mbox{\hyperlink{uipc__socket_8c_aa07eb614b3793a0c92d52080ad5014d7}{00266}} \mbox{\hyperlink{uipc__socket_8c_a8e573df3401203f02460965cf9f639da}{MTX\_SYSINIT}}(\mbox{\hyperlink{uipc__socket_8c_a49d560e52803d1ee5076ef9e7a0bdd78}{so\_global\_mtx}}, \&\mbox{\hyperlink{uipc__socket_8c_a49d560e52803d1ee5076ef9e7a0bdd78}{so\_global\_mtx}}, \textcolor{stringliteral}{"{}so\_glabel"{}}, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00267}00267 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00268}00268 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00269}00269 \textcolor{comment}{ * General IPC sysctl name space, used by sockets and a variety of other IPC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00270}00270 \textcolor{comment}{ * types.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00271}00271 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00272}\mbox{\hyperlink{uipc__socket_8c_a7a59904f9adf4eda164eb93cce6f1011}{00272}} \mbox{\hyperlink{uipc__socket_8c_a7a59904f9adf4eda164eb93cce6f1011}{SYSCTL\_NODE}}(\_kern, KERN\_IPC, ipc, CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00273}00273     \textcolor{stringliteral}{"{}IPC"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00274}00274 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00275}00275 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00276}00276 \textcolor{comment}{ * Initialize the socket subsystem and set up the socket}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00277}00277 \textcolor{comment}{ * memory allocator.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00278}00278 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00279}\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{00279}} \textcolor{keyword}{static} uma\_zone\_t \mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00280}\mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{00280}} \textcolor{keywordtype}{int}     \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00281}00281 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00282}00282 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00283}\mbox{\hyperlink{uipc__socket_8c_ae25c6c8d80dd8e617735a8503294215c}{00283}} \mbox{\hyperlink{uipc__socket_8c_ae25c6c8d80dd8e617735a8503294215c}{socket\_zone\_change}}(\textcolor{keywordtype}{void} *tag)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00284}00284 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00285}00285 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00286}00286         \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}} = uma\_zone\_set\_max(\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}}, \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00287}00287 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00288}00288 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00289}00289 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00290}\mbox{\hyperlink{uipc__socket_8c_ad1d0d200b99a2527e60837eef1bd378b}{00290}} \mbox{\hyperlink{uipc__socket_8c_ad1d0d200b99a2527e60837eef1bd378b}{socket\_hhook\_register}}(\textcolor{keywordtype}{int} subtype)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00291}00291 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00292}00292 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00293}00293         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__hhook_8c_aab96c0944b64038f080efe35f3102d0c}{hhook\_head\_register}}(HHOOK\_TYPE\_SOCKET, subtype,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00294}00294             \&\mbox{\hyperlink{uipc__socket_8c_aedc0c0c5e6c3ac244635a279b54a0c21}{V\_socket\_hhh}}[subtype],}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00295}00295             HHOOK\_NOWAIT|HHOOK\_HEADISINVNET) != 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00296}00296                 \mbox{\hyperlink{subr__prf_8c_a55f3d956bb2ba20b5059e9e25484a47f}{printf}}(\textcolor{stringliteral}{"{}\%s: WARNING: unable to register hook\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00297}00297 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00298}00298 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00299}00299 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00300}\mbox{\hyperlink{uipc__socket_8c_ad1df6737b8e955dbaa8498bb65006d4a}{00300}} \mbox{\hyperlink{uipc__socket_8c_ad1df6737b8e955dbaa8498bb65006d4a}{socket\_hhook\_deregister}}(\textcolor{keywordtype}{int} subtype)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00301}00301 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00302}00302 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00303}00303         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__hhook_8c_a5f36b6e3f041fa8cb6552c6005647096}{hhook\_head\_deregister}}(\mbox{\hyperlink{uipc__socket_8c_aedc0c0c5e6c3ac244635a279b54a0c21}{V\_socket\_hhh}}[subtype]) != 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00304}00304                 \mbox{\hyperlink{subr__prf_8c_a55f3d956bb2ba20b5059e9e25484a47f}{printf}}(\textcolor{stringliteral}{"{}\%s: WARNING: unable to deregister hook\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00305}00305 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00306}00306 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00307}00307 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00308}\mbox{\hyperlink{uipc__socket_8c_ab7d4b3b3048fe817847e4868b5efa867}{00308}} \mbox{\hyperlink{uipc__socket_8c_ab7d4b3b3048fe817847e4868b5efa867}{socket\_init}}(\textcolor{keywordtype}{void} *tag)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00309}00309 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00310}00310 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00311}00311         \mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}} = uma\_zcreate(\textcolor{stringliteral}{"{}socket"{}}, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} socket), NULL, NULL,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00312}00312             NULL, NULL, UMA\_ALIGN\_PTR, 0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00313}00313         \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}} = uma\_zone\_set\_max(\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}}, \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00314}00314         uma\_zone\_set\_warning(\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}}, \textcolor{stringliteral}{"{}kern.ipc.maxsockets limit reached"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00315}00315         EVENTHANDLER\_REGISTER(maxsockets\_change, \mbox{\hyperlink{uipc__socket_8c_ae25c6c8d80dd8e617735a8503294215c}{socket\_zone\_change}}, NULL,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00316}00316             EVENTHANDLER\_PRI\_FIRST);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00317}00317 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00318}\mbox{\hyperlink{uipc__socket_8c_ac5fd674b5c2706d2131d1eaa30ea1e7c}{00318}} \mbox{\hyperlink{uipc__socket_8c_ac5fd674b5c2706d2131d1eaa30ea1e7c}{SYSINIT}}(socket, SI\_SUB\_PROTO\_DOMAININIT, SI\_ORDER\_ANY, \mbox{\hyperlink{uipc__socket_8c_ab7d4b3b3048fe817847e4868b5efa867}{socket\_init}}, NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00319}00319 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00320}00320 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00321}\mbox{\hyperlink{uipc__socket_8c_ae789c94e5fd1cf7041079fee56ff05a7}{00321}} \mbox{\hyperlink{uipc__socket_8c_ae789c94e5fd1cf7041079fee56ff05a7}{socket\_vnet\_init}}(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *unused \_\_unused)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00322}00322 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00323}00323         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00324}00324 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00325}00325         \textcolor{comment}{/* We expect a contiguous range */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00326}00326         \textcolor{keywordflow}{for} (i = 0; i <= HHOOK\_SOCKET\_LAST; i++)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00327}00327                 \mbox{\hyperlink{uipc__socket_8c_ad1d0d200b99a2527e60837eef1bd378b}{socket\_hhook\_register}}(i);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00328}00328 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00329}\mbox{\hyperlink{uipc__socket_8c_a22ad7d4a0060510d9296354fe1c95093}{00329}} \mbox{\hyperlink{uipc__socket_8c_a22ad7d4a0060510d9296354fe1c95093}{VNET\_SYSINIT}}(\mbox{\hyperlink{uipc__socket_8c_ae789c94e5fd1cf7041079fee56ff05a7}{socket\_vnet\_init}}, SI\_SUB\_PROTO\_DOMAININIT, SI\_ORDER\_ANY,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00330}00330     \mbox{\hyperlink{uipc__socket_8c_ae789c94e5fd1cf7041079fee56ff05a7}{socket\_vnet\_init}}, NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00331}00331 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00332}00332 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00333}\mbox{\hyperlink{uipc__socket_8c_abfc5b8ee967643305eee10138d79a932}{00333}} \mbox{\hyperlink{uipc__socket_8c_abfc5b8ee967643305eee10138d79a932}{socket\_vnet\_uninit}}(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *unused \_\_unused)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00334}00334 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00335}00335         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00336}00336 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00337}00337         \textcolor{keywordflow}{for} (i = 0; i <= HHOOK\_SOCKET\_LAST; i++)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00338}00338                 \mbox{\hyperlink{uipc__socket_8c_ad1df6737b8e955dbaa8498bb65006d4a}{socket\_hhook\_deregister}}(i);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00339}00339 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00340}\mbox{\hyperlink{uipc__socket_8c_aff51a60bcd41ca735a4bd7de2e76453e}{00340}} \mbox{\hyperlink{uipc__socket_8c_aff51a60bcd41ca735a4bd7de2e76453e}{VNET\_SYSUNINIT}}(\mbox{\hyperlink{uipc__socket_8c_abfc5b8ee967643305eee10138d79a932}{socket\_vnet\_uninit}}, SI\_SUB\_PROTO\_DOMAININIT, SI\_ORDER\_ANY,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00341}00341     \mbox{\hyperlink{uipc__socket_8c_abfc5b8ee967643305eee10138d79a932}{socket\_vnet\_uninit}}, NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00342}00342 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00343}00343 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00344}00344 \textcolor{comment}{ * Initialise maxsockets.  This SYSINIT must be run after}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00345}00345 \textcolor{comment}{ * tunable\_mbinit().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00346}00346 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00347}00347 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00348}\mbox{\hyperlink{uipc__socket_8c_ae502e72335a2a4995c8c8e0a9d938bdc}{00348}} \mbox{\hyperlink{uipc__socket_8c_ae502e72335a2a4995c8c8e0a9d938bdc}{init\_maxsockets}}(\textcolor{keywordtype}{void} *ignored)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00349}00349 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00350}00350 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00351}00351         TUNABLE\_INT\_FETCH(\textcolor{stringliteral}{"{}kern.ipc.maxsockets"{}}, \&\mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00352}00352         \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}} = imax(\mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}}, \mbox{\hyperlink{subr__param_8c_a65ddc368394546d4fbe4213b5e994e0f}{maxfiles}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00353}00353 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00354}\mbox{\hyperlink{uipc__socket_8c_ab56f1092e7912fa7af7ac46881853baf}{00354}} \mbox{\hyperlink{uipc__socket_8c_ac5fd674b5c2706d2131d1eaa30ea1e7c}{SYSINIT}}(param, SI\_SUB\_TUNABLES, SI\_ORDER\_ANY, \mbox{\hyperlink{uipc__socket_8c_ae502e72335a2a4995c8c8e0a9d938bdc}{init\_maxsockets}}, NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00355}00355 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00356}00356 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00357}00357 \textcolor{comment}{ * Sysctl to get and set the maximum global sockets limit.  Notify protocols}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00358}00358 \textcolor{comment}{ * of the change so that they can update their dependent limits as required.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00359}00359 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00360}00360 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00361}\mbox{\hyperlink{uipc__socket_8c_a5344fa2727cfe2f91e267d25614b56f2}{00361}} \mbox{\hyperlink{uipc__socket_8c_a5344fa2727cfe2f91e267d25614b56f2}{sysctl\_maxsockets}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00362}00362 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00363}00363         \textcolor{keywordtype}{int} error, newmaxsockets;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00364}00364 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00365}00365         newmaxsockets = \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00366}00366         error = \mbox{\hyperlink{kern__sysctl_8c_aab82ede27ea5d6975c4e91eb6c6111b7}{sysctl\_handle\_int}}(oidp, \&newmaxsockets, 0, req);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00367}00367         \textcolor{keywordflow}{if} (error == 0 \&\& req-\/>newptr \&\& newmaxsockets != \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}}) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00368}00368                 \textcolor{keywordflow}{if} (newmaxsockets > \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}} \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00369}00369                     newmaxsockets <= \mbox{\hyperlink{subr__param_8c_a65ddc368394546d4fbe4213b5e994e0f}{maxfiles}}) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00370}00370                         \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}} = newmaxsockets;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00371}00371                         EVENTHANDLER\_INVOKE(maxsockets\_change);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00372}00372                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00373}00373                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00374}00374         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00375}00375         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00376}00376 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00377}\mbox{\hyperlink{uipc__socket_8c_aa268cf7fba310a5871b1396f8f592a39}{00377}} \mbox{\hyperlink{uipc__socket_8c_ada82a008e41aeb7bacc582c2a6aec2fc}{SYSCTL\_PROC}}(\_kern\_ipc, OID\_AUTO, \mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00378}00378     CTLTYPE\_INT | CTLFLAG\_RW | CTLFLAG\_MPSAFE, \&\mbox{\hyperlink{uipc__socket_8c_a505fdff46cd39106916118805aab1d72}{maxsockets}}, 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00379}00379     \mbox{\hyperlink{uipc__socket_8c_a5344fa2727cfe2f91e267d25614b56f2}{sysctl\_maxsockets}}, \textcolor{stringliteral}{"{}IU"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00380}00380     \textcolor{stringliteral}{"{}Maximum number of sockets available"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00381}00381 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00382}00382 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00383}00383 \textcolor{comment}{ * Socket operation routines.  These routines are called by the routines in}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00384}00384 \textcolor{comment}{ * sys\_socket.c or from a system process, and implement the semantics of}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00385}00385 \textcolor{comment}{ * socket operations by switching out to the protocol specific routines.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00386}00386 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00387}00387 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00388}00388 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00389}00389 \textcolor{comment}{ * Get a socket structure from our zone, and initialize it.  Note that it}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00390}00390 \textcolor{comment}{ * would probably be better to allocate socket and PCB at the same time, but}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00391}00391 \textcolor{comment}{ * I'm not convinced that all the protocols can be easily modified to do}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00392}00392 \textcolor{comment}{ * this.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00393}00393 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00394}00394 \textcolor{comment}{ * soalloc() returns a socket with a ref count of 0.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00395}00395 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00396}00396 \textcolor{keyword}{static} \textcolor{keyword}{struct }socket *}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00397}\mbox{\hyperlink{uipc__socket_8c_a100caaf40241979bf497f2296c759d99}{00397}} \mbox{\hyperlink{uipc__socket_8c_a100caaf40241979bf497f2296c759d99}{soalloc}}(\textcolor{keyword}{struct} vnet *vnet)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00398}00398 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00399}00399         \textcolor{keyword}{struct }socket *so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00400}00400 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00401}00401         so = uma\_zalloc(\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}}, M\_NOWAIT | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00402}00402         \textcolor{keywordflow}{if} (so == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00403}00403                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00404}00404 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00405}00405         \textcolor{keywordflow}{if} (mac\_socket\_init(so, M\_NOWAIT) != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00406}00406                 uma\_zfree(\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}}, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00407}00407                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00408}00408         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00409}00409 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00410}00410         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__khelp_8c_a176cd3e482495dbe362a96b23eefb3aa}{khelp\_init\_osd}}(HELPER\_CLASS\_SOCKET, \&so-\/>osd)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00411}00411                 uma\_zfree(\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}}, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00412}00412                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00413}00413         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00414}00414 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00415}00415         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00416}00416 \textcolor{comment}{         * The socket locking protocol allows to lock 2 sockets at a time,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00417}00417 \textcolor{comment}{         * however, the first one must be a listening socket.  WITNESS lacks}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00418}00418 \textcolor{comment}{         * a feature to change class of an existing lock, so we use DUPOK.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00419}00419 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00420}00420         mtx\_init(\&so-\/>so\_lock, \textcolor{stringliteral}{"{}socket"{}}, NULL, MTX\_DEF | MTX\_DUPOK);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00421}00421         so-\/>so\_snd.sb\_mtx = \&so-\/>so\_snd\_mtx;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00422}00422         so-\/>so\_rcv.sb\_mtx = \&so-\/>so\_rcv\_mtx;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00423}00423         SOCKBUF\_LOCK\_INIT(\&so-\/>so\_snd, \textcolor{stringliteral}{"{}so\_snd"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00424}00424         SOCKBUF\_LOCK\_INIT(\&so-\/>so\_rcv, \textcolor{stringliteral}{"{}so\_rcv"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00425}00425         so-\/>so\_rcv.sb\_sel = \&so-\/>so\_rdsel;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00426}00426         so-\/>so\_snd.sb\_sel = \&so-\/>so\_wrsel;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00427}00427         sx\_init(\&so-\/>so\_snd\_sx, \textcolor{stringliteral}{"{}so\_snd\_sx"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00428}00428         sx\_init(\&so-\/>so\_rcv\_sx, \textcolor{stringliteral}{"{}so\_rcv\_sx"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00429}00429         TAILQ\_INIT(\&so-\/>so\_snd.sb\_aiojobq);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00430}00430         TAILQ\_INIT(\&so-\/>so\_rcv.sb\_aiojobq);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00431}00431         TASK\_INIT(\&so-\/>so\_snd.sb\_aiotask, 0, \mbox{\hyperlink{sys__socket_8c_af5dd5b4ec07fa37f9b85c32ec0eab04a}{soaio\_snd}}, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00432}00432         TASK\_INIT(\&so-\/>so\_rcv.sb\_aiotask, 0, \mbox{\hyperlink{sys__socket_8c_af7c16bb35f6211ed17a92b25145ed410}{soaio\_rcv}}, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00433}00433 \textcolor{preprocessor}{\#ifdef VIMAGE}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00434}00434         VNET\_ASSERT(vnet != NULL, (\textcolor{stringliteral}{"{}\%s:\%d vnet is NULL, so=\%p"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00435}00435             \_\_func\_\_, \_\_LINE\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00436}00436         so-\/>so\_vnet = vnet;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00437}00437 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00438}00438         \textcolor{comment}{/* We shouldn't need the so\_global\_mtx */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00439}00439         \textcolor{keywordflow}{if} (\mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{hhook\_run\_socket}}(so, NULL, HHOOK\_SOCKET\_CREATE)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00440}00440                 \textcolor{comment}{/* Do we need more comprehensive error returns? */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00441}00441                 uma\_zfree(\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}}, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00442}00442                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00443}00443         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00444}00444         mtx\_lock(\&\mbox{\hyperlink{uipc__socket_8c_a49d560e52803d1ee5076ef9e7a0bdd78}{so\_global\_mtx}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00445}00445         so-\/>so\_gencnt = ++\mbox{\hyperlink{uipc__socket_8c_afd7f16a65a079c7d1516246548a76a90}{so\_gencnt}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00446}00446         ++\mbox{\hyperlink{uipc__socket_8c_a20987135ac30863baa1d63a271ecf650}{numopensockets}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00447}00447 \textcolor{preprocessor}{\#ifdef VIMAGE}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00448}00448         vnet-\/>vnet\_sockcnt++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00449}00449 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00450}00450         mtx\_unlock(\&\mbox{\hyperlink{uipc__socket_8c_a49d560e52803d1ee5076ef9e7a0bdd78}{so\_global\_mtx}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00451}00451 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00452}00452         \textcolor{keywordflow}{return} (so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00453}00453 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00454}00454 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00455}00455 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00456}00456 \textcolor{comment}{ * Free the storage associated with a socket at the socket layer, tear down}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00457}00457 \textcolor{comment}{ * locks, labels, etc.  All protocol state is assumed already to have been}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00458}00458 \textcolor{comment}{ * torn down (and possibly never set up) by the caller.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00459}00459 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00460}00460 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00461}\mbox{\hyperlink{uipc__socket_8c_ae6a92a908156979e56262c262521a44f}{00461}} \mbox{\hyperlink{uipc__socket_8c_ae6a92a908156979e56262c262521a44f}{sodealloc}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00462}00462 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00463}00463 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00464}00464         KASSERT(so-\/>so\_count == 0, (\textcolor{stringliteral}{"{}sodealloc(): so\_count \%d"{}}, so-\/>so\_count));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00465}00465         KASSERT(so-\/>so\_pcb == NULL, (\textcolor{stringliteral}{"{}sodealloc(): so\_pcb != NULL"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00466}00466 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00467}00467         mtx\_lock(\&\mbox{\hyperlink{uipc__socket_8c_a49d560e52803d1ee5076ef9e7a0bdd78}{so\_global\_mtx}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00468}00468         so-\/>so\_gencnt = ++\mbox{\hyperlink{uipc__socket_8c_afd7f16a65a079c7d1516246548a76a90}{so\_gencnt}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00469}00469         -\/-\/\mbox{\hyperlink{uipc__socket_8c_a20987135ac30863baa1d63a271ecf650}{numopensockets}}; \textcolor{comment}{/* Could be below, but faster here. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00470}00470 \textcolor{preprocessor}{\#ifdef VIMAGE}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00471}00471         VNET\_ASSERT(so-\/>so\_vnet != NULL, (\textcolor{stringliteral}{"{}\%s:\%d so\_vnet is NULL, so=\%p"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00472}00472             \_\_func\_\_, \_\_LINE\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00473}00473         so-\/>so\_vnet-\/>vnet\_sockcnt-\/-\/;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00474}00474 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00475}00475         mtx\_unlock(\&\mbox{\hyperlink{uipc__socket_8c_a49d560e52803d1ee5076ef9e7a0bdd78}{so\_global\_mtx}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00476}00476 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00477}00477         mac\_socket\_destroy(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00478}00478 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00479}00479         \mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{hhook\_run\_socket}}(so, NULL, HHOOK\_SOCKET\_CLOSE);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00480}00480 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00481}00481         \mbox{\hyperlink{kern__khelp_8c_a42fa4d85de8b5bc36bf4dcf41cc087a9}{khelp\_destroy\_osd}}(\&so-\/>osd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00482}00482         \textcolor{keywordflow}{if} (SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00483}00483                 \textcolor{keywordflow}{if} (so-\/>sol\_accept\_filter != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00484}00484                         \mbox{\hyperlink{uipc__accf_8c_a49088a70a95422c0516c3e8835d728d9}{accept\_filt\_setopt}}(so, NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00485}00485         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00486}00486                 \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_hiwat)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00487}00487                         (void)\mbox{\hyperlink{kern__resource_8c_a3e6044e44d7589650e470532f71c51fa}{chgsbsize}}(so-\/>so\_cred-\/>cr\_uidinfo,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00488}00488                             \&so-\/>so\_rcv.sb\_hiwat, 0, RLIM\_INFINITY);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00489}00489                 \textcolor{keywordflow}{if} (so-\/>so\_snd.sb\_hiwat)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00490}00490                         (void)\mbox{\hyperlink{kern__resource_8c_a3e6044e44d7589650e470532f71c51fa}{chgsbsize}}(so-\/>so\_cred-\/>cr\_uidinfo,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00491}00491                             \&so-\/>so\_snd.sb\_hiwat, 0, RLIM\_INFINITY);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00492}00492                 \mbox{\hyperlink{kern__sx_8c_a7fdb7b1b5a911e5998ce226e9532adf1}{sx\_destroy}}(\&so-\/>so\_snd\_sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00493}00493                 \mbox{\hyperlink{kern__sx_8c_a7fdb7b1b5a911e5998ce226e9532adf1}{sx\_destroy}}(\&so-\/>so\_rcv\_sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00494}00494                 SOCKBUF\_LOCK\_DESTROY(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00495}00495                 SOCKBUF\_LOCK\_DESTROY(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00496}00496         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00497}00497         \mbox{\hyperlink{kern__prot_8c_ad922e69ed6a14e1a6d8b0b8cb9d859a0}{crfree}}(so-\/>so\_cred);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00498}00498         mtx\_destroy(\&so-\/>so\_lock);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00499}00499         uma\_zfree(\mbox{\hyperlink{uipc__socket_8c_a93ba4a1f5a62525e7bf182f629356de0}{socket\_zone}}, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00500}00500 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00501}00501 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00502}00502 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00503}00503 \textcolor{comment}{ * socreate returns a socket with a ref count of 1.  The socket should be}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00504}00504 \textcolor{comment}{ * closed with soclose().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00505}00505 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00506}00506 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00507}\mbox{\hyperlink{uipc__socket_8c_a5678e7f3e79c512f4b2e66a8b584351c}{00507}} \mbox{\hyperlink{uipc__socket_8c_a5678e7f3e79c512f4b2e66a8b584351c}{socreate}}(\textcolor{keywordtype}{int} dom, \textcolor{keyword}{struct} socket **aso, \textcolor{keywordtype}{int} \mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}}, \textcolor{keywordtype}{int} proto,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00508}00508     \textcolor{keyword}{struct} ucred *cred, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00509}00509 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00510}00510         \textcolor{keyword}{struct }protosw *prp;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00511}00511         \textcolor{keyword}{struct }socket *so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00512}00512         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00513}00513 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00514}00514         \textcolor{keywordflow}{if} (proto)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00515}00515                 prp = \mbox{\hyperlink{uipc__domain_8c_a17465d8f0c6c889424df5a2c13533818}{pffindproto}}(dom, proto, \mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00516}00516         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00517}00517                 prp = \mbox{\hyperlink{uipc__domain_8c_afcce05bdc94366c08b92cddb8597772b}{pffindtype}}(dom, \mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00518}00518 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00519}00519         \textcolor{keywordflow}{if} (prp == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00520}00520                 \textcolor{comment}{/* No support for domain. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00521}00521                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{uipc__domain_8c_adac060ff714ffc8df7b5ff8be495cb3c}{pffinddomain}}(dom) == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00522}00522                         \textcolor{keywordflow}{return} (EAFNOSUPPORT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00523}00523                 \textcolor{comment}{/* No support for socket type. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00524}00524                 \textcolor{keywordflow}{if} (proto == 0 \&\& \mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}} != 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00525}00525                         \textcolor{keywordflow}{return} (EPROTOTYPE);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00526}00526                 \textcolor{keywordflow}{return} (EPROTONOSUPPORT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00527}00527         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00528}00528         \textcolor{keywordflow}{if} (prp-\/>pr\_usrreqs-\/>pru\_attach == NULL ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00529}00529             prp-\/>pr\_usrreqs-\/>pru\_attach == \mbox{\hyperlink{uipc__socket_8c_a3930d8f8591630bc67d289ac38b4199a}{pru\_attach\_notsupp}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00530}00530                 \textcolor{keywordflow}{return} (EPROTONOSUPPORT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00531}00531 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00532}00532         \textcolor{keywordflow}{if} (IN\_CAPABILITY\_MODE(td) \&\& (prp-\/>pr\_flags \& PR\_CAPATTACH) == 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00533}00533                 \textcolor{keywordflow}{return} (ECAPMODE);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00534}00534 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00535}00535         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__jail_8c_a087903665896fc99985ac9f5d024abb7}{prison\_check\_af}}(cred, prp-\/>pr\_domain-\/>dom\_family) != 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00536}00536                 \textcolor{keywordflow}{return} (EPROTONOSUPPORT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00537}00537 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00538}00538         \textcolor{keywordflow}{if} (prp-\/>pr\_type != \mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00539}00539                 \textcolor{keywordflow}{return} (EPROTOTYPE);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00540}00540         so = \mbox{\hyperlink{uipc__socket_8c_a100caaf40241979bf497f2296c759d99}{soalloc}}(CRED\_TO\_VNET(cred));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00541}00541         \textcolor{keywordflow}{if} (so == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00542}00542                 \textcolor{keywordflow}{return} (ENOBUFS);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00543}00543 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00544}00544         so-\/>so\_type = \mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00545}00545         so-\/>so\_cred = \mbox{\hyperlink{kern__prot_8c_ad1a89ae551efaeacec3465742bc1270e}{crhold}}(cred);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00546}00546         \textcolor{keywordflow}{if} ((prp-\/>pr\_domain-\/>dom\_family == PF\_INET) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00547}00547             (prp-\/>pr\_domain-\/>dom\_family == PF\_INET6) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00548}00548             (prp-\/>pr\_domain-\/>dom\_family == PF\_ROUTE))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00549}00549                 so-\/>so\_fibnum = td-\/>td\_proc-\/>p\_fibnum;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00550}00550         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00551}00551                 so-\/>so\_fibnum = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00552}00552         so-\/>so\_proto = prp;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00553}00553 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00554}00554         mac\_socket\_create(cred, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00555}00555 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00556}00556         \mbox{\hyperlink{kern__event_8c_a53bfb228e43a8386ca1a63884f034224}{knlist\_init}}(\&so-\/>so\_rdsel.si\_note, so, \mbox{\hyperlink{uipc__socket_8c_a73ec27450488af1257b58c83f3c09c26}{so\_rdknl\_lock}}, \mbox{\hyperlink{uipc__socket_8c_ab8ffe6ae588b7e5252b6073701e4ee48}{so\_rdknl\_unlock}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00557}00557             \mbox{\hyperlink{uipc__socket_8c_a44baa810e5996c29a9784e8f29d2b156}{so\_rdknl\_assert\_lock}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00558}00558         \mbox{\hyperlink{kern__event_8c_a53bfb228e43a8386ca1a63884f034224}{knlist\_init}}(\&so-\/>so\_wrsel.si\_note, so, \mbox{\hyperlink{uipc__socket_8c_a07eaf32fb3031b83c272475a7617ccf1}{so\_wrknl\_lock}}, \mbox{\hyperlink{uipc__socket_8c_a3ed2a2de261da401d25b9c2e78330b90}{so\_wrknl\_unlock}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00559}00559             \mbox{\hyperlink{uipc__socket_8c_a1f6c3f66e4c47be4f6369e5b7fcbb57d}{so\_wrknl\_assert\_lock}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00560}00560         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00561}00561 \textcolor{comment}{         * Auto-\/sizing of socket buffers is managed by the protocols and}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00562}00562 \textcolor{comment}{         * the appropriate flags must be set in the pru\_attach function.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00563}00563 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00564}00564         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00565}00565         error = (*prp-\/>pr\_usrreqs-\/>pru\_attach)(so, proto, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00566}00566         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00567}00567         \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00568}00568                 \mbox{\hyperlink{uipc__socket_8c_ae6a92a908156979e56262c262521a44f}{sodealloc}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00569}00569                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00570}00570         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00571}00571         soref(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00572}00572         *aso = so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00573}00573         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00574}00574 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00575}00575 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00576}00576 \textcolor{preprocessor}{\#ifdef REGRESSION}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00577}00577 \textcolor{keyword}{static} \textcolor{keywordtype}{int} regression\_sonewconn\_earlytest = 1;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00578}00578 \mbox{\hyperlink{uipc__socket_8c_a9980cd9e3409f197317d9e7135608be8}{SYSCTL\_INT}}(\_regression, OID\_AUTO, sonewconn\_earlytest, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00579}00579     \&regression\_sonewconn\_earlytest, 0, \textcolor{stringliteral}{"{}Perform early sonewconn limit test"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00580}00580 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00581}00581 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00582}\mbox{\hyperlink{uipc__socket_8c_a138983ce5ab491278b940a39d0a72b1a}{00582}} \textcolor{keyword}{static} \textcolor{keyword}{struct }timeval \mbox{\hyperlink{uipc__socket_8c_a138983ce5ab491278b940a39d0a72b1a}{overinterval}} = \{ 60, 0 \};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00583}\mbox{\hyperlink{uipc__socket_8c_aafc3b69fa72715e82676e50388a2ba7e}{00583}} \mbox{\hyperlink{uipc__socket_8c_aafc3b69fa72715e82676e50388a2ba7e}{SYSCTL\_TIMEVAL\_SEC}}(\_kern\_ipc, OID\_AUTO, sooverinterval, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00584}00584     \&\mbox{\hyperlink{uipc__socket_8c_a138983ce5ab491278b940a39d0a72b1a}{overinterval}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00585}00585     \textcolor{stringliteral}{"{}Delay in seconds between warnings for listen socket overflows"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00586}00586 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00587}00587 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00588}00588 \textcolor{comment}{ * When an attempt at a new connection is noted on a socket which accepts}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00589}00589 \textcolor{comment}{ * connections, sonewconn is called.  If the connection is possible (subject}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00590}00590 \textcolor{comment}{ * to space constraints, etc.) then we allocate a new structure, properly}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00591}00591 \textcolor{comment}{ * linked into the data structure of the original socket, and return this.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00592}00592 \textcolor{comment}{ * Connstatus may be 0, or SS\_ISCONFIRMING, or SS\_ISCONNECTED.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00593}00593 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00594}00594 \textcolor{comment}{ * Note: the ref count on the socket is 0 on return.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00595}00595 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00596}00596 \textcolor{keyword}{struct }socket *}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00597}\mbox{\hyperlink{uipc__socket_8c_a31063b4bfb8dbfe3fda894a13fbec888}{00597}} \mbox{\hyperlink{uipc__socket_8c_a31063b4bfb8dbfe3fda894a13fbec888}{sonewconn}}(\textcolor{keyword}{struct} socket *head, \textcolor{keywordtype}{int} connstatus)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00598}00598 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00599}00599         \textcolor{keyword}{struct }sbuf descrsb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00600}00600         \textcolor{keyword}{struct }socket *so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00601}00601         \textcolor{keywordtype}{int} len, overcount;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00602}00602         u\_int qlen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00603}00603         \textcolor{keyword}{const} \textcolor{keywordtype}{char} localprefix[] = \textcolor{stringliteral}{"{}local:"{}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00604}00604         \textcolor{keywordtype}{char} descrbuf[SUNPATHLEN + \textcolor{keyword}{sizeof}(localprefix)];}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00605}00605 \textcolor{preprocessor}{\#if defined(INET6)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00606}00606         \textcolor{keywordtype}{char} addrbuf[INET6\_ADDRSTRLEN];}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00607}00607 \textcolor{preprocessor}{\#elif defined(INET)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00608}00608         \textcolor{keywordtype}{char} addrbuf[INET\_ADDRSTRLEN];}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00609}00609 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00610}00610         \textcolor{keywordtype}{bool} dolog, over;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00611}00611 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00612}00612         SOLISTEN\_LOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00613}00613         over = (head-\/>sol\_qlen > 3 * head-\/>sol\_qlimit / 2);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00614}00614 \textcolor{preprocessor}{\#ifdef REGRESSION}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00615}00615         \textcolor{keywordflow}{if} (regression\_sonewconn\_earlytest \&\& over) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00616}00616 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00617}00617         \textcolor{keywordflow}{if} (over) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00618}00618 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00619}00619                 head-\/>sol\_overcount++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00620}00620                 dolog = !!\mbox{\hyperlink{kern__time_8c_aec6981b5f37dc3548521a1f41f1b0685}{ratecheck}}(\&head-\/>sol\_lastover, \&\mbox{\hyperlink{uipc__socket_8c_a138983ce5ab491278b940a39d0a72b1a}{overinterval}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00621}00621 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00622}00622                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00623}00623 \textcolor{comment}{                 * If we're going to log, copy the overflow count and queue}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00624}00624 \textcolor{comment}{                 * length from the listen socket before dropping the lock.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00625}00625 \textcolor{comment}{                 * Also, reset the overflow count.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00626}00626 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00627}00627                 \textcolor{keywordflow}{if} (dolog) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00628}00628                         overcount = head-\/>sol\_overcount;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00629}00629                         head-\/>sol\_overcount = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00630}00630                         qlen = head-\/>sol\_qlen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00631}00631                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00632}00632                 SOLISTEN\_UNLOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00633}00633 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00634}00634                 \textcolor{keywordflow}{if} (dolog) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00635}00635                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00636}00636 \textcolor{comment}{                         * Try to print something descriptive about the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00637}00637 \textcolor{comment}{                         * socket for the error message.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00638}00638 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00639}00639                         \mbox{\hyperlink{subr__sbuf_8c_ad3cd536452958687b5d1e0005b232f8e}{sbuf\_new}}(\&descrsb, descrbuf, \textcolor{keyword}{sizeof}(descrbuf),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00640}00640                             SBUF\_FIXEDLEN);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00641}00641                         \textcolor{keywordflow}{switch} (head-\/>so\_proto-\/>pr\_domain-\/>dom\_family) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00642}00642 \textcolor{preprocessor}{\#if defined(INET) || defined(INET6)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00643}00643 \textcolor{preprocessor}{\#ifdef INET}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00644}00644                         \textcolor{keywordflow}{case} AF\_INET:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00645}00645 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00646}00646 \textcolor{preprocessor}{\#ifdef INET6}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00647}00647                         \textcolor{keywordflow}{case} AF\_INET6:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00648}00648                                 \textcolor{keywordflow}{if} (head-\/>so\_proto-\/>pr\_domain-\/>dom\_family ==}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00649}00649                                     AF\_INET6 ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00650}00650                                     (sotoinpcb(head)-\/>inp\_inc.inc\_flags \&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00651}00651                                     INC\_ISIPV6)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00652}00652                                         ip6\_sprintf(addrbuf,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00653}00653                                             \&sotoinpcb(head)-\/>inp\_inc.inc6\_laddr);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00654}00654                                         \mbox{\hyperlink{subr__sbuf_8c_a6c6abdb7c0c9a19d892b1d07757dd056}{sbuf\_printf}}(\&descrsb, \textcolor{stringliteral}{"{}[\%s]"{}}, addrbuf);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00655}00655                                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00656}00656 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00657}00657                                 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00658}00658 \textcolor{preprocessor}{\#ifdef INET}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00659}00659                                         inet\_ntoa\_r(}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00660}00660                                             sotoinpcb(head)-\/>inp\_inc.inc\_laddr,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00661}00661                                             addrbuf);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00662}00662                                         \mbox{\hyperlink{subr__sbuf_8c_ae8b790fe64e837306b2b289f95e80343}{sbuf\_cat}}(\&descrsb, addrbuf);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00663}00663 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00664}00664                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00665}00665                                 \mbox{\hyperlink{subr__sbuf_8c_a6c6abdb7c0c9a19d892b1d07757dd056}{sbuf\_printf}}(\&descrsb, \textcolor{stringliteral}{"{}:\%hu (proto \%u)"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00666}00666                                     ntohs(sotoinpcb(head)-\/>inp\_inc.inc\_lport),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00667}00667                                     head-\/>so\_proto-\/>pr\_protocol);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00668}00668                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00669}00669 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* INET || INET6 */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00670}00670                         \textcolor{keywordflow}{case} AF\_UNIX:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00671}00671                                 \mbox{\hyperlink{subr__sbuf_8c_ae8b790fe64e837306b2b289f95e80343}{sbuf\_cat}}(\&descrsb, localprefix);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00672}00672                                 \textcolor{keywordflow}{if} (sotounpcb(head)-\/>unp\_addr != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00673}00673                                         len =}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00674}00674                                             sotounpcb(head)-\/>unp\_addr-\/>sun\_len -\/}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00675}00675                                             offsetof(\textcolor{keyword}{struct} sockaddr\_un,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00676}00676                                             sun\_path);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00677}00677                                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00678}00678                                         len = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00679}00679                                 \textcolor{keywordflow}{if} (len > 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00680}00680                                         \mbox{\hyperlink{subr__sbuf_8c_a8017239ae2a33123885ded660375c0ef}{sbuf\_bcat}}(\&descrsb,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00681}00681                                             sotounpcb(head)-\/>unp\_addr-\/>sun\_path,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00682}00682                                             len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00683}00683                                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00684}00684                                         \mbox{\hyperlink{subr__sbuf_8c_ae8b790fe64e837306b2b289f95e80343}{sbuf\_cat}}(\&descrsb, \textcolor{stringliteral}{"{}(unknown)"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00685}00685                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00686}00686                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00687}00687 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00688}00688                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00689}00689 \textcolor{comment}{                         * If we can't print something more specific, at least}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00690}00690 \textcolor{comment}{                         * print the domain name.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00691}00691 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00692}00692                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__sbuf_8c_a29e35276bb1dcf4342f5a49ec3d0068a}{sbuf\_finish}}(\&descrsb) != 0 ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00693}00693                             \mbox{\hyperlink{subr__sbuf_8c_a82751ac67e7528210a233c811357d1fe}{sbuf\_len}}(\&descrsb) <= 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00694}00694                                 \mbox{\hyperlink{subr__sbuf_8c_aa567600c7164795b148e25c419cfbbf3}{sbuf\_clear}}(\&descrsb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00695}00695                                 \mbox{\hyperlink{subr__sbuf_8c_ae8b790fe64e837306b2b289f95e80343}{sbuf\_cat}}(\&descrsb,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00696}00696                                     head-\/>so\_proto-\/>pr\_domain-\/>dom\_name ?:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00697}00697                                     \textcolor{stringliteral}{"{}unknown"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00698}00698                                 \mbox{\hyperlink{subr__sbuf_8c_a29e35276bb1dcf4342f5a49ec3d0068a}{sbuf\_finish}}(\&descrsb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00699}00699                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00700}00700                         KASSERT(\mbox{\hyperlink{subr__sbuf_8c_a82751ac67e7528210a233c811357d1fe}{sbuf\_len}}(\&descrsb) > 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00701}00701                             (\textcolor{stringliteral}{"{}\%s: sbuf creation failed"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00702}00702                         \mbox{\hyperlink{subr__prf_8c_af8bf48b681a0471cae1be861c2102d5f}{log}}(LOG\_DEBUG,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00703}00703                             \textcolor{stringliteral}{"{}\%s: pcb \%p (\%s): Listen queue overflow: "{}}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00704}00704                             \textcolor{stringliteral}{"{}\%i already in queue awaiting acceptance "{}}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00705}00705                             \textcolor{stringliteral}{"{}(\%d occurrences)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00706}00706                             \_\_func\_\_, head-\/>so\_pcb, \mbox{\hyperlink{subr__sbuf_8c_a852f3538d102353413a73cea9f2efd1f}{sbuf\_data}}(\&descrsb),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00707}00707                             qlen, overcount);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00708}00708                         \mbox{\hyperlink{subr__sbuf_8c_a60934581249642aa5f426992ace71542}{sbuf\_delete}}(\&descrsb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00709}00709 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00710}00710                         overcount = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00711}00711                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00712}00712 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00713}00713                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00714}00714         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00715}00715         SOLISTEN\_UNLOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00716}00716         VNET\_ASSERT(head-\/>so\_vnet != NULL, (\textcolor{stringliteral}{"{}\%s: so \%p vnet is NULL"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00717}00717             \_\_func\_\_, head));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00718}00718         so = \mbox{\hyperlink{uipc__socket_8c_a100caaf40241979bf497f2296c759d99}{soalloc}}(head-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00719}00719         \textcolor{keywordflow}{if} (so == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00720}00720                 \mbox{\hyperlink{subr__prf_8c_af8bf48b681a0471cae1be861c2102d5f}{log}}(LOG\_DEBUG, \textcolor{stringliteral}{"{}\%s: pcb \%p: New socket allocation failure: "{}}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00721}00721                     \textcolor{stringliteral}{"{}limit reached or out of memory\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00722}00722                     \_\_func\_\_, head-\/>so\_pcb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00723}00723                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00724}00724         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00725}00725         so-\/>so\_listen = head;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00726}00726         so-\/>so\_type = head-\/>so\_type;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00727}00727         so-\/>so\_options = head-\/>so\_options \& \string~SO\_ACCEPTCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00728}00728         so-\/>so\_linger = head-\/>so\_linger;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00729}00729         so-\/>so\_state = head-\/>so\_state | SS\_NOFDREF;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00730}00730         so-\/>so\_fibnum = head-\/>so\_fibnum;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00731}00731         so-\/>so\_proto = head-\/>so\_proto;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00732}00732         so-\/>so\_cred = \mbox{\hyperlink{kern__prot_8c_ad1a89ae551efaeacec3465742bc1270e}{crhold}}(head-\/>so\_cred);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00733}00733 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00734}00734         mac\_socket\_newconn(head, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00735}00735 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00736}00736         \mbox{\hyperlink{kern__event_8c_a53bfb228e43a8386ca1a63884f034224}{knlist\_init}}(\&so-\/>so\_rdsel.si\_note, so, \mbox{\hyperlink{uipc__socket_8c_a73ec27450488af1257b58c83f3c09c26}{so\_rdknl\_lock}}, \mbox{\hyperlink{uipc__socket_8c_ab8ffe6ae588b7e5252b6073701e4ee48}{so\_rdknl\_unlock}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00737}00737             \mbox{\hyperlink{uipc__socket_8c_a44baa810e5996c29a9784e8f29d2b156}{so\_rdknl\_assert\_lock}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00738}00738         \mbox{\hyperlink{kern__event_8c_a53bfb228e43a8386ca1a63884f034224}{knlist\_init}}(\&so-\/>so\_wrsel.si\_note, so, \mbox{\hyperlink{uipc__socket_8c_a07eaf32fb3031b83c272475a7617ccf1}{so\_wrknl\_lock}}, \mbox{\hyperlink{uipc__socket_8c_a3ed2a2de261da401d25b9c2e78330b90}{so\_wrknl\_unlock}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00739}00739             \mbox{\hyperlink{uipc__socket_8c_a1f6c3f66e4c47be4f6369e5b7fcbb57d}{so\_wrknl\_assert\_lock}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00740}00740         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00741}00741         \textcolor{keywordflow}{if} (\mbox{\hyperlink{uipc__sockbuf_8c_a788927e21bf0b64e1461e1eec41ff3c2}{soreserve}}(so, head-\/>sol\_sbsnd\_hiwat, head-\/>sol\_sbrcv\_hiwat)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00742}00742                 \mbox{\hyperlink{uipc__socket_8c_ae6a92a908156979e56262c262521a44f}{sodealloc}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00743}00743                 \mbox{\hyperlink{subr__prf_8c_af8bf48b681a0471cae1be861c2102d5f}{log}}(LOG\_DEBUG, \textcolor{stringliteral}{"{}\%s: pcb \%p: soreserve() failed\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00744}00744                     \_\_func\_\_, head-\/>so\_pcb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00745}00745                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00746}00746         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00747}00747         \textcolor{keywordflow}{if} ((*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_attach)(so, 0, NULL)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00748}00748                 \mbox{\hyperlink{uipc__socket_8c_ae6a92a908156979e56262c262521a44f}{sodealloc}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00749}00749                 \mbox{\hyperlink{subr__prf_8c_af8bf48b681a0471cae1be861c2102d5f}{log}}(LOG\_DEBUG, \textcolor{stringliteral}{"{}\%s: pcb \%p: pru\_attach() failed\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00750}00750                     \_\_func\_\_, head-\/>so\_pcb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00751}00751                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00752}00752         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00753}00753         so-\/>so\_rcv.sb\_lowat = head-\/>sol\_sbrcv\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00754}00754         so-\/>so\_snd.sb\_lowat = head-\/>sol\_sbsnd\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00755}00755         so-\/>so\_rcv.sb\_timeo = head-\/>sol\_sbrcv\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00756}00756         so-\/>so\_snd.sb\_timeo = head-\/>sol\_sbsnd\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00757}00757         so-\/>so\_rcv.sb\_flags |= head-\/>sol\_sbrcv\_flags \& SB\_AUTOSIZE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00758}00758         so-\/>so\_snd.sb\_flags |= head-\/>sol\_sbsnd\_flags \& SB\_AUTOSIZE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00759}00759 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00760}00760         SOLISTEN\_LOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00761}00761         \textcolor{keywordflow}{if} (head-\/>sol\_accept\_filter != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00762}00762                 connstatus = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00763}00763         so-\/>so\_state |= connstatus;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00764}00764         soref(head); \textcolor{comment}{/* A socket on (in)complete queue refs head. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00765}00765         \textcolor{keywordflow}{if} (connstatus) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00766}00766                 TAILQ\_INSERT\_TAIL(\&head-\/>sol\_comp, so, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00767}00767                 so-\/>so\_qstate = SQ\_COMP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00768}00768                 head-\/>sol\_qlen++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00769}00769                 \mbox{\hyperlink{uipc__socket_8c_a53f0083b2aea01e2a04594b9dba99b30}{solisten\_wakeup}}(head);   \textcolor{comment}{/* unlocks */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00770}00770         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00771}00771                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00772}00772 \textcolor{comment}{                 * Keep removing sockets from the head until there's room for}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00773}00773 \textcolor{comment}{                 * us to insert on the tail.  In pre-\/locking revisions, this}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00774}00774 \textcolor{comment}{                 * was a simple if(), but as we could be racing with other}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00775}00775 \textcolor{comment}{                 * threads and soabort() requires dropping locks, we must}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00776}00776 \textcolor{comment}{                 * loop waiting for the condition to be true.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00777}00777 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00778}00778                 \textcolor{keywordflow}{while} (head-\/>sol\_incqlen > head-\/>sol\_qlimit) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00779}00779                         \textcolor{keyword}{struct }socket *sp;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00780}00780 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00781}00781                         sp = TAILQ\_FIRST(\&head-\/>sol\_incomp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00782}00782                         TAILQ\_REMOVE(\&head-\/>sol\_incomp, sp, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00783}00783                         head-\/>sol\_incqlen-\/-\/;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00784}00784                         SOCK\_LOCK(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00785}00785                         sp-\/>so\_qstate = SQ\_NONE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00786}00786                         sp-\/>so\_listen = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00787}00787                         SOCK\_UNLOCK(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00788}00788                         \mbox{\hyperlink{uipc__socket_8c_ac3328ee2d74de136b477641516e4543f}{sorele\_locked}}(head);       \textcolor{comment}{/* does SOLISTEN\_UNLOCK, head stays */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00789}00789                         \mbox{\hyperlink{uipc__socket_8c_a83de7f47fa8274cc25c2dff3f15ff621}{soabort}}(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00790}00790                         SOLISTEN\_LOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00791}00791                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00792}00792                 TAILQ\_INSERT\_TAIL(\&head-\/>sol\_incomp, so, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00793}00793                 so-\/>so\_qstate = SQ\_INCOMP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00794}00794                 head-\/>sol\_incqlen++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00795}00795                 SOLISTEN\_UNLOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00796}00796         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00797}00797         \textcolor{keywordflow}{return} (so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00798}00798 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00799}00799 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00800}00800 \textcolor{preprocessor}{\#if defined(SCTP) || defined(SCTP\_SUPPORT)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00801}00801 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00802}00802 \textcolor{comment}{ * Socket part of sctp\_peeloff().  Detach a new socket from an}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00803}00803 \textcolor{comment}{ * association.  The new socket is returned with a reference.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00804}00804 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00805}00805 \textcolor{keyword}{struct }socket *}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00806}00806 sopeeloff(\textcolor{keyword}{struct} socket *head)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00807}00807 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00808}00808         \textcolor{keyword}{struct }socket *so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00809}00809 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00810}00810         VNET\_ASSERT(head-\/>so\_vnet != NULL, (\textcolor{stringliteral}{"{}\%s:\%d so\_vnet is NULL, head=\%p"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00811}00811             \_\_func\_\_, \_\_LINE\_\_, head));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00812}00812         so = \mbox{\hyperlink{uipc__socket_8c_a100caaf40241979bf497f2296c759d99}{soalloc}}(head-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00813}00813         \textcolor{keywordflow}{if} (so == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00814}00814                 \mbox{\hyperlink{subr__prf_8c_af8bf48b681a0471cae1be861c2102d5f}{log}}(LOG\_DEBUG, \textcolor{stringliteral}{"{}\%s: pcb \%p: New socket allocation failure: "{}}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00815}00815                     \textcolor{stringliteral}{"{}limit reached or out of memory\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00816}00816                     \_\_func\_\_, head-\/>so\_pcb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00817}00817                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00818}00818         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00819}00819         so-\/>so\_type = head-\/>so\_type;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00820}00820         so-\/>so\_options = head-\/>so\_options;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00821}00821         so-\/>so\_linger = head-\/>so\_linger;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00822}00822         so-\/>so\_state = (head-\/>so\_state \& SS\_NBIO) | SS\_ISCONNECTED;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00823}00823         so-\/>so\_fibnum = head-\/>so\_fibnum;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00824}00824         so-\/>so\_proto = head-\/>so\_proto;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00825}00825         so-\/>so\_cred = \mbox{\hyperlink{kern__prot_8c_ad1a89ae551efaeacec3465742bc1270e}{crhold}}(head-\/>so\_cred);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00826}00826 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00827}00827         mac\_socket\_newconn(head, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00828}00828 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00829}00829         \mbox{\hyperlink{kern__event_8c_a53bfb228e43a8386ca1a63884f034224}{knlist\_init}}(\&so-\/>so\_rdsel.si\_note, so, \mbox{\hyperlink{uipc__socket_8c_a73ec27450488af1257b58c83f3c09c26}{so\_rdknl\_lock}}, \mbox{\hyperlink{uipc__socket_8c_ab8ffe6ae588b7e5252b6073701e4ee48}{so\_rdknl\_unlock}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00830}00830             \mbox{\hyperlink{uipc__socket_8c_a44baa810e5996c29a9784e8f29d2b156}{so\_rdknl\_assert\_lock}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00831}00831         \mbox{\hyperlink{kern__event_8c_a53bfb228e43a8386ca1a63884f034224}{knlist\_init}}(\&so-\/>so\_wrsel.si\_note, so, \mbox{\hyperlink{uipc__socket_8c_a07eaf32fb3031b83c272475a7617ccf1}{so\_wrknl\_lock}}, \mbox{\hyperlink{uipc__socket_8c_a3ed2a2de261da401d25b9c2e78330b90}{so\_wrknl\_unlock}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00832}00832             \mbox{\hyperlink{uipc__socket_8c_a1f6c3f66e4c47be4f6369e5b7fcbb57d}{so\_wrknl\_assert\_lock}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00833}00833         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00834}00834         \textcolor{keywordflow}{if} (\mbox{\hyperlink{uipc__sockbuf_8c_a788927e21bf0b64e1461e1eec41ff3c2}{soreserve}}(so, head-\/>so\_snd.sb\_hiwat, head-\/>so\_rcv.sb\_hiwat)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00835}00835                 \mbox{\hyperlink{uipc__socket_8c_ae6a92a908156979e56262c262521a44f}{sodealloc}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00836}00836                 \mbox{\hyperlink{subr__prf_8c_af8bf48b681a0471cae1be861c2102d5f}{log}}(LOG\_DEBUG, \textcolor{stringliteral}{"{}\%s: pcb \%p: soreserve() failed\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00837}00837                     \_\_func\_\_, head-\/>so\_pcb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00838}00838                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00839}00839         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00840}00840         \textcolor{keywordflow}{if} ((*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_attach)(so, 0, NULL)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00841}00841                 \mbox{\hyperlink{uipc__socket_8c_ae6a92a908156979e56262c262521a44f}{sodealloc}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00842}00842                 \mbox{\hyperlink{subr__prf_8c_af8bf48b681a0471cae1be861c2102d5f}{log}}(LOG\_DEBUG, \textcolor{stringliteral}{"{}\%s: pcb \%p: pru\_attach() failed\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00843}00843                     \_\_func\_\_, head-\/>so\_pcb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00844}00844                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00845}00845         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00846}00846         so-\/>so\_rcv.sb\_lowat = head-\/>so\_rcv.sb\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00847}00847         so-\/>so\_snd.sb\_lowat = head-\/>so\_snd.sb\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00848}00848         so-\/>so\_rcv.sb\_timeo = head-\/>so\_rcv.sb\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00849}00849         so-\/>so\_snd.sb\_timeo = head-\/>so\_snd.sb\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00850}00850         so-\/>so\_rcv.sb\_flags |= head-\/>so\_rcv.sb\_flags \& SB\_AUTOSIZE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00851}00851         so-\/>so\_snd.sb\_flags |= head-\/>so\_snd.sb\_flags \& SB\_AUTOSIZE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00852}00852 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00853}00853         soref(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00854}00854 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00855}00855         \textcolor{keywordflow}{return} (so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00856}00856 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00857}00857 \textcolor{preprocessor}{\#endif  }\textcolor{comment}{/* SCTP */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00858}00858 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00859}00859 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00860}\mbox{\hyperlink{uipc__socket_8c_a18017d26cac9e6d77fa892744e3932d8}{00860}} \mbox{\hyperlink{uipc__socket_8c_a18017d26cac9e6d77fa892744e3932d8}{sobind}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00861}00861 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00862}00862         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00863}00863 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00864}00864         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00865}00865         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_bind)(so, nam, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00866}00866         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00867}00867         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00868}00868 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00869}00869 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00870}00870 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00871}\mbox{\hyperlink{uipc__socket_8c_a7ace7456f0a746057d1e6ac9d5f92a6e}{00871}} \mbox{\hyperlink{uipc__socket_8c_a7ace7456f0a746057d1e6ac9d5f92a6e}{sobindat}}(\textcolor{keywordtype}{int} \mbox{\hyperlink{vfs__syscalls_8c_a6f8059414f0228f0256115e024eeed4b}{fd}}, \textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00872}00872 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00873}00873         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00874}00874 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00875}00875         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00876}00876         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_bindat)(\mbox{\hyperlink{vfs__syscalls_8c_a6f8059414f0228f0256115e024eeed4b}{fd}}, so, nam, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00877}00877         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00878}00878         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00879}00879 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00880}00880 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00881}00881 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00882}00882 \textcolor{comment}{ * solisten() transitions a socket from a non-\/listening state to a listening}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00883}00883 \textcolor{comment}{ * state, but can also be used to update the listen queue depth on an}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00884}00884 \textcolor{comment}{ * existing listen socket.  The protocol will call back into the sockets}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00885}00885 \textcolor{comment}{ * layer using solisten\_proto\_check() and solisten\_proto() to check and set}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00886}00886 \textcolor{comment}{ * socket-\/layer listen state.  Call backs are used so that the protocol can}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00887}00887 \textcolor{comment}{ * acquire both protocol and socket layer locks in whatever order is required}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00888}00888 \textcolor{comment}{ * by the protocol.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00889}00889 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00890}00890 \textcolor{comment}{ * Protocol implementors are advised to hold the socket lock across the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00891}00891 \textcolor{comment}{ * socket-\/layer test and set to avoid races at the socket layer.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00892}00892 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00893}00893 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00894}\mbox{\hyperlink{uipc__socket_8c_a0fa201c98b0fff6143c5de82e9c01e3e}{00894}} \mbox{\hyperlink{uipc__socket_8c_a0fa201c98b0fff6143c5de82e9c01e3e}{solisten}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} backlog, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00895}00895 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00896}00896         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00897}00897 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00898}00898         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00899}00899         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_listen)(so, backlog, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00900}00900         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00901}00901         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00902}00902 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00903}00903 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00904}00904 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00905}00905 \textcolor{comment}{ * Prepare for a call to solisten\_proto().  Acquire all socket buffer locks in}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00906}00906 \textcolor{comment}{ * order to interlock with socket I/O.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00907}00907 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00908}00908 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00909}\mbox{\hyperlink{uipc__socket_8c_a24d94b3ad1e4d1cecc690d6b5dec693f}{00909}} \mbox{\hyperlink{uipc__socket_8c_a24d94b3ad1e4d1cecc690d6b5dec693f}{solisten\_proto\_check}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00910}00910 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00911}00911         SOCK\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00912}00912 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00913}00913         \textcolor{keywordflow}{if} ((so-\/>so\_state \& (SS\_ISCONNECTED | SS\_ISCONNECTING |}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00914}00914             SS\_ISDISCONNECTING)) != 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00915}00915                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00916}00916 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00917}00917         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00918}00918 \textcolor{comment}{         * Sleeping is not permitted here, so simply fail if userspace is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00919}00919 \textcolor{comment}{         * attempting to transmit or receive on the socket.  This kind of}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00920}00920 \textcolor{comment}{         * transient failure is not ideal, but it should occur only if userspace}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00921}00921 \textcolor{comment}{         * is misusing the socket interfaces.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00922}00922 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00923}00923         \textcolor{keywordflow}{if} (!sx\_try\_xlock(\&so-\/>so\_snd\_sx))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00924}00924                 \textcolor{keywordflow}{return} (EAGAIN);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00925}00925         \textcolor{keywordflow}{if} (!sx\_try\_xlock(\&so-\/>so\_rcv\_sx)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00926}00926                 sx\_xunlock(\&so-\/>so\_snd\_sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00927}00927                 \textcolor{keywordflow}{return} (EAGAIN);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00928}00928         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00929}00929         mtx\_lock(\&so-\/>so\_snd\_mtx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00930}00930         mtx\_lock(\&so-\/>so\_rcv\_mtx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00931}00931 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00932}00932         \textcolor{comment}{/* Interlock with soo\_aio\_queue(). */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00933}00933         \textcolor{keywordflow}{if} ((so-\/>so\_snd.sb\_flags \& (SB\_AIO | SB\_AIO\_RUNNING)) != 0 ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00934}00934            (so-\/>so\_rcv.sb\_flags \& (SB\_AIO | SB\_AIO\_RUNNING)) != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00935}00935                 \mbox{\hyperlink{uipc__socket_8c_a482b0b6411ca1b4b1ff454379d2822d9}{solisten\_proto\_abort}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00936}00936                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00937}00937         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00938}00938         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00939}00939 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00940}00940 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00941}00941 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00942}00942 \textcolor{comment}{ * Undo the setup done by solisten\_proto\_check().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00943}00943 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00944}00944 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00945}\mbox{\hyperlink{uipc__socket_8c_a482b0b6411ca1b4b1ff454379d2822d9}{00945}} \mbox{\hyperlink{uipc__socket_8c_a482b0b6411ca1b4b1ff454379d2822d9}{solisten\_proto\_abort}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00946}00946 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00947}00947         mtx\_unlock(\&so-\/>so\_snd\_mtx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00948}00948         mtx\_unlock(\&so-\/>so\_rcv\_mtx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00949}00949         sx\_xunlock(\&so-\/>so\_snd\_sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00950}00950         sx\_xunlock(\&so-\/>so\_rcv\_sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00951}00951 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00952}00952 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00953}00953 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00954}\mbox{\hyperlink{uipc__socket_8c_add7d834b287a610bf101adf14cf3689b}{00954}} \mbox{\hyperlink{uipc__socket_8c_add7d834b287a610bf101adf14cf3689b}{solisten\_proto}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} backlog)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00955}00955 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00956}00956         \textcolor{keywordtype}{int} sbrcv\_lowat, sbsnd\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00957}00957         u\_int sbrcv\_hiwat, sbsnd\_hiwat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00958}00958         \textcolor{keywordtype}{short} sbrcv\_flags, sbsnd\_flags;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00959}00959         sbintime\_t sbrcv\_timeo, sbsnd\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00960}00960 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00961}00961         SOCK\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00962}00962         KASSERT((so-\/>so\_state \& (SS\_ISCONNECTED | SS\_ISCONNECTING |}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00963}00963             SS\_ISDISCONNECTING)) == 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00964}00964             (\textcolor{stringliteral}{"{}\%s: bad socket state \%p"{}}, \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00965}00965 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00966}00966         \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00967}00967                 \textcolor{keywordflow}{goto} listening;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00968}00968 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00969}00969         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00970}00970 \textcolor{comment}{         * Change this socket to listening state.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00971}00971 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00972}00972         sbrcv\_lowat = so-\/>so\_rcv.sb\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00973}00973         sbsnd\_lowat = so-\/>so\_snd.sb\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00974}00974         sbrcv\_hiwat = so-\/>so\_rcv.sb\_hiwat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00975}00975         sbsnd\_hiwat = so-\/>so\_snd.sb\_hiwat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00976}00976         sbrcv\_flags = so-\/>so\_rcv.sb\_flags;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00977}00977         sbsnd\_flags = so-\/>so\_snd.sb\_flags;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00978}00978         sbrcv\_timeo = so-\/>so\_rcv.sb\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00979}00979         sbsnd\_timeo = so-\/>so\_snd.sb\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00980}00980 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00981}00981         \mbox{\hyperlink{uipc__sockbuf_8c_a7b1168befdcd24a83f69362139d680f6}{sbdestroy}}(\&so-\/>so\_snd, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00982}00982         \mbox{\hyperlink{uipc__sockbuf_8c_a7b1168befdcd24a83f69362139d680f6}{sbdestroy}}(\&so-\/>so\_rcv, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00983}00983 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00984}00984 \textcolor{preprocessor}{\#ifdef INVARIANTS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00985}00985         bzero(\&so-\/>so\_rcv,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00986}00986             \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} socket) -\/ offsetof(\textcolor{keyword}{struct} socket, so\_rcv));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00987}00987 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00988}00988 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00989}00989         so-\/>sol\_sbrcv\_lowat = sbrcv\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00990}00990         so-\/>sol\_sbsnd\_lowat = sbsnd\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00991}00991         so-\/>sol\_sbrcv\_hiwat = sbrcv\_hiwat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00992}00992         so-\/>sol\_sbsnd\_hiwat = sbsnd\_hiwat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00993}00993         so-\/>sol\_sbrcv\_flags = sbrcv\_flags;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00994}00994         so-\/>sol\_sbsnd\_flags = sbsnd\_flags;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00995}00995         so-\/>sol\_sbrcv\_timeo = sbrcv\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00996}00996         so-\/>sol\_sbsnd\_timeo = sbsnd\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00997}00997 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00998}00998         so-\/>sol\_qlen = so-\/>sol\_incqlen = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l00999}00999         TAILQ\_INIT(\&so-\/>sol\_incomp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01000}01000         TAILQ\_INIT(\&so-\/>sol\_comp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01001}01001 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01002}01002         so-\/>sol\_accept\_filter = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01003}01003         so-\/>sol\_accept\_filter\_arg = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01004}01004         so-\/>sol\_accept\_filter\_str = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01005}01005 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01006}01006         so-\/>sol\_upcall = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01007}01007         so-\/>sol\_upcallarg = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01008}01008 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01009}01009         so-\/>so\_options |= SO\_ACCEPTCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01010}01010 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01011}01011 listening:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01012}01012         \textcolor{keywordflow}{if} (backlog < 0 || backlog > \mbox{\hyperlink{uipc__socket_8c_adb33baa4b4952b0cd4bc715b8cf95d98}{somaxconn}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01013}01013                 backlog = \mbox{\hyperlink{uipc__socket_8c_adb33baa4b4952b0cd4bc715b8cf95d98}{somaxconn}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01014}01014         so-\/>sol\_qlimit = backlog;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01015}01015 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01016}01016         mtx\_unlock(\&so-\/>so\_snd\_mtx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01017}01017         mtx\_unlock(\&so-\/>so\_rcv\_mtx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01018}01018         sx\_xunlock(\&so-\/>so\_snd\_sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01019}01019         sx\_xunlock(\&so-\/>so\_rcv\_sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01020}01020 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01021}01021 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01022}01022 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01023}01023 \textcolor{comment}{ * Wakeup listeners/subsystems once we have a complete connection.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01024}01024 \textcolor{comment}{ * Enters with lock, returns unlocked.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01025}01025 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01026}01026 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01027}\mbox{\hyperlink{uipc__socket_8c_a53f0083b2aea01e2a04594b9dba99b30}{01027}} \mbox{\hyperlink{uipc__socket_8c_a53f0083b2aea01e2a04594b9dba99b30}{solisten\_wakeup}}(\textcolor{keyword}{struct} socket *sol)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01028}01028 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01029}01029 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01030}01030         \textcolor{keywordflow}{if} (sol-\/>sol\_upcall != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01031}01031                 (void )sol-\/>sol\_upcall(sol, sol-\/>sol\_upcallarg, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01032}01032         \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01033}01033                 \mbox{\hyperlink{sys__generic_8c_a021f10d0043382f7a43937efac739909}{selwakeuppri}}(\&sol-\/>so\_rdsel, PSOCK);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01034}01034                 KNOTE\_LOCKED(\&sol-\/>so\_rdsel.si\_note, 0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01035}01035         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01036}01036         SOLISTEN\_UNLOCK(sol);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01037}01037         \mbox{\hyperlink{kern__synch_8c_abca2484989ddda0a376bc6a905919559}{wakeup\_one}}(\&sol-\/>sol\_comp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01038}01038         \textcolor{keywordflow}{if} ((sol-\/>so\_state \& SS\_ASYNC) \&\& sol-\/>so\_sigio != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01039}01039                 \mbox{\hyperlink{kern__sig_8c_a3843a140454e0c8530c9d2837e305f46}{pgsigio}}(\&sol-\/>so\_sigio, SIGIO, 0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01040}01040 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01041}01041 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01042}01042 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01043}01043 \textcolor{comment}{ * Return single connection off a listening socket queue.  Main consumer of}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01044}01044 \textcolor{comment}{ * the function is kern\_accept4().  Some modules, that do their own accept}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01045}01045 \textcolor{comment}{ * management also use the function.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01046}01046 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01047}01047 \textcolor{comment}{ * Listening socket must be locked on entry and is returned unlocked on}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01048}01048 \textcolor{comment}{ * return.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01049}01049 \textcolor{comment}{ * The flags argument is set of accept4(2) flags and ACCEPT4\_INHERIT.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01050}01050 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01051}01051 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01052}\mbox{\hyperlink{uipc__socket_8c_a11cfb29487612eca49304e3f86248208}{01052}} \mbox{\hyperlink{uipc__socket_8c_a11cfb29487612eca49304e3f86248208}{solisten\_dequeue}}(\textcolor{keyword}{struct} socket *head, \textcolor{keyword}{struct} socket **ret, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01053}01053 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01054}01054         \textcolor{keyword}{struct }socket *so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01055}01055         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01056}01056 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01057}01057         SOLISTEN\_LOCK\_ASSERT(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01058}01058 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01059}01059         \textcolor{keywordflow}{while} (!(head-\/>so\_state \& SS\_NBIO) \&\& TAILQ\_EMPTY(\&head-\/>sol\_comp) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01060}01060             head-\/>so\_error == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01061}01061                 error = msleep(\&head-\/>sol\_comp, SOCK\_MTX(head), PSOCK | PCATCH,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01062}01062                     \textcolor{stringliteral}{"{}accept"{}}, 0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01063}01063                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01064}01064                         SOLISTEN\_UNLOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01065}01065                         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01066}01066                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01067}01067         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01068}01068         \textcolor{keywordflow}{if} (head-\/>so\_error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01069}01069                 error = head-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01070}01070                 head-\/>so\_error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01071}01071         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} ((head-\/>so\_state \& SS\_NBIO) \&\& TAILQ\_EMPTY(\&head-\/>sol\_comp))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01072}01072                 error = EWOULDBLOCK;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01073}01073         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01074}01074                 error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01075}01075         \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01076}01076                 SOLISTEN\_UNLOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01077}01077                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01078}01078         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01079}01079         so = TAILQ\_FIRST(\&head-\/>sol\_comp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01080}01080         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01081}01081         KASSERT(so-\/>so\_qstate == SQ\_COMP,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01082}01082             (\textcolor{stringliteral}{"{}\%s: so \%p not SQ\_COMP"{}}, \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01083}01083         soref(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01084}01084         head-\/>sol\_qlen-\/-\/;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01085}01085         so-\/>so\_qstate = SQ\_NONE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01086}01086         so-\/>so\_listen = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01087}01087         TAILQ\_REMOVE(\&head-\/>sol\_comp, so, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01088}01088         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& ACCEPT4\_INHERIT)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01089}01089                 so-\/>so\_state |= (head-\/>so\_state \& SS\_NBIO);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01090}01090         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01091}01091                 so-\/>so\_state |= (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& SOCK\_NONBLOCK) ? SS\_NBIO : 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01092}01092         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01093}01093         \mbox{\hyperlink{uipc__socket_8c_ac3328ee2d74de136b477641516e4543f}{sorele\_locked}}(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01094}01094 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01095}01095         *ret = so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01096}01096         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01097}01097 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01098}01098 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01099}01099 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01100}01100 \textcolor{comment}{ * Evaluate the reference count and named references on a socket; if no}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01101}01101 \textcolor{comment}{ * references remain, free it.  This should be called whenever a reference is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01102}01102 \textcolor{comment}{ * released, such as in sorele(), but also when named reference flags are}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01103}01103 \textcolor{comment}{ * cleared in socket or protocol code.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01104}01104 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01105}01105 \textcolor{comment}{ * sofree() will free the socket if:}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01106}01106 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01107}01107 \textcolor{comment}{ * -\/ There are no outstanding file descriptor references or related consumers}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01108}01108 \textcolor{comment}{ *   (so\_count == 0).}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01109}01109 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01110}01110 \textcolor{comment}{ * -\/ The socket has been closed by user space, if ever open (SS\_NOFDREF).}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01111}01111 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01112}01112 \textcolor{comment}{ * -\/ The protocol does not have an outstanding strong reference on the socket}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01113}01113 \textcolor{comment}{ *   (SS\_PROTOREF).}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01114}01114 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01115}01115 \textcolor{comment}{ * -\/ The socket is not in a completed connection queue, so a process has been}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01116}01116 \textcolor{comment}{ *   notified that it is present.  If it is removed, the user process may}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01117}01117 \textcolor{comment}{ *   block in accept() despite select() saying the socket was ready.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01118}01118 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01119}01119 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01120}\mbox{\hyperlink{uipc__socket_8c_a0d4802b570c8beca31fb2fcafc2dd3cd}{01120}} \mbox{\hyperlink{uipc__socket_8c_a0d4802b570c8beca31fb2fcafc2dd3cd}{sofree}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01121}01121 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01122}01122         \textcolor{keyword}{struct }protosw *\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}} = so-\/>so\_proto;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01123}01123         \textcolor{keywordtype}{bool} last \_\_diagused;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01124}01124 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01125}01125         SOCK\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01126}01126 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01127}01127         \textcolor{keywordflow}{if} ((so-\/>so\_state \& (SS\_NOFDREF | SS\_PROTOREF)) != SS\_NOFDREF ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01128}01128             refcount\_load(\&so-\/>so\_count) != 0 || so-\/>so\_qstate == SQ\_COMP) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01129}01129                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01130}01130                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01131}01131         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01132}01132 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01133}01133         \textcolor{keywordflow}{if} (!SOLISTENING(so) \&\& so-\/>so\_qstate == SQ\_INCOMP) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01134}01134                 \textcolor{keyword}{struct }socket *sol;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01135}01135 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01136}01136                 sol = so-\/>so\_listen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01137}01137                 KASSERT(sol, (\textcolor{stringliteral}{"{}\%s: so \%p on incomp of NULL"{}}, \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01138}01138 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01139}01139                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01140}01140 \textcolor{comment}{                 * To solve race between close of a listening socket and}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01141}01141 \textcolor{comment}{                 * a socket on its incomplete queue, we need to lock both.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01142}01142 \textcolor{comment}{                 * The order is first listening socket, then regular.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01143}01143 \textcolor{comment}{                 * Since we don't have SS\_NOFDREF neither SS\_PROTOREF, this}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01144}01144 \textcolor{comment}{                 * function and the listening socket are the only pointers}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01145}01145 \textcolor{comment}{                 * to so.  To preserve so and sol, we reference both and then}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01146}01146 \textcolor{comment}{                 * relock.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01147}01147 \textcolor{comment}{                 * After relock the socket may not move to so\_comp since it}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01148}01148 \textcolor{comment}{                 * doesn't have PCB already, but it may be removed from}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01149}01149 \textcolor{comment}{                 * so\_incomp. If that happens, we share responsiblity on}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01150}01150 \textcolor{comment}{                 * freeing the socket, but soclose() has already removed}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01151}01151 \textcolor{comment}{                 * it from queue.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01152}01152 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01153}01153                 soref(sol);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01154}01154                 soref(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01155}01155                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01156}01156                 SOLISTEN\_LOCK(sol);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01157}01157                 SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01158}01158                 \textcolor{keywordflow}{if} (so-\/>so\_qstate == SQ\_INCOMP) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01159}01159                         KASSERT(so-\/>so\_listen == sol,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01160}01160                             (\textcolor{stringliteral}{"{}\%s: so \%p migrated out of sol \%p"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01161}01161                             \_\_func\_\_, so, sol));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01162}01162                         TAILQ\_REMOVE(\&sol-\/>sol\_incomp, so, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01163}01163                         sol-\/>sol\_incqlen-\/-\/;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01164}01164                         last = refcount\_release(\&sol-\/>so\_count);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01165}01165                         KASSERT(!last, (\textcolor{stringliteral}{"{}\%s: released last reference for \%p"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01166}01166                             \_\_func\_\_, sol));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01167}01167                         so-\/>so\_qstate = SQ\_NONE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01168}01168                         so-\/>so\_listen = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01169}01169                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01170}01170                         KASSERT(so-\/>so\_listen == NULL,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01171}01171                             (\textcolor{stringliteral}{"{}\%s: so \%p not on (in)comp with so\_listen"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01172}01172                             \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01173}01173                 \mbox{\hyperlink{uipc__socket_8c_ac3328ee2d74de136b477641516e4543f}{sorele\_locked}}(sol);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01174}01174                 KASSERT(refcount\_load(\&so-\/>so\_count) == 1,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01175}01175                     (\textcolor{stringliteral}{"{}\%s: so \%p count \%u"{}}, \_\_func\_\_, so, so-\/>so\_count));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01176}01176                 so-\/>so\_count = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01177}01177         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01178}01178         \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01179}01179                 so-\/>so\_error = ECONNABORTED;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01180}01180         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01181}01181 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01182}01182         \textcolor{keywordflow}{if} (so-\/>so\_dtor != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01183}01183                 so-\/>so\_dtor(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01184}01184 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01185}01185         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01186}01186         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_RIGHTS \&\& \mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_domain-\/>dom\_dispose != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01187}01187                 (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_domain-\/>dom\_dispose)(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01188}01188         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_detach != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01189}01189                 (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_detach)(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01190}01190 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01191}01191         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01192}01192 \textcolor{comment}{         * From this point on, we assume that no other references to this}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01193}01193 \textcolor{comment}{         * socket exist anywhere else in the stack.  Therefore, no locks need}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01194}01194 \textcolor{comment}{         * to be acquired or held.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01195}01195 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01196}01196 \textcolor{comment}{         * We used to do a lot of socket buffer and socket locking here, as}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01197}01197 \textcolor{comment}{         * well as invoke sorflush() and perform wakeups.  The direct call to}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01198}01198 \textcolor{comment}{         * dom\_dispose() and sbdestroy() are an inlining of what was}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01199}01199 \textcolor{comment}{         * necessary from sorflush().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01200}01200 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01201}01201 \textcolor{comment}{         * Notice that the socket buffer and kqueue state are torn down}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01202}01202 \textcolor{comment}{         * before calling pru\_detach.  This means that protocols shold not}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01203}01203 \textcolor{comment}{         * assume they can perform socket wakeups, etc, in their detach code.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01204}01204 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01205}01205         \textcolor{keywordflow}{if} (!SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01206}01206                 \mbox{\hyperlink{uipc__sockbuf_8c_a7b1168befdcd24a83f69362139d680f6}{sbdestroy}}(\&so-\/>so\_snd, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01207}01207                 \mbox{\hyperlink{uipc__sockbuf_8c_a7b1168befdcd24a83f69362139d680f6}{sbdestroy}}(\&so-\/>so\_rcv, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01208}01208         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01209}01209         \mbox{\hyperlink{sys__generic_8c_a08bd7fbefa2d29ae4b9dc22c0edbc892}{seldrain}}(\&so-\/>so\_rdsel);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01210}01210         \mbox{\hyperlink{sys__generic_8c_a08bd7fbefa2d29ae4b9dc22c0edbc892}{seldrain}}(\&so-\/>so\_wrsel);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01211}01211         \mbox{\hyperlink{kern__event_8c_aa6d474d191e26924dc44ade178fa949b}{knlist\_destroy}}(\&so-\/>so\_rdsel.si\_note);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01212}01212         \mbox{\hyperlink{kern__event_8c_aa6d474d191e26924dc44ade178fa949b}{knlist\_destroy}}(\&so-\/>so\_wrsel.si\_note);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01213}01213         \mbox{\hyperlink{uipc__socket_8c_ae6a92a908156979e56262c262521a44f}{sodealloc}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01214}01214 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01215}01215 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01216}01216 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01217}01217 \textcolor{comment}{ * Release a reference on a socket while holding the socket lock.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01218}01218 \textcolor{comment}{ * Unlocks the socket lock before returning.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01219}01219 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01220}01220 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01221}\mbox{\hyperlink{uipc__socket_8c_ac3328ee2d74de136b477641516e4543f}{01221}} \mbox{\hyperlink{uipc__socket_8c_ac3328ee2d74de136b477641516e4543f}{sorele\_locked}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01222}01222 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01223}01223         SOCK\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01224}01224         \textcolor{keywordflow}{if} (refcount\_release(\&so-\/>so\_count))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01225}01225                 \mbox{\hyperlink{uipc__socket_8c_a0d4802b570c8beca31fb2fcafc2dd3cd}{sofree}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01226}01226         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01227}01227                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01228}01228 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01229}01229 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01230}01230 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01231}01231 \textcolor{comment}{ * Close a socket on last file table reference removal.  Initiate disconnect}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01232}01232 \textcolor{comment}{ * if connected.  Free socket when disconnect complete.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01233}01233 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01234}01234 \textcolor{comment}{ * This function will sorele() the socket.  Note that soclose() may be called}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01235}01235 \textcolor{comment}{ * prior to the ref count reaching zero.  The actual socket structure will}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01236}01236 \textcolor{comment}{ * not be freed until the ref count reaches zero.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01237}01237 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01238}01238 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01239}\mbox{\hyperlink{uipc__socket_8c_a6e29e9eae0fed64f1d28696f62fbb3e5}{01239}} \mbox{\hyperlink{uipc__socket_8c_a6e29e9eae0fed64f1d28696f62fbb3e5}{soclose}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01240}01240 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01241}01241         \textcolor{keyword}{struct }accept\_queue lqueue;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01242}01242         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01243}01243         \textcolor{keywordtype}{bool} listening, last \_\_diagused;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01244}01244 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01245}01245         KASSERT(!(so-\/>so\_state \& SS\_NOFDREF), (\textcolor{stringliteral}{"{}soclose: SS\_NOFDREF on enter"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01246}01246 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01247}01247         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01248}01248         \mbox{\hyperlink{kern__descrip_8c_a619fc5be053745920de7fb280c2e118e}{funsetown}}(\&so-\/>so\_sigio);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01249}01249         \textcolor{keywordflow}{if} (so-\/>so\_state \& SS\_ISCONNECTED) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01250}01250                 \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_ISDISCONNECTING) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01251}01251                         error = \mbox{\hyperlink{uipc__socket_8c_a37d0020755ebe0a6d5919b9cf094e45b}{sodisconnect}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01252}01252                         \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01253}01253                                 \textcolor{keywordflow}{if} (error == ENOTCONN)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01254}01254                                         error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01255}01255                                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01256}01256                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01257}01257                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01258}01258 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01259}01259                 \textcolor{keywordflow}{if} ((so-\/>so\_options \& SO\_LINGER) != 0 \&\& so-\/>so\_linger != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01260}01260                         \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_ISDISCONNECTING) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01261}01261                             (so-\/>so\_state \& SS\_NBIO))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01262}01262                                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01263}01263                         \textcolor{keywordflow}{while} (so-\/>so\_state \& SS\_ISCONNECTED) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01264}01264                                 error = tsleep(\&so-\/>so\_timeo,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01265}01265                                     PSOCK | PCATCH, \textcolor{stringliteral}{"{}soclos"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01266}01266                                     so-\/>so\_linger * \mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01267}01267                                 \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01268}01268                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01269}01269                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01270}01270                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01271}01271         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01272}01272 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01273}01273 drop:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01274}01274         \textcolor{keywordflow}{if} (so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_close != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01275}01275                 (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_close)(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01276}01276 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01277}01277         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01278}01278         \textcolor{keywordflow}{if} ((listening = SOLISTENING(so))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01279}01279                 \textcolor{keyword}{struct }socket *sp;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01280}01280 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01281}01281                 TAILQ\_INIT(\&lqueue);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01282}01282                 TAILQ\_SWAP(\&lqueue, \&so-\/>sol\_incomp, socket, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01283}01283                 TAILQ\_CONCAT(\&lqueue, \&so-\/>sol\_comp, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01284}01284 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01285}01285                 so-\/>sol\_qlen = so-\/>sol\_incqlen = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01286}01286 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01287}01287                 TAILQ\_FOREACH(sp, \&lqueue, so\_list) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01288}01288                         SOCK\_LOCK(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01289}01289                         sp-\/>so\_qstate = SQ\_NONE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01290}01290                         sp-\/>so\_listen = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01291}01291                         SOCK\_UNLOCK(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01292}01292                         last = refcount\_release(\&so-\/>so\_count);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01293}01293                         KASSERT(!last, (\textcolor{stringliteral}{"{}\%s: released last reference for \%p"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01294}01294                             \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01295}01295                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01296}01296         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01297}01297         KASSERT((so-\/>so\_state \& SS\_NOFDREF) == 0, (\textcolor{stringliteral}{"{}soclose: NOFDREF"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01298}01298         so-\/>so\_state |= SS\_NOFDREF;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01299}01299         \mbox{\hyperlink{uipc__socket_8c_ac3328ee2d74de136b477641516e4543f}{sorele\_locked}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01300}01300         \textcolor{keywordflow}{if} (listening) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01301}01301                 \textcolor{keyword}{struct }socket *sp, *tsp;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01302}01302 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01303}01303                 TAILQ\_FOREACH\_SAFE(sp, \&lqueue, so\_list, tsp) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01304}01304                         SOCK\_LOCK(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01305}01305                         \textcolor{keywordflow}{if} (refcount\_load(\&sp-\/>so\_count) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01306}01306                                 SOCK\_UNLOCK(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01307}01307                                 \mbox{\hyperlink{uipc__socket_8c_a83de7f47fa8274cc25c2dff3f15ff621}{soabort}}(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01308}01308                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01309}01309                                 \textcolor{comment}{/* See the handling of queued sockets}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01310}01310 \textcolor{comment}{                                   in sofree(). */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01311}01311                                 SOCK\_UNLOCK(sp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01312}01312                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01313}01313                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01314}01314         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01315}01315         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01316}01316         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01317}01317 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01318}01318 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01319}01319 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01320}01320 \textcolor{comment}{ * soabort() is used to abruptly tear down a connection, such as when a}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01321}01321 \textcolor{comment}{ * resource limit is reached (listen queue depth exceeded), or if a listen}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01322}01322 \textcolor{comment}{ * socket is closed while there are sockets waiting to be accepted.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01323}01323 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01324}01324 \textcolor{comment}{ * This interface is tricky, because it is called on an unreferenced socket,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01325}01325 \textcolor{comment}{ * and must be called only by a thread that has actually removed the socket}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01326}01326 \textcolor{comment}{ * from the listen queue it was on, or races with other threads are risked.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01327}01327 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01328}01328 \textcolor{comment}{ * This interface will call into the protocol code, so must not be called}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01329}01329 \textcolor{comment}{ * with any socket locks held.  Protocols do call it while holding their own}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01330}01330 \textcolor{comment}{ * recursible protocol mutexes, but this is something that should be subject}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01331}01331 \textcolor{comment}{ * to review in the future.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01332}01332 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01333}01333 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01334}\mbox{\hyperlink{uipc__socket_8c_a83de7f47fa8274cc25c2dff3f15ff621}{01334}} \mbox{\hyperlink{uipc__socket_8c_a83de7f47fa8274cc25c2dff3f15ff621}{soabort}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01335}01335 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01336}01336 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01337}01337         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01338}01338 \textcolor{comment}{         * In as much as is possible, assert that no references to this}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01339}01339 \textcolor{comment}{         * socket are held.  This is not quite the same as asserting that the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01340}01340 \textcolor{comment}{         * current thread is responsible for arranging for no references, but}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01341}01341 \textcolor{comment}{         * is as close as we can get for now.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01342}01342 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01343}01343         KASSERT(so-\/>so\_count == 0, (\textcolor{stringliteral}{"{}soabort: so\_count"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01344}01344         KASSERT((so-\/>so\_state \& SS\_PROTOREF) == 0, (\textcolor{stringliteral}{"{}soabort: SS\_PROTOREF"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01345}01345         KASSERT(so-\/>so\_state \& SS\_NOFDREF, (\textcolor{stringliteral}{"{}soabort: !SS\_NOFDREF"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01346}01346         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01347}01347 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01348}01348         \textcolor{keywordflow}{if} (so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_abort != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01349}01349                 (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_abort)(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01350}01350         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01351}01351         \mbox{\hyperlink{uipc__socket_8c_a0d4802b570c8beca31fb2fcafc2dd3cd}{sofree}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01352}01352 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01353}01353 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01354}01354 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01355}\mbox{\hyperlink{uipc__socket_8c_aeaae9f4f680d3c325aec9747add2d0b4}{01355}} \mbox{\hyperlink{uipc__socket_8c_aeaae9f4f680d3c325aec9747add2d0b4}{soaccept}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **nam)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01356}01356 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01357}01357         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01358}01358 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01359}01359         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01360}01360         KASSERT((so-\/>so\_state \& SS\_NOFDREF) != 0, (\textcolor{stringliteral}{"{}soaccept: !NOFDREF"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01361}01361         so-\/>so\_state \&= \string~SS\_NOFDREF;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01362}01362         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01363}01363 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01364}01364         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01365}01365         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_accept)(so, nam);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01366}01366         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01367}01367         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01368}01368 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01369}01369 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01370}01370 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01371}\mbox{\hyperlink{uipc__socket_8c_a83f52babd206c0303047e4f190032dc7}{01371}} \mbox{\hyperlink{uipc__socket_8c_a83f52babd206c0303047e4f190032dc7}{soconnect}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01372}01372 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01373}01373 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01374}01374         \textcolor{keywordflow}{return} (\mbox{\hyperlink{uipc__socket_8c_a88090930812531239bf437ec0bd79396}{soconnectat}}(AT\_FDCWD, so, nam, td));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01375}01375 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01376}01376 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01377}01377 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01378}\mbox{\hyperlink{uipc__socket_8c_a88090930812531239bf437ec0bd79396}{01378}} \mbox{\hyperlink{uipc__socket_8c_a88090930812531239bf437ec0bd79396}{soconnectat}}(\textcolor{keywordtype}{int} \mbox{\hyperlink{vfs__syscalls_8c_a6f8059414f0228f0256115e024eeed4b}{fd}}, \textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01379}01379 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01380}01380         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01381}01381 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01382}01382         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01383}01383         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01384}01384 \textcolor{comment}{         * If protocol is connection-\/based, can only connect once.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01385}01385 \textcolor{comment}{         * Otherwise, if connected, try to disconnect first.  This allows}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01386}01386 \textcolor{comment}{         * user to disconnect by connecting to, e.g., a null address.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01387}01387 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01388}01388         \textcolor{keywordflow}{if} (so-\/>so\_state \& (SS\_ISCONNECTED|SS\_ISCONNECTING) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01389}01389             ((so-\/>so\_proto-\/>pr\_flags \& PR\_CONNREQUIRED) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01390}01390             (error = \mbox{\hyperlink{uipc__socket_8c_a37d0020755ebe0a6d5919b9cf094e45b}{sodisconnect}}(so)))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01391}01391                 error = EISCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01392}01392         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01393}01393                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01394}01394 \textcolor{comment}{                 * Prevent accumulated error from previous connection from}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01395}01395 \textcolor{comment}{                 * biting us.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01396}01396 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01397}01397                 so-\/>so\_error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01398}01398                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{vfs__syscalls_8c_a6f8059414f0228f0256115e024eeed4b}{fd}} == AT\_FDCWD) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01399}01399                         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_connect)(so,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01400}01400                             nam, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01401}01401                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01402}01402                         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_connectat)(\mbox{\hyperlink{vfs__syscalls_8c_a6f8059414f0228f0256115e024eeed4b}{fd}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01403}01403                             so, nam, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01404}01404                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01405}01405         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01406}01406         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01407}01407 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01408}01408         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01409}01409 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01410}01410 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01411}01411 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01412}\mbox{\hyperlink{uipc__socket_8c_a566b533bc410dedd9bcfa64d78151949}{01412}} \mbox{\hyperlink{uipc__socket_8c_a566b533bc410dedd9bcfa64d78151949}{soconnect2}}(\textcolor{keyword}{struct} socket *so1, \textcolor{keyword}{struct} socket *so2)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01413}01413 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01414}01414         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01415}01415 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01416}01416         CURVNET\_SET(so1-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01417}01417         error = (*so1-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_connect2)(so1, so2);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01418}01418         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01419}01419         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01420}01420 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01421}01421 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01422}01422 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01423}\mbox{\hyperlink{uipc__socket_8c_a37d0020755ebe0a6d5919b9cf094e45b}{01423}} \mbox{\hyperlink{uipc__socket_8c_a37d0020755ebe0a6d5919b9cf094e45b}{sodisconnect}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01424}01424 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01425}01425         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01426}01426 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01427}01427         \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_ISCONNECTED) == 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01428}01428                 \textcolor{keywordflow}{return} (ENOTCONN);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01429}01429         \textcolor{keywordflow}{if} (so-\/>so\_state \& SS\_ISDISCONNECTING)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01430}01430                 \textcolor{keywordflow}{return} (EALREADY);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01431}01431         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01432}01432         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_disconnect)(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01433}01433         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01434}01434 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01435}01435 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01436}01436 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01437}\mbox{\hyperlink{uipc__socket_8c_a72874b3d6004be1bd86c4767378d980b}{01437}} \mbox{\hyperlink{uipc__socket_8c_a72874b3d6004be1bd86c4767378d980b}{sosend\_dgram}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *\mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}}, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01438}01438     \textcolor{keyword}{struct} mbuf *top, \textcolor{keyword}{struct} mbuf *control, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01439}01439 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01440}01440         \textcolor{keywordtype}{long} space;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01441}01441         ssize\_t resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01442}01442         \textcolor{keywordtype}{int} clen = 0, error, dontroute;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01443}01443 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01444}01444         KASSERT(so-\/>so\_type == SOCK\_DGRAM, (\textcolor{stringliteral}{"{}sosend\_dgram: !SOCK\_DGRAM"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01445}01445         KASSERT(so-\/>so\_proto-\/>pr\_flags \& PR\_ATOMIC,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01446}01446             (\textcolor{stringliteral}{"{}sosend\_dgram: !PR\_ATOMIC"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01447}01447 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01448}01448         \textcolor{keywordflow}{if} (uio != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01449}01449                 resid = uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01450}01450         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01451}01451                 resid = top-\/>m\_pkthdr.len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01452}01452         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01453}01453 \textcolor{comment}{         * In theory resid should be unsigned.  However, space must be}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01454}01454 \textcolor{comment}{         * signed, as it might be less than 0 if we over-\/committed, and we}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01455}01455 \textcolor{comment}{         * must use a signed comparison of space and resid.  On the other}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01456}01456 \textcolor{comment}{         * hand, a negative resid causes us to loop sending 0-\/length}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01457}01457 \textcolor{comment}{         * segments to the protocol.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01458}01458 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01459}01459         \textcolor{keywordflow}{if} (resid < 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01460}01460                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01461}01461                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01462}01462         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01463}01463 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01464}01464         dontroute =}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01465}01465             (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_DONTROUTE) \&\& (so-\/>so\_options \& SO\_DONTROUTE) == 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01466}01466         \textcolor{keywordflow}{if} (td != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01467}01467                 td-\/>td\_ru.ru\_msgsnd++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01468}01468         \textcolor{keywordflow}{if} (control != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01469}01469                 clen = control-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01470}01470 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01471}01471         SOCKBUF\_LOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01472}01472         \textcolor{keywordflow}{if} (so-\/>so\_snd.sb\_state \& SBS\_CANTSENDMORE) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01473}01473                 SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01474}01474                 error = EPIPE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01475}01475                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01476}01476         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01477}01477         \textcolor{keywordflow}{if} (so-\/>so\_error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01478}01478                 error = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01479}01479                 so-\/>so\_error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01480}01480                 SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01481}01481                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01482}01482         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01483}01483         \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_ISCONNECTED) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01484}01484                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01485}01485 \textcolor{comment}{                 * `sendto' and `sendmsg' is allowed on a connection-\/based}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01486}01486 \textcolor{comment}{                 * socket if it supports implied connect.  Return ENOTCONN if}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01487}01487 \textcolor{comment}{                 * not connected and no address is supplied.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01488}01488 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01489}01489                 \textcolor{keywordflow}{if} ((so-\/>so\_proto-\/>pr\_flags \& PR\_CONNREQUIRED) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01490}01490                     (so-\/>so\_proto-\/>pr\_flags \& PR\_IMPLOPCL) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01491}01491                         \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_ISCONFIRMING) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01492}01492                             !(resid == 0 \&\& clen != 0)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01493}01493                                 SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01494}01494                                 error = ENOTCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01495}01495                                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01496}01496                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01497}01497                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01498}01498                         \textcolor{keywordflow}{if} (so-\/>so\_proto-\/>pr\_flags \& PR\_CONNREQUIRED)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01499}01499                                 error = ENOTCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01500}01500                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01501}01501                                 error = EDESTADDRREQ;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01502}01502                         SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01503}01503                         \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01504}01504                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01505}01505         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01506}01506 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01507}01507         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01508}01508 \textcolor{comment}{         * Do we need MSG\_OOB support in SOCK\_DGRAM?  Signs here may be a}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01509}01509 \textcolor{comment}{         * problem and need fixing.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01510}01510 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01511}01511         space = sbspace(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01512}01512         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_OOB)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01513}01513                 space += 1024;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01514}01514         space -\/= clen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01515}01515         SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01516}01516         \textcolor{keywordflow}{if} (resid > space) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01517}01517                 error = EMSGSIZE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01518}01518                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01519}01519         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01520}01520         \textcolor{keywordflow}{if} (uio == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01521}01521                 resid = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01522}01522                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOR)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01523}01523                         top-\/>m\_flags |= M\_EOR;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01524}01524         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01525}01525                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01526}01526 \textcolor{comment}{                 * Copy the data from userland into a mbuf chain.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01527}01527 \textcolor{comment}{                 * If no data is to be copied in, a single empty mbuf}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01528}01528 \textcolor{comment}{                 * is returned.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01529}01529 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01530}01530                 top = \mbox{\hyperlink{uipc__mbuf_8c_af14b3c481a2a853058ef89334878d87b}{m\_uiotombuf}}(uio, M\_WAITOK, space, \mbox{\hyperlink{uipc__mbuf_8c_a989a3e63f7a60fbc46a799ba78576e01}{max\_hdr}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01531}01531                     (M\_PKTHDR | ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOR) ? M\_EOR : 0)));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01532}01532                 \textcolor{keywordflow}{if} (top == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01533}01533                         error = EFAULT; \textcolor{comment}{/* only possible error */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01534}01534                         \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01535}01535                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01536}01536                 space -\/= resid -\/ uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01537}01537                 resid = uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01538}01538         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01539}01539         KASSERT(resid == 0, (\textcolor{stringliteral}{"{}sosend\_dgram: resid != 0"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01540}01540         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01541}01541 \textcolor{comment}{         * XXXRW: Frobbing SO\_DONTROUTE here is even worse without sblock}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01542}01542 \textcolor{comment}{         * than with.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01543}01543 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01544}01544         \textcolor{keywordflow}{if} (dontroute) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01545}01545                 SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01546}01546                 so-\/>so\_options |= SO\_DONTROUTE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01547}01547                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01548}01548         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01549}01549         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01550}01550 \textcolor{comment}{         * XXX all the SBS\_CANTSENDMORE checks previously done could be out}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01551}01551 \textcolor{comment}{         * of date.  We could have received a reset packet in an interrupt or}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01552}01552 \textcolor{comment}{         * maybe we slept while doing page faults in uiomove() etc.  We could}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01553}01553 \textcolor{comment}{         * probably recheck again inside the locking protection here, but}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01554}01554 \textcolor{comment}{         * there are probably other places that this also happens.  We must}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01555}01555 \textcolor{comment}{         * rethink this.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01556}01556 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01557}01557         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01558}01558         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_send)(so,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01559}01559             (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_OOB) ? PRUS\_OOB :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01560}01560         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01561}01561 \textcolor{comment}{         * If the user set MSG\_EOF, the protocol understands this flag and}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01562}01562 \textcolor{comment}{         * nothing left to send then use PRU\_SEND\_EOF instead of PRU\_SEND.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01563}01563 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01564}01564             ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOF) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01565}01565              (so-\/>so\_proto-\/>pr\_flags \& PR\_IMPLOPCL) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01566}01566              (resid <= 0)) ?}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01567}01567                 PRUS\_EOF :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01568}01568                 \textcolor{comment}{/* If there is more to send set PRUS\_MORETOCOME */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01569}01569                 (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_MORETOCOME) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01570}01570                 (resid > 0 \&\& space > 0) ? PRUS\_MORETOCOME : 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01571}01571                 top, \mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}}, control, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01572}01572         \textcolor{keywordflow}{if} (dontroute) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01573}01573                 SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01574}01574                 so-\/>so\_options \&= \string~SO\_DONTROUTE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01575}01575                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01576}01576         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01577}01577         clen = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01578}01578         control = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01579}01579         top = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01580}01580 out:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01581}01581         \textcolor{keywordflow}{if} (top != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01582}01582                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(top);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01583}01583         \textcolor{keywordflow}{if} (control != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01584}01584                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(control);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01585}01585         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01586}01586 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01587}01587 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01588}01588 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01589}01589 \textcolor{comment}{ * Send on a socket.  If send must go all at once and message is larger than}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01590}01590 \textcolor{comment}{ * send buffering, then hard error.  Lock against other senders.  If must go}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01591}01591 \textcolor{comment}{ * all at once and not enough room now, then inform user that this would}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01592}01592 \textcolor{comment}{ * block and do nothing.  Otherwise, if nonblocking, send as much as}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01593}01593 \textcolor{comment}{ * possible.  The data to be sent is described by "{}uio"{} if nonzero, otherwise}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01594}01594 \textcolor{comment}{ * by the mbuf chain "{}top"{} (which must be null if uio is not).  Data provided}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01595}01595 \textcolor{comment}{ * in mbuf chain must be small enough to send all at once.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01596}01596 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01597}01597 \textcolor{comment}{ * Returns nonzero on error, timeout or signal; callers must check for short}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01598}01598 \textcolor{comment}{ * counts if EINTR/ERESTART are returned.  Data and control buffers are freed}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01599}01599 \textcolor{comment}{ * on return.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01600}01600 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01601}01601 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01602}\mbox{\hyperlink{uipc__socket_8c_a0459911d7bc5019d5af53778482a4654}{01602}} \mbox{\hyperlink{uipc__socket_8c_a0459911d7bc5019d5af53778482a4654}{sosend\_generic}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *\mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}}, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01603}01603     \textcolor{keyword}{struct} mbuf *top, \textcolor{keyword}{struct} mbuf *control, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01604}01604 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01605}01605         \textcolor{keywordtype}{long} space;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01606}01606         ssize\_t resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01607}01607         \textcolor{keywordtype}{int} clen = 0, error, dontroute;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01608}01608         \textcolor{keywordtype}{int} atomic = sosendallatonce(so) || top;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01609}01609         \textcolor{keywordtype}{int} pru\_flag;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01610}01610 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01611}01611         \textcolor{keyword}{struct }ktls\_session *tls;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01612}01612         \textcolor{keywordtype}{int} tls\_enq\_cnt, tls\_pruflag;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01613}01613         uint8\_t tls\_rtype;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01614}01614 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01615}01615         tls = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01616}01616         tls\_rtype = TLS\_RLTYPE\_APP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01617}01617 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01618}01618         \textcolor{keywordflow}{if} (uio != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01619}01619                 resid = uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01620}01620         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} ((top-\/>m\_flags \& M\_PKTHDR) != 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01621}01621                 resid = top-\/>m\_pkthdr.len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01622}01622         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01623}01623                 resid = \mbox{\hyperlink{uipc__mbuf_8c_a28322fb29520fbeb79a3a927da62d8c2}{m\_length}}(top, NULL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01624}01624         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01625}01625 \textcolor{comment}{         * In theory resid should be unsigned.  However, space must be}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01626}01626 \textcolor{comment}{         * signed, as it might be less than 0 if we over-\/committed, and we}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01627}01627 \textcolor{comment}{         * must use a signed comparison of space and resid.  On the other}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01628}01628 \textcolor{comment}{         * hand, a negative resid causes us to loop sending 0-\/length}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01629}01629 \textcolor{comment}{         * segments to the protocol.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01630}01630 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01631}01631 \textcolor{comment}{         * Also check to make sure that MSG\_EOR isn't used on SOCK\_STREAM}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01632}01632 \textcolor{comment}{         * type sockets since that's an error.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01633}01633 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01634}01634         \textcolor{keywordflow}{if} (resid < 0 || (so-\/>so\_type == SOCK\_STREAM \&\& (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOR))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01635}01635                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01636}01636                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01637}01637         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01638}01638 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01639}01639         dontroute =}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01640}01640             (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_DONTROUTE) \&\& (so-\/>so\_options \& SO\_DONTROUTE) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01641}01641             (so-\/>so\_proto-\/>pr\_flags \& PR\_ATOMIC);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01642}01642         \textcolor{keywordflow}{if} (td != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01643}01643                 td-\/>td\_ru.ru\_msgsnd++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01644}01644         \textcolor{keywordflow}{if} (control != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01645}01645                 clen = control-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01646}01646 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01647}01647         error = SOCK\_IO\_SEND\_LOCK(so, SBLOCKWAIT(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01648}01648         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01649}01649                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01650}01650 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01651}01651 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01652}01652         tls\_pruflag = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01653}01653         tls = ktls\_hold(so-\/>so\_snd.sb\_tls\_info);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01654}01654         \textcolor{keywordflow}{if} (tls != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01655}01655                 \textcolor{keywordflow}{if} (tls-\/>mode == TCP\_TLS\_MODE\_SW)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01656}01656                         tls\_pruflag = PRUS\_NOTREADY;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01657}01657 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01658}01658                 \textcolor{keywordflow}{if} (control != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01659}01659                         \textcolor{keyword}{struct }cmsghdr *cm = mtod(control, \textcolor{keyword}{struct} cmsghdr *);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01660}01660 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01661}01661                         \textcolor{keywordflow}{if} (clen >= \textcolor{keyword}{sizeof}(*cm) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01662}01662                             cm-\/>cmsg\_type == TLS\_SET\_RECORD\_TYPE) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01663}01663                                 tls\_rtype = *((uint8\_t *)CMSG\_DATA(cm));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01664}01664                                 clen = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01665}01665                                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(control);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01666}01666                                 control = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01667}01667                                 atomic = 1;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01668}01668                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01669}01669                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01670}01670 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01671}01671                 \textcolor{keywordflow}{if} (resid == 0 \&\& !\mbox{\hyperlink{uipc__ktls_8c_a3e7f08fba5fd5bea81186855ddd3cc70}{ktls\_permit\_empty\_frames}}(tls)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01672}01672                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01673}01673                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01674}01674                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01675}01675         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01676}01676 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01677}01677 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01678}01678 restart:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01679}01679         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01680}01680                 SOCKBUF\_LOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01681}01681                 \textcolor{keywordflow}{if} (so-\/>so\_snd.sb\_state \& SBS\_CANTSENDMORE) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01682}01682                         SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01683}01683                         error = EPIPE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01684}01684                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01685}01685                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01686}01686                 \textcolor{keywordflow}{if} (so-\/>so\_error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01687}01687                         error = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01688}01688                         so-\/>so\_error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01689}01689                         SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01690}01690                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01691}01691                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01692}01692                 \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_ISCONNECTED) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01693}01693                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01694}01694 \textcolor{comment}{                         * `sendto' and `sendmsg' is allowed on a connection-\/}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01695}01695 \textcolor{comment}{                         * based socket if it supports implied connect.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01696}01696 \textcolor{comment}{                         * Return ENOTCONN if not connected and no address is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01697}01697 \textcolor{comment}{                         * supplied.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01698}01698 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01699}01699                         \textcolor{keywordflow}{if} ((so-\/>so\_proto-\/>pr\_flags \& PR\_CONNREQUIRED) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01700}01700                             (so-\/>so\_proto-\/>pr\_flags \& PR\_IMPLOPCL) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01701}01701                                 \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_ISCONFIRMING) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01702}01702                                     !(resid == 0 \&\& clen != 0)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01703}01703                                         SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01704}01704                                         error = ENOTCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01705}01705                                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01706}01706                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01707}01707                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01708}01708                                 SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01709}01709                                 \textcolor{keywordflow}{if} (so-\/>so\_proto-\/>pr\_flags \& PR\_CONNREQUIRED)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01710}01710                                         error = ENOTCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01711}01711                                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01712}01712                                         error = EDESTADDRREQ;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01713}01713                                 \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01714}01714                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01715}01715                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01716}01716                 space = sbspace(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01717}01717                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_OOB)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01718}01718                         space += 1024;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01719}01719                 \textcolor{keywordflow}{if} ((atomic \&\& resid > so-\/>so\_snd.sb\_hiwat) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01720}01720                     clen > so-\/>so\_snd.sb\_hiwat) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01721}01721                         SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01722}01722                         error = EMSGSIZE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01723}01723                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01724}01724                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01725}01725                 \textcolor{keywordflow}{if} (space < resid + clen \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01726}01726                     (atomic || space < so-\/>so\_snd.sb\_lowat || space < clen)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01727}01727                         \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_NBIO) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01728}01728                             (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& (MSG\_NBIO | MSG\_DONTWAIT)) != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01729}01729                                 SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01730}01730                                 error = EWOULDBLOCK;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01731}01731                                 \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01732}01732                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01733}01733                         error = \mbox{\hyperlink{uipc__sockbuf_8c_a0cd636ed80e189b378257a942318918c}{sbwait}}(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01734}01734                         SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01735}01735                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01736}01736                                 \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01737}01737                         \textcolor{keywordflow}{goto} restart;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01738}01738                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01739}01739                 SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01740}01740                 space -\/= clen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01741}01741                 \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01742}01742                         \textcolor{keywordflow}{if} (uio == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01743}01743                                 resid = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01744}01744                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOR)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01745}01745                                         top-\/>m\_flags |= M\_EOR;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01746}01746 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01747}01747                                 \textcolor{keywordflow}{if} (tls != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01748}01748                                         \mbox{\hyperlink{uipc__ktls_8c_ad5cb4edefa60b25ef10aa881a1af3368}{ktls\_frame}}(top, tls, \&tls\_enq\_cnt,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01749}01749                                             tls\_rtype);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01750}01750                                         tls\_rtype = TLS\_RLTYPE\_APP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01751}01751                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01752}01752 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01753}01753                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01754}01754                                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01755}01755 \textcolor{comment}{                                 * Copy the data from userland into a mbuf}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01756}01756 \textcolor{comment}{                                 * chain.  If resid is 0, which can happen}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01757}01757 \textcolor{comment}{                                 * only if we have control to send, then}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01758}01758 \textcolor{comment}{                                 * a single empty mbuf is returned.  This}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01759}01759 \textcolor{comment}{                                 * is a workaround to prevent protocol send}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01760}01760 \textcolor{comment}{                                 * methods to panic.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01761}01761 \textcolor{comment}{                                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01762}01762 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01763}01763                                 \textcolor{keywordflow}{if} (tls != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01764}01764                                         top = \mbox{\hyperlink{uipc__mbuf_8c_af14b3c481a2a853058ef89334878d87b}{m\_uiotombuf}}(uio, M\_WAITOK, space,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01765}01765                                             tls-\/>params.max\_frame\_len,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01766}01766                                             M\_EXTPG |}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01767}01767                                             ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOR) ? M\_EOR : 0));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01768}01768                                         \textcolor{keywordflow}{if} (top != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01769}01769                                                 \mbox{\hyperlink{uipc__ktls_8c_ad5cb4edefa60b25ef10aa881a1af3368}{ktls\_frame}}(top, tls,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01770}01770                                                     \&tls\_enq\_cnt, tls\_rtype);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01771}01771                                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01772}01772                                         tls\_rtype = TLS\_RLTYPE\_APP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01773}01773                                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01774}01774 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01775}01775                                         top = \mbox{\hyperlink{uipc__mbuf_8c_af14b3c481a2a853058ef89334878d87b}{m\_uiotombuf}}(uio, M\_WAITOK, space,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01776}01776                                             (atomic ? \mbox{\hyperlink{uipc__mbuf_8c_a989a3e63f7a60fbc46a799ba78576e01}{max\_hdr}} : 0),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01777}01777                                             (atomic ? M\_PKTHDR : 0) |}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01778}01778                                             ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOR) ? M\_EOR : 0));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01779}01779                                 \textcolor{keywordflow}{if} (top == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01780}01780                                         error = EFAULT; \textcolor{comment}{/* only possible error */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01781}01781                                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01782}01782                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01783}01783                                 space -\/= resid -\/ uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01784}01784                                 resid = uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01785}01785                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01786}01786                         \textcolor{keywordflow}{if} (dontroute) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01787}01787                                 SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01788}01788                                 so-\/>so\_options |= SO\_DONTROUTE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01789}01789                                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01790}01790                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01791}01791                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01792}01792 \textcolor{comment}{                         * XXX all the SBS\_CANTSENDMORE checks previously}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01793}01793 \textcolor{comment}{                         * done could be out of date.  We could have received}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01794}01794 \textcolor{comment}{                         * a reset packet in an interrupt or maybe we slept}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01795}01795 \textcolor{comment}{                         * while doing page faults in uiomove() etc.  We}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01796}01796 \textcolor{comment}{                         * could probably recheck again inside the locking}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01797}01797 \textcolor{comment}{                         * protection here, but there are probably other}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01798}01798 \textcolor{comment}{                         * places that this also happens.  We must rethink}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01799}01799 \textcolor{comment}{                         * this.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01800}01800 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01801}01801                         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01802}01802 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01803}01803                         pru\_flag = (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_OOB) ? PRUS\_OOB :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01804}01804                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01805}01805 \textcolor{comment}{                         * If the user set MSG\_EOF, the protocol understands}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01806}01806 \textcolor{comment}{                         * this flag and nothing left to send then use}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01807}01807 \textcolor{comment}{                         * PRU\_SEND\_EOF instead of PRU\_SEND.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01808}01808 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01809}01809                             ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOF) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01810}01810                              (so-\/>so\_proto-\/>pr\_flags \& PR\_IMPLOPCL) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01811}01811                              (resid <= 0)) ?}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01812}01812                                 PRUS\_EOF :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01813}01813                         \textcolor{comment}{/* If there is more to send set PRUS\_MORETOCOME. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01814}01814                             (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_MORETOCOME) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01815}01815                             (resid > 0 \&\& space > 0) ? PRUS\_MORETOCOME : 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01816}01816 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01817}01817 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01818}01818                         pru\_flag |= tls\_pruflag;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01819}01819 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01820}01820 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01821}01821                         error = (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_send)(so,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01822}01822                             pru\_flag, top, \mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}}, control, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01823}01823 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01824}01824                         \textcolor{keywordflow}{if} (dontroute) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01825}01825                                 SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01826}01826                                 so-\/>so\_options \&= \string~SO\_DONTROUTE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01827}01827                                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01828}01828                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01829}01829 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01830}01830 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01831}01831                         \textcolor{keywordflow}{if} (tls != NULL \&\& tls-\/>mode == TCP\_TLS\_MODE\_SW) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01832}01832                                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01833}01833                                         \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(top);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01834}01834                                         top = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01835}01835                                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01836}01836                                         soref(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01837}01837                                         \mbox{\hyperlink{uipc__ktls_8c_a6d1be8e750a71ed913cbca882967dfbb}{ktls\_enqueue}}(top, so, tls\_enq\_cnt);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01838}01838                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01839}01839                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01840}01840 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01841}01841                         clen = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01842}01842                         control = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01843}01843                         top = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01844}01844                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01845}01845                                 \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01846}01846                 \} \textcolor{keywordflow}{while} (resid \&\& space > 0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01847}01847         \} \textcolor{keywordflow}{while} (resid);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01848}01848 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01849}01849 release:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01850}01850         SOCK\_IO\_SEND\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01851}01851 out:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01852}01852 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01853}01853         \textcolor{keywordflow}{if} (tls != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01854}01854                 ktls\_free(tls);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01855}01855 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01856}01856         \textcolor{keywordflow}{if} (top != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01857}01857                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(top);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01858}01858         \textcolor{keywordflow}{if} (control != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01859}01859                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(control);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01860}01860         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01861}01861 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01862}01862 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01863}01863 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01864}\mbox{\hyperlink{uipc__socket_8c_afb62b412daf71b7f58d51e9046ce285b}{01864}} \mbox{\hyperlink{uipc__socket_8c_afb62b412daf71b7f58d51e9046ce285b}{sosend}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *\mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}}, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01865}01865     \textcolor{keyword}{struct} mbuf *top, \textcolor{keyword}{struct} mbuf *control, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01866}01866 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01867}01867         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01868}01868 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01869}01869         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01870}01870         error = so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_sosend(so, \mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}}, uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01871}01871             top, control, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, td);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01872}01872         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01873}01873         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01874}01874 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01875}01875 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01876}01876 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01877}01877 \textcolor{comment}{ * The part of soreceive() that implements reading non-\/inline out-\/of-\/band}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01878}01878 \textcolor{comment}{ * data from a socket.  For more complete comments, see soreceive(), from}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01879}01879 \textcolor{comment}{ * which this code originated.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01880}01880 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01881}01881 \textcolor{comment}{ * Note that soreceive\_rcvoob(), unlike the remainder of soreceive(), is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01882}01882 \textcolor{comment}{ * unable to return an mbuf chain to the caller.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01883}01883 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01884}01884 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01885}\mbox{\hyperlink{uipc__socket_8c_a1a84488eb16148a193fba8ba73f0f8c2}{01885}} \mbox{\hyperlink{uipc__socket_8c_a1a84488eb16148a193fba8ba73f0f8c2}{soreceive\_rcvoob}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} uio *uio, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01886}01886 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01887}01887         \textcolor{keyword}{struct }protosw *\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}} = so-\/>so\_proto;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01888}01888         \textcolor{keyword}{struct }mbuf *m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01889}01889         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01890}01890 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01891}01891         KASSERT(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_OOB, (\textcolor{stringliteral}{"{}soreceive\_rcvoob: (flags \& MSG\_OOB) == 0"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01892}01892         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01893}01893 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01894}01894         m = m\_get(M\_WAITOK, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01895}01895         error = (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_rcvoob)(so, m, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01896}01896         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01897}01897                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01898}01898         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01899}01899                 error = \mbox{\hyperlink{subr__uio_8c_aa4232d34ca9bc2bc4786b368c5de60c9}{uiomove}}(mtod(m, \textcolor{keywordtype}{void} *),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01900}01900                     (\textcolor{keywordtype}{int}) min(uio-\/>uio\_resid, m-\/>m\_len), uio);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01901}01901                 m = m\_free(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01902}01902         \} \textcolor{keywordflow}{while} (uio-\/>uio\_resid \&\& error == 0 \&\& m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01903}01903 bad:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01904}01904         \textcolor{keywordflow}{if} (m != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01905}01905                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01906}01906         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01907}01907 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01908}01908 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01909}01909 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01910}01910 \textcolor{comment}{ * Following replacement or removal of the first mbuf on the first mbuf chain}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01911}01911 \textcolor{comment}{ * of a socket buffer, push necessary state changes back into the socket}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01912}01912 \textcolor{comment}{ * buffer so that other consumers see the values consistently.  'nextrecord'}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01913}01913 \textcolor{comment}{ * is the callers locally stored value of the original value of}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01914}01914 \textcolor{comment}{ * sb-\/>sb\_mb-\/>m\_nextpkt which must be restored when the lead mbuf changes.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01915}01915 \textcolor{comment}{ * NOTE: 'nextrecord' may be NULL.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01916}01916 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01917}01917 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01918}\mbox{\hyperlink{uipc__socket_8c_a6612cf22eca2c37e157231f32053b087}{01918}} \mbox{\hyperlink{uipc__socket_8c_a6612cf22eca2c37e157231f32053b087}{sockbuf\_pushsync}}(\textcolor{keyword}{struct} sockbuf *sb, \textcolor{keyword}{struct} mbuf *nextrecord)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01919}01919 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01920}01920 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01921}01921         SOCKBUF\_LOCK\_ASSERT(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01922}01922         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01923}01923 \textcolor{comment}{         * First, update for the new value of nextrecord.  If necessary, make}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01924}01924 \textcolor{comment}{         * it the first record.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01925}01925 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01926}01926         \textcolor{keywordflow}{if} (sb-\/>sb\_mb != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01927}01927                 sb-\/>sb\_mb-\/>m\_nextpkt = nextrecord;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01928}01928         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01929}01929                 sb-\/>sb\_mb = nextrecord;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01930}01930 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01931}01931         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01932}01932 \textcolor{comment}{         * Now update any dependent socket buffer fields to reflect the new}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01933}01933 \textcolor{comment}{         * state.  This is an expanded inline of SB\_EMPTY\_FIXUP(), with the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01934}01934 \textcolor{comment}{         * addition of a second clause that takes care of the case where}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01935}01935 \textcolor{comment}{         * sb\_mb has been updated, but remains the last record.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01936}01936 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01937}01937         \textcolor{keywordflow}{if} (sb-\/>sb\_mb == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01938}01938                 sb-\/>sb\_mbtail = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01939}01939                 sb-\/>sb\_lastrecord = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01940}01940         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sb-\/>sb\_mb-\/>m\_nextpkt == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01941}01941                 sb-\/>sb\_lastrecord = sb-\/>sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01942}01942 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01943}01943 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01944}01944 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01945}01945 \textcolor{comment}{ * Implement receive operations on a socket.  We depend on the way that}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01946}01946 \textcolor{comment}{ * records are added to the sockbuf by sbappend.  In particular, each record}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01947}01947 \textcolor{comment}{ * (mbufs linked through m\_next) must begin with an address if the protocol}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01948}01948 \textcolor{comment}{ * so specifies, followed by an optional mbuf or mbufs containing ancillary}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01949}01949 \textcolor{comment}{ * data, and then zero or more mbufs of data.  In order to allow parallelism}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01950}01950 \textcolor{comment}{ * between network receive and copying to user space, as well as avoid}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01951}01951 \textcolor{comment}{ * sleeping with a mutex held, we release the socket buffer mutex during the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01952}01952 \textcolor{comment}{ * user space copy.  Although the sockbuf is locked, new data may still be}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01953}01953 \textcolor{comment}{ * appended, and thus we must maintain consistency of the sockbuf during that}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01954}01954 \textcolor{comment}{ * time.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01955}01955 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01956}01956 \textcolor{comment}{ * The caller may receive the data as a single mbuf chain by supplying an}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01957}01957 \textcolor{comment}{ * mbuf **mp0 for use in returning the chain.  The uio is then used only for}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01958}01958 \textcolor{comment}{ * the count in uio\_resid.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01959}01959 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01960}01960 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01961}\mbox{\hyperlink{uipc__socket_8c_aae1b5a2bea7b50b8df452eab1f846888}{01961}} \mbox{\hyperlink{uipc__socket_8c_aae1b5a2bea7b50b8df452eab1f846888}{soreceive\_generic}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **psa, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01962}01962     \textcolor{keyword}{struct} mbuf **mp0, \textcolor{keyword}{struct} mbuf **controlp, \textcolor{keywordtype}{int} *flagsp)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01963}01963 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01964}01964         \textcolor{keyword}{struct }mbuf *m, **mp;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01965}01965         \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, error, offset;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01966}01966         ssize\_t len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01967}01967         \textcolor{keyword}{struct }protosw *\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}} = so-\/>so\_proto;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01968}01968         \textcolor{keyword}{struct }mbuf *nextrecord;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01969}01969         \textcolor{keywordtype}{int} moff, \mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}} = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01970}01970         ssize\_t orig\_resid = uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01971}01971 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01972}01972         mp = mp0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01973}01973         \textcolor{keywordflow}{if} (psa != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01974}01974                 *psa = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01975}01975         \textcolor{keywordflow}{if} (controlp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01976}01976                 *controlp = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01977}01977         \textcolor{keywordflow}{if} (flagsp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01978}01978                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} = *flagsp \&\string~ MSG\_EOR;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01979}01979         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01980}01980                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01981}01981         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_OOB)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01982}01982                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{uipc__socket_8c_a1a84488eb16148a193fba8ba73f0f8c2}{soreceive\_rcvoob}}(so, uio, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01983}01983         \textcolor{keywordflow}{if} (mp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01984}01984                 *mp = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01985}01985         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_WANTRCVD) \&\& (so-\/>so\_state \& SS\_ISCONFIRMING)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01986}01986             \&\& uio-\/>uio\_resid) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01987}01987                 \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01988}01988                 (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_rcvd)(so, 0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01989}01989         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01990}01990 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01991}01991         error = SOCK\_IO\_RECV\_LOCK(so, SBLOCKWAIT(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01992}01992         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01993}01993                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01994}01994 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01995}01995 restart:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01996}01996         SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01997}01997         m = so-\/>so\_rcv.sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01998}01998         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l01999}01999 \textcolor{comment}{         * If we have less data than requested, block awaiting more (subject}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02000}02000 \textcolor{comment}{         * to any timeout) if:}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02001}02001 \textcolor{comment}{         *   1. the current count is less than the low water mark, or}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02002}02002 \textcolor{comment}{         *   2. MSG\_DONTWAIT is not set}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02003}02003 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02004}02004         \textcolor{keywordflow}{if} (m == NULL || (((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_DONTWAIT) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02005}02005             sbavail(\&so-\/>so\_rcv) < uio-\/>uio\_resid) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02006}02006             sbavail(\&so-\/>so\_rcv) < so-\/>so\_rcv.sb\_lowat \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02007}02007             m-\/>m\_nextpkt == NULL \&\& (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_ATOMIC) == 0)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02008}02008                 KASSERT(m != NULL || !sbavail(\&so-\/>so\_rcv),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02009}02009                     (\textcolor{stringliteral}{"{}receive: m == \%p sbavail == \%u"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02010}02010                     m, sbavail(\&so-\/>so\_rcv)));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02011}02011                 \textcolor{keywordflow}{if} (so-\/>so\_error || so-\/>so\_rerror) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02012}02012                         \textcolor{keywordflow}{if} (m != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02013}02013                                 \textcolor{keywordflow}{goto} dontblock;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02014}02014                         \textcolor{keywordflow}{if} (so-\/>so\_error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02015}02015                                 error = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02016}02016                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02017}02017                                 error = so-\/>so\_rerror;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02018}02018                         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02019}02019                                 \textcolor{keywordflow}{if} (so-\/>so\_error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02020}02020                                         so-\/>so\_error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02021}02021                                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02022}02022                                         so-\/>so\_rerror = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02023}02023                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02024}02024                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02025}02025                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02026}02026                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02027}02027                 SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02028}02028                 \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_state \& SBS\_CANTRCVMORE) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02029}02029                         \textcolor{keywordflow}{if} (m != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02030}02030                                 \textcolor{keywordflow}{goto} dontblock;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02031}02031 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02032}02032                         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_tlsdcc == 0 \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02033}02033                             so-\/>so\_rcv.sb\_tlscc == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02034}02034 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02035}02035                         \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02036}02036 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02037}02037                                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02038}02038                                 \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02039}02039                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02040}02040                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02041}02041                 \textcolor{keywordflow}{for} (; m != NULL; m = m-\/>m\_next)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02042}02042                         \textcolor{keywordflow}{if} (m-\/>m\_type == MT\_OOBDATA  || (m-\/>m\_flags \& M\_EOR)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02043}02043                                 m = so-\/>so\_rcv.sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02044}02044                                 \textcolor{keywordflow}{goto} dontblock;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02045}02045                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02046}02046                 \textcolor{keywordflow}{if} ((so-\/>so\_state \& (SS\_ISCONNECTING | SS\_ISCONNECTED |}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02047}02047                     SS\_ISDISCONNECTING | SS\_ISDISCONNECTED)) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02048}02048                     (so-\/>so\_proto-\/>pr\_flags \& PR\_CONNREQUIRED) != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02049}02049                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02050}02050                         error = ENOTCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02051}02051                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02052}02052                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02053}02053                 \textcolor{keywordflow}{if} (uio-\/>uio\_resid == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02054}02054                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02055}02055                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02056}02056                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02057}02057                 \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_NBIO) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02058}02058                     (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& (MSG\_DONTWAIT|MSG\_NBIO))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02059}02059                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02060}02060                         error = EWOULDBLOCK;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02061}02061                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02062}02062                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02063}02063                 SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02064}02064                 SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02065}02065                 error = \mbox{\hyperlink{uipc__sockbuf_8c_a0cd636ed80e189b378257a942318918c}{sbwait}}(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02066}02066                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02067}02067                 \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02068}02068                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02069}02069                 \textcolor{keywordflow}{goto} restart;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02070}02070         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02071}02071 dontblock:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02072}02072         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02073}02073 \textcolor{comment}{         * From this point onward, we maintain 'nextrecord' as a cache of the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02074}02074 \textcolor{comment}{         * pointer to the next record in the socket buffer.  We must keep the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02075}02075 \textcolor{comment}{         * various socket buffer pointers and local stack versions of the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02076}02076 \textcolor{comment}{         * pointers in sync, pushing out modifications before dropping the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02077}02077 \textcolor{comment}{         * socket buffer mutex, and re-\/reading them when picking it up.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02078}02078 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02079}02079 \textcolor{comment}{         * Otherwise, we will race with the network stack appending new data}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02080}02080 \textcolor{comment}{         * or records onto the socket buffer by using inconsistent/stale}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02081}02081 \textcolor{comment}{         * versions of the field, possibly resulting in socket buffer}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02082}02082 \textcolor{comment}{         * corruption.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02083}02083 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02084}02084 \textcolor{comment}{         * By holding the high-\/level sblock(), we prevent simultaneous}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02085}02085 \textcolor{comment}{         * readers from pulling off the front of the socket buffer.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02086}02086 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02087}02087         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02088}02088         \textcolor{keywordflow}{if} (uio-\/>uio\_td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02089}02089                 uio-\/>uio\_td-\/>td\_ru.ru\_msgrcv++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02090}02090         KASSERT(m == so-\/>so\_rcv.sb\_mb, (\textcolor{stringliteral}{"{}soreceive: m != so-\/>so\_rcv.sb\_mb"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02091}02091         SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02092}02092         SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02093}02093         nextrecord = m-\/>m\_nextpkt;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02094}02094         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_ADDR) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02095}02095                 KASSERT(m-\/>m\_type == MT\_SONAME,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02096}02096                     (\textcolor{stringliteral}{"{}m-\/>m\_type == \%d"{}}, m-\/>m\_type));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02097}02097                 orig\_resid = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02098}02098                 \textcolor{keywordflow}{if} (psa != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02099}02099                         *psa = \mbox{\hyperlink{uipc__socket_8c_aca7434add845c908cf772490a53efffe}{sodupsockaddr}}(mtod(m, \textcolor{keyword}{struct} sockaddr *),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02100}02100                             M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02101}02101                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02102}02102                         m = m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02103}02103                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02104}02104                         \mbox{\hyperlink{uipc__sockbuf_8c_a54e1321d218d81ff280426678623e1b9}{sbfree}}(\&so-\/>so\_rcv, m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02105}02105                         so-\/>so\_rcv.sb\_mb = m\_free(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02106}02106                         m = so-\/>so\_rcv.sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02107}02107                         \mbox{\hyperlink{uipc__socket_8c_a6612cf22eca2c37e157231f32053b087}{sockbuf\_pushsync}}(\&so-\/>so\_rcv, nextrecord);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02108}02108                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02109}02109         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02110}02110 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02111}02111         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02112}02112 \textcolor{comment}{         * Process one or more MT\_CONTROL mbufs present before any data mbufs}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02113}02113 \textcolor{comment}{         * in the first mbuf chain on the socket buffer.  If MSG\_PEEK, we}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02114}02114 \textcolor{comment}{         * just copy the data; if !MSG\_PEEK, we call into the protocol to}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02115}02115 \textcolor{comment}{         * perform externalization (or freeing if controlp == NULL).}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02116}02116 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02117}02117         \textcolor{keywordflow}{if} (m != NULL \&\& m-\/>m\_type == MT\_CONTROL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02118}02118                 \textcolor{keyword}{struct }mbuf *cm = NULL, *cmn;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02119}02119                 \textcolor{keyword}{struct }mbuf **cme = \&cm;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02120}02120 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02121}02121                 \textcolor{keyword}{struct }cmsghdr *cmsg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02122}02122                 \textcolor{keyword}{struct }tls\_get\_record tgr;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02123}02123 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02124}02124                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02125}02125 \textcolor{comment}{                 * For MSG\_TLSAPPDATA, check for a non-\/application data}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02126}02126 \textcolor{comment}{                 * record.  If found, return ENXIO without removing}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02127}02127 \textcolor{comment}{                 * it from the receive queue.  This allows a subsequent}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02128}02128 \textcolor{comment}{                 * call without MSG\_TLSAPPDATA to receive it.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02129}02129 \textcolor{comment}{                 * Note that, for TLS, there should only be a single}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02130}02130 \textcolor{comment}{                 * control mbuf with the TLS\_GET\_RECORD message in it.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02131}02131 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02132}02132                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_TLSAPPDATA) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02133}02133                         cmsg = mtod(m, \textcolor{keyword}{struct} cmsghdr *);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02134}02134                         \textcolor{keywordflow}{if} (cmsg-\/>cmsg\_type == TLS\_GET\_RECORD \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02135}02135                             cmsg-\/>cmsg\_len == CMSG\_LEN(\textcolor{keyword}{sizeof}(tgr))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02136}02136                                 memcpy(\&tgr, CMSG\_DATA(cmsg), \textcolor{keyword}{sizeof}(tgr));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02137}02137                                 \textcolor{comment}{/* This will need to change for TLS 1.3. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02138}02138                                 \textcolor{keywordflow}{if} (tgr.tls\_type != TLS\_RLTYPE\_APP) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02139}02139                                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02140}02140                                         error = ENXIO;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02141}02141                                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02142}02142                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02143}02143                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02144}02144                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02145}02145 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02146}02146 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02147}02147                 \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02148}02148                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02149}02149                                 \textcolor{keywordflow}{if} (controlp != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02150}02150                                         *controlp = \mbox{\hyperlink{uipc__mbuf_8c_a3b7ed1e93f0824cf0ca254f6d8b02fac}{m\_copym}}(m, 0, m-\/>m\_len,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02151}02151                                             M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02152}02152                                         controlp = \&(*controlp)-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02153}02153                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02154}02154                                 m = m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02155}02155                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02156}02156                                 \mbox{\hyperlink{uipc__sockbuf_8c_a54e1321d218d81ff280426678623e1b9}{sbfree}}(\&so-\/>so\_rcv, m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02157}02157                                 so-\/>so\_rcv.sb\_mb = m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02158}02158                                 m-\/>m\_next = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02159}02159                                 *cme = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02160}02160                                 cme = \&(*cme)-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02161}02161                                 m = so-\/>so\_rcv.sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02162}02162                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02163}02163                 \} \textcolor{keywordflow}{while} (m != NULL \&\& m-\/>m\_type == MT\_CONTROL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02164}02164                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) == 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02165}02165                         \mbox{\hyperlink{uipc__socket_8c_a6612cf22eca2c37e157231f32053b087}{sockbuf\_pushsync}}(\&so-\/>so\_rcv, nextrecord);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02166}02166                 \textcolor{keywordflow}{while} (cm != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02167}02167                         cmn = cm-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02168}02168                         cm-\/>m\_next = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02169}02169                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_domain-\/>dom\_externalize != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02170}02170                                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02171}02171                                 \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02172}02172                                 error = (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_domain-\/>dom\_externalize)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02173}02173                                     (cm, controlp, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02174}02174                                 SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02175}02175                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (controlp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02176}02176                                 *controlp = cm;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02177}02177                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02178}02178                                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(cm);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02179}02179                         \textcolor{keywordflow}{if} (controlp != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02180}02180                                 \textcolor{keywordflow}{while} (*controlp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02181}02181                                         controlp = \&(*controlp)-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02182}02182                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02183}02183                         cm = cmn;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02184}02184                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02185}02185                 \textcolor{keywordflow}{if} (m != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02186}02186                         nextrecord = so-\/>so\_rcv.sb\_mb-\/>m\_nextpkt;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02187}02187                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02188}02188                         nextrecord = so-\/>so\_rcv.sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02189}02189                 orig\_resid = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02190}02190         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02191}02191         \textcolor{keywordflow}{if} (m != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02192}02192                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02193}02193                         KASSERT(m-\/>m\_nextpkt == nextrecord,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02194}02194                             (\textcolor{stringliteral}{"{}soreceive: post-\/control, nextrecord !sync"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02195}02195                         \textcolor{keywordflow}{if} (nextrecord == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02196}02196                                 KASSERT(so-\/>so\_rcv.sb\_mb == m,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02197}02197                                     (\textcolor{stringliteral}{"{}soreceive: post-\/control, sb\_mb!=m"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02198}02198                                 KASSERT(so-\/>so\_rcv.sb\_lastrecord == m,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02199}02199                                     (\textcolor{stringliteral}{"{}soreceive: post-\/control, lastrecord!=m"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02200}02200                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02201}02201                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02202}02202                 \mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}} = m-\/>m\_type;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02203}02203                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}} == MT\_OOBDATA)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02204}02204                         \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} |= MSG\_OOB;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02205}02205         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02206}02206                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02207}02207                         KASSERT(so-\/>so\_rcv.sb\_mb == nextrecord,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02208}02208                             (\textcolor{stringliteral}{"{}soreceive: sb\_mb != nextrecord"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02209}02209                         \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_mb == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02210}02210                                 KASSERT(so-\/>so\_rcv.sb\_lastrecord == NULL,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02211}02211                                     (\textcolor{stringliteral}{"{}soreceive: sb\_lastercord != NULL"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02212}02212                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02213}02213                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02214}02214         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02215}02215         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02216}02216         SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02217}02217         SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02218}02218 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02219}02219         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02220}02220 \textcolor{comment}{         * Now continue to read any data mbufs off of the head of the socket}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02221}02221 \textcolor{comment}{         * buffer until the read request is satisfied.  Note that 'type' is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02222}02222 \textcolor{comment}{         * used to store the type of any mbuf reads that have happened so far}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02223}02223 \textcolor{comment}{         * such that soreceive() can stop reading if the type changes, which}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02224}02224 \textcolor{comment}{         * causes soreceive() to return only one of regular data and inline}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02225}02225 \textcolor{comment}{         * out-\/of-\/band data in a single socket receive operation.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02226}02226 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02227}02227         moff = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02228}02228         offset = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02229}02229         \textcolor{keywordflow}{while} (m != NULL \&\& !(m-\/>m\_flags \& M\_NOTAVAIL) \&\& uio-\/>uio\_resid > 0}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02230}02230             \&\& error == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02231}02231                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02232}02232 \textcolor{comment}{                 * If the type of mbuf has changed since the last mbuf}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02233}02233 \textcolor{comment}{                 * examined ('type'), end the receive operation.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02234}02234 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02235}02235                 SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02236}02236                 \textcolor{keywordflow}{if} (m-\/>m\_type == MT\_OOBDATA || m-\/>m\_type == MT\_CONTROL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02237}02237                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}} != m-\/>m\_type)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02238}02238                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02239}02239                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__BUS_ga0141f9c2e01a93ce25d669aa4851ec87}{type}} == MT\_OOBDATA)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02240}02240                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02241}02241                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02242}02242                     KASSERT(m-\/>m\_type == MT\_DATA,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02243}02243                         (\textcolor{stringliteral}{"{}m-\/>m\_type == \%d"{}}, m-\/>m\_type));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02244}02244                 so-\/>so\_rcv.sb\_state \&= \string~SBS\_RCVATMARK;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02245}02245                 len = uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02246}02246                 \textcolor{keywordflow}{if} (so-\/>so\_oobmark \&\& len > so-\/>so\_oobmark -\/ offset)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02247}02247                         len = so-\/>so\_oobmark -\/ offset;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02248}02248                 \textcolor{keywordflow}{if} (len > m-\/>m\_len -\/ moff)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02249}02249                         len = m-\/>m\_len -\/ moff;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02250}02250                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02251}02251 \textcolor{comment}{                 * If mp is set, just pass back the mbufs.  Otherwise copy}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02252}02252 \textcolor{comment}{                 * them out via the uio, then free.  Sockbuf must be}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02253}02253 \textcolor{comment}{                 * consistent here (points to current mbuf, it points to next}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02254}02254 \textcolor{comment}{                 * record) when we drop priority; we must note any additions}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02255}02255 \textcolor{comment}{                 * to the sockbuf when we block interrupts again.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02256}02256 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02257}02257                 \textcolor{keywordflow}{if} (mp == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02258}02258                         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02259}02259                         SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02260}02260                         SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02261}02261                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02262}02262                         \textcolor{keywordflow}{if} ((m-\/>m\_flags \& M\_EXTPG) != 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02263}02263                                 error = \mbox{\hyperlink{uipc__mbuf_8c_a297239c57024f2a5bb601f0d5a38a8f0}{m\_unmapped\_uiomove}}(m, moff, uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02264}02264                                     (\textcolor{keywordtype}{int})len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02265}02265                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02266}02266                                 error = \mbox{\hyperlink{subr__uio_8c_aa4232d34ca9bc2bc4786b368c5de60c9}{uiomove}}(mtod(m, \textcolor{keywordtype}{char} *) + moff,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02267}02267                                     (\textcolor{keywordtype}{int})len, uio);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02268}02268                         SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02269}02269                         \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02270}02270                                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02271}02271 \textcolor{comment}{                                 * The MT\_SONAME mbuf has already been removed}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02272}02272 \textcolor{comment}{                                 * from the record, so it is necessary to}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02273}02273 \textcolor{comment}{                                 * remove the data mbufs, if any, to preserve}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02274}02274 \textcolor{comment}{                                 * the invariant in the case of PR\_ADDR that}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02275}02275 \textcolor{comment}{                                 * requires MT\_SONAME mbufs at the head of}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02276}02276 \textcolor{comment}{                                 * each record.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02277}02277 \textcolor{comment}{                                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02278}02278                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_ATOMIC \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02279}02279                                     ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) == 0))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02280}02280                                         (void)\mbox{\hyperlink{uipc__sockbuf_8c_ab74ef29886f69c16ede1f9b245fbadee}{sbdroprecord\_locked}}(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02281}02281                                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02282}02282                                 \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02283}02283                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02284}02284                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02285}02285                         uio-\/>uio\_resid -\/= len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02286}02286                 SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02287}02287                 \textcolor{keywordflow}{if} (len == m-\/>m\_len -\/ moff) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02288}02288                         \textcolor{keywordflow}{if} (m-\/>m\_flags \& M\_EOR)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02289}02289                                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} |= MSG\_EOR;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02290}02290                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02291}02291                                 m = m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02292}02292                                 moff = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02293}02293                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02294}02294                                 nextrecord = m-\/>m\_nextpkt;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02295}02295                                 \mbox{\hyperlink{uipc__sockbuf_8c_a54e1321d218d81ff280426678623e1b9}{sbfree}}(\&so-\/>so\_rcv, m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02296}02296                                 \textcolor{keywordflow}{if} (mp != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02297}02297                                         m-\/>m\_nextpkt = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02298}02298                                         *mp = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02299}02299                                         mp = \&m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02300}02300                                         so-\/>so\_rcv.sb\_mb = m = m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02301}02301                                         *mp = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02302}02302                                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02303}02303                                         so-\/>so\_rcv.sb\_mb = m\_free(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02304}02304                                         m = so-\/>so\_rcv.sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02305}02305                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02306}02306                                 \mbox{\hyperlink{uipc__socket_8c_a6612cf22eca2c37e157231f32053b087}{sockbuf\_pushsync}}(\&so-\/>so\_rcv, nextrecord);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02307}02307                                 SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02308}02308                                 SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02309}02309                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02310}02310                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02311}02311                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02312}02312                                 moff += len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02313}02313                         \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02314}02314                                 \textcolor{keywordflow}{if} (mp != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02315}02315                                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_DONTWAIT) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02316}02316                                                 *mp = \mbox{\hyperlink{uipc__mbuf_8c_a3b7ed1e93f0824cf0ca254f6d8b02fac}{m\_copym}}(m, 0, len,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02317}02317                                                     M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02318}02318                                                 \textcolor{keywordflow}{if} (*mp == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02319}02319                                                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02320}02320 \textcolor{comment}{                                                         * m\_copym() couldn't}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02321}02321 \textcolor{comment}{                                                         * allocate an mbuf.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02322}02322 \textcolor{comment}{                                                         * Adjust uio\_resid back}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02323}02323 \textcolor{comment}{                                                         * (it was adjusted}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02324}02324 \textcolor{comment}{                                                         * down by len bytes,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02325}02325 \textcolor{comment}{                                                         * which we didn't end}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02326}02326 \textcolor{comment}{                                                         * up "{}copying"{} over).}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02327}02327 \textcolor{comment}{                                                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02328}02328                                                         uio-\/>uio\_resid += len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02329}02329                                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02330}02330                                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02331}02331                                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02332}02332                                                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02333}02333                                                 *mp = \mbox{\hyperlink{uipc__mbuf_8c_a3b7ed1e93f0824cf0ca254f6d8b02fac}{m\_copym}}(m, 0, len,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02334}02334                                                     M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02335}02335                                                 SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02336}02336                                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02337}02337                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02338}02338                                 \mbox{\hyperlink{uipc__sockbuf_8c_ac4c4ddf427ccbdc4b61724aac9560a05}{sbcut\_locked}}(\&so-\/>so\_rcv, len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02339}02339                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02340}02340                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02341}02341                 SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02342}02342                 \textcolor{keywordflow}{if} (so-\/>so\_oobmark) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02343}02343                         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02344}02344                                 so-\/>so\_oobmark -\/= len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02345}02345                                 \textcolor{keywordflow}{if} (so-\/>so\_oobmark == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02346}02346                                         so-\/>so\_rcv.sb\_state |= SBS\_RCVATMARK;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02347}02347                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02348}02348                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02349}02349                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02350}02350                                 offset += len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02351}02351                                 \textcolor{keywordflow}{if} (offset == so-\/>so\_oobmark)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02352}02352                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02353}02353                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02354}02354                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02355}02355                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOR)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02356}02356                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02357}02357                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02358}02358 \textcolor{comment}{                 * If the MSG\_WAITALL flag is set (for non-\/atomic socket), we}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02359}02359 \textcolor{comment}{                 * must not quit until "{}uio-\/>uio\_resid == 0"{} or an error}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02360}02360 \textcolor{comment}{                 * termination.  If a signal/timeout occurs, return with a}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02361}02361 \textcolor{comment}{                 * short count but without error.  Keep sockbuf locked}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02362}02362 \textcolor{comment}{                 * against other readers.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02363}02363 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02364}02364                 \textcolor{keywordflow}{while} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_WAITALL \&\& m == NULL \&\& uio-\/>uio\_resid > 0 \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02365}02365                     !sosendallatonce(so) \&\& nextrecord == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02366}02366                         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02367}02367                         \textcolor{keywordflow}{if} (so-\/>so\_error || so-\/>so\_rerror ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02368}02368                             so-\/>so\_rcv.sb\_state \& SBS\_CANTRCVMORE)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02369}02369                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02370}02370                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02371}02371 \textcolor{comment}{                         * Notify the protocol that some data has been}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02372}02372 \textcolor{comment}{                         * drained before blocking.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02373}02373 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02374}02374                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_WANTRCVD) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02375}02375                                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02376}02376                                 \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02377}02377                                 (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_rcvd)(so, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02378}02378                                 SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02379}02379                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02380}02380                         SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02381}02381                         SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02382}02382                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02383}02383 \textcolor{comment}{                         * We could receive some data while was notifying}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02384}02384 \textcolor{comment}{                         * the protocol. Skip blocking in this case.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02385}02385 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02386}02386                         \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_mb == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02387}02387                                 error = \mbox{\hyperlink{uipc__sockbuf_8c_a0cd636ed80e189b378257a942318918c}{sbwait}}(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02388}02388                                 \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02389}02389                                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02390}02390                                         \textcolor{keywordflow}{goto} release;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02391}02391                                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02392}02392                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02393}02393                         m = so-\/>so\_rcv.sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02394}02394                         \textcolor{keywordflow}{if} (m != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02395}02395                                 nextrecord = m-\/>m\_nextpkt;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02396}02396                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02397}02397         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02398}02398 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02399}02399         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02400}02400         \textcolor{keywordflow}{if} (m != NULL \&\& \mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_ATOMIC) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02401}02401                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} |= MSG\_TRUNC;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02402}02402                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) == 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02403}02403                         (void) \mbox{\hyperlink{uipc__sockbuf_8c_ab74ef29886f69c16ede1f9b245fbadee}{sbdroprecord\_locked}}(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02404}02404         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02405}02405         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02406}02406                 \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02407}02407                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02408}02408 \textcolor{comment}{                         * First part is an inline SB\_EMPTY\_FIXUP().  Second}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02409}02409 \textcolor{comment}{                         * part makes sure sb\_lastrecord is up-\/to-\/date if}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02410}02410 \textcolor{comment}{                         * there is still data in the socket buffer.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02411}02411 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02412}02412                         so-\/>so\_rcv.sb\_mb = nextrecord;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02413}02413                         \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_mb == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02414}02414                                 so-\/>so\_rcv.sb\_mbtail = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02415}02415                                 so-\/>so\_rcv.sb\_lastrecord = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02416}02416                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nextrecord-\/>m\_nextpkt == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02417}02417                                 so-\/>so\_rcv.sb\_lastrecord = nextrecord;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02418}02418                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02419}02419                 SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02420}02420                 SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02421}02421                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02422}02422 \textcolor{comment}{                 * If soreceive() is being done from the socket callback,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02423}02423 \textcolor{comment}{                 * then don't need to generate ACK to peer to update window,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02424}02424 \textcolor{comment}{                 * since ACK will be generated on return to TCP.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02425}02425 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02426}02426                 \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_SOCALLBCK) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02427}02427                     (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_WANTRCVD)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02428}02428                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02429}02429                         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02430}02430                         (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_rcvd)(so, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02431}02431                         SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02432}02432                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02433}02433         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02434}02434         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02435}02435         \textcolor{keywordflow}{if} (orig\_resid == uio-\/>uio\_resid \&\& orig\_resid \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02436}02436             (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_EOR) == 0 \&\& (so-\/>so\_rcv.sb\_state \& SBS\_CANTRCVMORE) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02437}02437                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02438}02438                 \textcolor{keywordflow}{goto} restart;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02439}02439         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02440}02440         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02441}02441 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02442}02442         \textcolor{keywordflow}{if} (flagsp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02443}02443                 *flagsp |= \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02444}02444 release:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02445}02445         SOCK\_IO\_RECV\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02446}02446         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02447}02447 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02448}02448 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02449}02449 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02450}02450 \textcolor{comment}{ * Optimized version of soreceive() for stream (TCP) sockets.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02451}02451 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02452}02452 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02453}\mbox{\hyperlink{uipc__socket_8c_a3164746c49874cfb3bbb0d438b947156}{02453}} \mbox{\hyperlink{uipc__socket_8c_a3164746c49874cfb3bbb0d438b947156}{soreceive\_stream}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **psa, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02454}02454     \textcolor{keyword}{struct} mbuf **mp0, \textcolor{keyword}{struct} mbuf **controlp, \textcolor{keywordtype}{int} *flagsp)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02455}02455 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02456}02456         \textcolor{keywordtype}{int} len = 0, error = 0, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, oresid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02457}02457         \textcolor{keyword}{struct }sockbuf *sb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02458}02458         \textcolor{keyword}{struct }mbuf *m, *n = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02459}02459 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02460}02460         \textcolor{comment}{/* We only do stream sockets. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02461}02461         \textcolor{keywordflow}{if} (so-\/>so\_type != SOCK\_STREAM)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02462}02462                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02463}02463         \textcolor{keywordflow}{if} (psa != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02464}02464                 *psa = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02465}02465         \textcolor{keywordflow}{if} (flagsp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02466}02466                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} = *flagsp \&\string~ MSG\_EOR;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02467}02467         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02468}02468                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02469}02469         \textcolor{keywordflow}{if} (controlp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02470}02470                 *controlp = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02471}02471         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_OOB)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02472}02472                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{uipc__socket_8c_a1a84488eb16148a193fba8ba73f0f8c2}{soreceive\_rcvoob}}(so, uio, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02473}02473         \textcolor{keywordflow}{if} (mp0 != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02474}02474                 *mp0 = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02475}02475 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02476}02476         sb = \&so-\/>so\_rcv;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02477}02477 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02478}02478 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02479}02479         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02480}02480 \textcolor{comment}{         * KTLS store TLS records as records with a control message to}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02481}02481 \textcolor{comment}{         * describe the framing.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02482}02482 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02483}02483 \textcolor{comment}{         * We check once here before acquiring locks to optimize the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02484}02484 \textcolor{comment}{         * common case.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02485}02485 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02486}02486         \textcolor{keywordflow}{if} (sb-\/>sb\_tls\_info != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02487}02487                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{uipc__socket_8c_aae1b5a2bea7b50b8df452eab1f846888}{soreceive\_generic}}(so, psa, uio, mp0, controlp,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02488}02488                     flagsp));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02489}02489 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02490}02490 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02491}02491         \textcolor{comment}{/* Prevent other readers from entering the socket. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02492}02492         error = SOCK\_IO\_RECV\_LOCK(so, SBLOCKWAIT(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02493}02493         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02494}02494                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02495}02495         SOCKBUF\_LOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02496}02496 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02497}02497 \textcolor{preprocessor}{\#ifdef KERN\_TLS}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02498}02498         \textcolor{keywordflow}{if} (sb-\/>sb\_tls\_info != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02499}02499                 SOCKBUF\_UNLOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02500}02500                 SOCK\_IO\_RECV\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02501}02501                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{uipc__socket_8c_aae1b5a2bea7b50b8df452eab1f846888}{soreceive\_generic}}(so, psa, uio, mp0, controlp,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02502}02502                     flagsp));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02503}02503         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02504}02504 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02505}02505 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02506}02506         \textcolor{comment}{/* Easy one, no space to copyout anything. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02507}02507         \textcolor{keywordflow}{if} (uio-\/>uio\_resid == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02508}02508                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02509}02509                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02510}02510         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02511}02511         oresid = uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02512}02512 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02513}02513         \textcolor{comment}{/* We will never ever get anything unless we are or were connected. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02514}02514         \textcolor{keywordflow}{if} (!(so-\/>so\_state \& (SS\_ISCONNECTED|SS\_ISDISCONNECTED))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02515}02515                 error = ENOTCONN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02516}02516                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02517}02517         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02518}02518 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02519}02519 restart:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02520}02520         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02521}02521 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02522}02522         \textcolor{comment}{/* Abort if socket has reported problems. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02523}02523         \textcolor{keywordflow}{if} (so-\/>so\_error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02524}02524                 \textcolor{keywordflow}{if} (sbavail(sb) > 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02525}02525                         \textcolor{keywordflow}{goto} deliver;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02526}02526                 \textcolor{keywordflow}{if} (oresid > uio-\/>uio\_resid)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02527}02527                         \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02528}02528                 error = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02529}02529                 \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02530}02530                         so-\/>so\_error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02531}02531                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02532}02532         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02533}02533 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02534}02534         \textcolor{comment}{/* Door is closed.  Deliver what is left, if any. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02535}02535         \textcolor{keywordflow}{if} (sb-\/>sb\_state \& SBS\_CANTRCVMORE) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02536}02536                 \textcolor{keywordflow}{if} (sbavail(sb) > 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02537}02537                         \textcolor{keywordflow}{goto} deliver;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02538}02538                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02539}02539                         \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02540}02540         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02541}02541 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02542}02542         \textcolor{comment}{/* Socket buffer is empty and we shall not block. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02543}02543         \textcolor{keywordflow}{if} (sbavail(sb) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02544}02544             ((so-\/>so\_state \& SS\_NBIO) || (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& (MSG\_DONTWAIT|MSG\_NBIO)))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02545}02545                 error = EAGAIN;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02546}02546                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02547}02547         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02548}02548 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02549}02549         \textcolor{comment}{/* Socket buffer got some data that we shall deliver now. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02550}02550         \textcolor{keywordflow}{if} (sbavail(sb) > 0 \&\& !(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_WAITALL) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02551}02551             ((so-\/>so\_state \& SS\_NBIO) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02552}02552              (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& (MSG\_DONTWAIT|MSG\_NBIO)) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02553}02553              sbavail(sb) >= sb-\/>sb\_lowat ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02554}02554              sbavail(sb) >= uio-\/>uio\_resid ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02555}02555              sbavail(sb) >= sb-\/>sb\_hiwat) ) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02556}02556                 \textcolor{keywordflow}{goto} deliver;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02557}02557         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02558}02558 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02559}02559         \textcolor{comment}{/* On MSG\_WAITALL we must wait until all data or error arrives. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02560}02560         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_WAITALL) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02561}02561             (sbavail(sb) >= uio-\/>uio\_resid || sbavail(sb) >= sb-\/>sb\_hiwat))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02562}02562                 \textcolor{keywordflow}{goto} deliver;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02563}02563 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02564}02564         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02565}02565 \textcolor{comment}{         * Wait and block until (more) data comes in.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02566}02566 \textcolor{comment}{         * NB: Drops the sockbuf lock during wait.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02567}02567 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02568}02568         error = \mbox{\hyperlink{uipc__sockbuf_8c_a0cd636ed80e189b378257a942318918c}{sbwait}}(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02569}02569         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02570}02570                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02571}02571         \textcolor{keywordflow}{goto} restart;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02572}02572 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02573}02573 deliver:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02574}02574         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02575}02575         KASSERT(sbavail(sb) > 0, (\textcolor{stringliteral}{"{}\%s: sockbuf empty"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02576}02576         KASSERT(sb-\/>sb\_mb != NULL, (\textcolor{stringliteral}{"{}\%s: sb\_mb == NULL"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02577}02577 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02578}02578         \textcolor{comment}{/* Statistics. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02579}02579         \textcolor{keywordflow}{if} (uio-\/>uio\_td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02580}02580                 uio-\/>uio\_td-\/>td\_ru.ru\_msgrcv++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02581}02581 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02582}02582         \textcolor{comment}{/* Fill uio until full or current end of socket buffer is reached. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02583}02583         len = min(uio-\/>uio\_resid, sbavail(sb));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02584}02584         \textcolor{keywordflow}{if} (mp0 != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02585}02585                 \textcolor{comment}{/* Dequeue as many mbufs as possible. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02586}02586                 \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) \&\& len >= sb-\/>sb\_mb-\/>m\_len) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02587}02587                         \textcolor{keywordflow}{if} (*mp0 == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02588}02588                                 *mp0 = sb-\/>sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02589}02589                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02590}02590                                 \mbox{\hyperlink{uipc__mbuf_8c_a370215355e4f2c95d7aa53b2608db4c6}{m\_cat}}(*mp0, sb-\/>sb\_mb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02591}02591                         \textcolor{keywordflow}{for} (m = sb-\/>sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02592}02592                              m != NULL \&\& m-\/>m\_len <= len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02593}02593                              m = m-\/>m\_next) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02594}02594                                 KASSERT(!(m-\/>m\_flags \& M\_NOTAVAIL),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02595}02595                                     (\textcolor{stringliteral}{"{}\%s: m \%p not available"{}}, \_\_func\_\_, m));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02596}02596                                 len -\/= m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02597}02597                                 uio-\/>uio\_resid -\/= m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02598}02598                                 \mbox{\hyperlink{uipc__sockbuf_8c_a54e1321d218d81ff280426678623e1b9}{sbfree}}(sb, m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02599}02599                                 n = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02600}02600                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02601}02601                         n-\/>m\_next = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02602}02602                         sb-\/>sb\_mb = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02603}02603                         sb-\/>sb\_lastrecord = sb-\/>sb\_mb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02604}02604                         \textcolor{keywordflow}{if} (sb-\/>sb\_mb == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02605}02605                                 SB\_EMPTY\_FIXUP(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02606}02606                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02607}02607                 \textcolor{comment}{/* Copy the remainder. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02608}02608                 \textcolor{keywordflow}{if} (len > 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02609}02609                         KASSERT(sb-\/>sb\_mb != NULL,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02610}02610                             (\textcolor{stringliteral}{"{}\%s: len > 0 \&\& sb-\/>sb\_mb empty"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02611}02611 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02612}02612                         m = \mbox{\hyperlink{uipc__mbuf_8c_a3b7ed1e93f0824cf0ca254f6d8b02fac}{m\_copym}}(sb-\/>sb\_mb, 0, len, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02613}02613                         \textcolor{keywordflow}{if} (m == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02614}02614                                 len = 0;        \textcolor{comment}{/* Don't flush data from sockbuf. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02615}02615                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02616}02616                                 uio-\/>uio\_resid -\/= len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02617}02617                         \textcolor{keywordflow}{if} (*mp0 != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02618}02618                                 \mbox{\hyperlink{uipc__mbuf_8c_a370215355e4f2c95d7aa53b2608db4c6}{m\_cat}}(*mp0, m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02619}02619                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02620}02620                                 *mp0 = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02621}02621                         \textcolor{keywordflow}{if} (*mp0 == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02622}02622                                 error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02623}02623                                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02624}02624                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02625}02625                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02626}02626         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02627}02627                 \textcolor{comment}{/* NB: Must unlock socket buffer as uiomove may sleep. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02628}02628                 SOCKBUF\_UNLOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02629}02629                 error = \mbox{\hyperlink{uipc__mbuf_8c_a4cc606888adbcd2d20dc6e266ea9f978}{m\_mbuftouio}}(uio, sb-\/>sb\_mb, len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02630}02630                 SOCKBUF\_LOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02631}02631                 \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02632}02632                         \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02633}02633         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02634}02634         SBLASTRECORDCHK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02635}02635         SBLASTMBUFCHK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02636}02636 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02637}02637         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02638}02638 \textcolor{comment}{         * Remove the delivered data from the socket buffer unless we}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02639}02639 \textcolor{comment}{         * were only peeking.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02640}02640 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02641}02641         \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02642}02642                 \textcolor{keywordflow}{if} (len > 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02643}02643                         \mbox{\hyperlink{uipc__sockbuf_8c_ac5962acfd53a7362a6189a55a2ded68a}{sbdrop\_locked}}(sb, len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02644}02644 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02645}02645                 \textcolor{comment}{/* Notify protocol that we drained some data. */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02646}02646                 \textcolor{keywordflow}{if} ((so-\/>so\_proto-\/>pr\_flags \& PR\_WANTRCVD) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02647}02647                     (((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_WAITALL) \&\& uio-\/>uio\_resid > 0) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02648}02648                      !(\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_SOCALLBCK))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02649}02649                         SOCKBUF\_UNLOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02650}02650                         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02651}02651                         (*so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_rcvd)(so, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02652}02652                         SOCKBUF\_LOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02653}02653                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02654}02654         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02655}02655 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02656}02656         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02657}02657 \textcolor{comment}{         * For MSG\_WAITALL we may have to loop again and wait for}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02658}02658 \textcolor{comment}{         * more data to come in.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02659}02659 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02660}02660         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_WAITALL) \&\& uio-\/>uio\_resid > 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02661}02661                 \textcolor{keywordflow}{goto} restart;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02662}02662 out:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02663}02663         SBLASTRECORDCHK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02664}02664         SBLASTMBUFCHK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02665}02665         SOCKBUF\_UNLOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02666}02666         SOCK\_IO\_RECV\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02667}02667         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02668}02668 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02669}02669 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02670}02670 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02671}02671 \textcolor{comment}{ * Optimized version of soreceive() for simple datagram cases from userspace.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02672}02672 \textcolor{comment}{ * Unlike in the stream case, we're able to drop a datagram if copyout()}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02673}02673 \textcolor{comment}{ * fails, and because we handle datagrams atomically, we don't need to use a}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02674}02674 \textcolor{comment}{ * sleep lock to prevent I/O interlacing.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02675}02675 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02676}02676 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02677}\mbox{\hyperlink{uipc__socket_8c_ae3cd5338ea95c242644a1a6c10eaa8c6}{02677}} \mbox{\hyperlink{uipc__socket_8c_ae3cd5338ea95c242644a1a6c10eaa8c6}{soreceive\_dgram}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **psa, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02678}02678     \textcolor{keyword}{struct} mbuf **mp0, \textcolor{keyword}{struct} mbuf **controlp, \textcolor{keywordtype}{int} *flagsp)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02679}02679 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02680}02680         \textcolor{keyword}{struct }mbuf *m, *m2;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02681}02681         \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02682}02682         ssize\_t len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02683}02683         \textcolor{keyword}{struct }protosw *\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}} = so-\/>so\_proto;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02684}02684         \textcolor{keyword}{struct }mbuf *nextrecord;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02685}02685 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02686}02686         \textcolor{keywordflow}{if} (psa != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02687}02687                 *psa = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02688}02688         \textcolor{keywordflow}{if} (controlp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02689}02689                 *controlp = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02690}02690         \textcolor{keywordflow}{if} (flagsp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02691}02691                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} = *flagsp \&\string~ MSG\_EOR;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02692}02692         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02693}02693                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02694}02694 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02695}02695         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02696}02696 \textcolor{comment}{         * For any complicated cases, fall back to the full}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02697}02697 \textcolor{comment}{         * soreceive\_generic().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02698}02698 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02699}02699         \textcolor{keywordflow}{if} (mp0 != NULL || (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_PEEK) || (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& MSG\_OOB))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02700}02700                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{uipc__socket_8c_aae1b5a2bea7b50b8df452eab1f846888}{soreceive\_generic}}(so, psa, uio, mp0, controlp,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02701}02701                     flagsp));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02702}02702 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02703}02703         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02704}02704 \textcolor{comment}{         * Enforce restrictions on use.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02705}02705 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02706}02706         KASSERT((\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_WANTRCVD) == 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02707}02707             (\textcolor{stringliteral}{"{}soreceive\_dgram: wantrcvd"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02708}02708         KASSERT(\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_ATOMIC, (\textcolor{stringliteral}{"{}soreceive\_dgram: !atomic"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02709}02709         KASSERT((so-\/>so\_rcv.sb\_state \& SBS\_RCVATMARK) == 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02710}02710             (\textcolor{stringliteral}{"{}soreceive\_dgram: SBS\_RCVATMARK"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02711}02711         KASSERT((so-\/>so\_proto-\/>pr\_flags \& PR\_CONNREQUIRED) == 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02712}02712             (\textcolor{stringliteral}{"{}soreceive\_dgram: P\_CONNREQUIRED"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02713}02713 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02714}02714         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02715}02715 \textcolor{comment}{         * Loop blocking while waiting for a datagram.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02716}02716 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02717}02717         SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02718}02718         \textcolor{keywordflow}{while} ((m = so-\/>so\_rcv.sb\_mb) == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02719}02719                 KASSERT(sbavail(\&so-\/>so\_rcv) == 0,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02720}02720                     (\textcolor{stringliteral}{"{}soreceive\_dgram: sb\_mb NULL but sbavail \%u"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02721}02721                     sbavail(\&so-\/>so\_rcv)));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02722}02722                 \textcolor{keywordflow}{if} (so-\/>so\_error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02723}02723                         error = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02724}02724                         so-\/>so\_error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02725}02725                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02726}02726                         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02727}02727                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02728}02728                 \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_state \& SBS\_CANTRCVMORE ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02729}02729                     uio-\/>uio\_resid == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02730}02730                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02731}02731                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02732}02732                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02733}02733                 \textcolor{keywordflow}{if} ((so-\/>so\_state \& SS\_NBIO) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02734}02734                     (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& (MSG\_DONTWAIT|MSG\_NBIO))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02735}02735                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02736}02736                         \textcolor{keywordflow}{return} (EWOULDBLOCK);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02737}02737                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02738}02738                 SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02739}02739                 SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02740}02740                 error = \mbox{\hyperlink{uipc__sockbuf_8c_a0cd636ed80e189b378257a942318918c}{sbwait}}(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02741}02741                 \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02742}02742                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02743}02743                         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02744}02744                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02745}02745         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02746}02746         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02747}02747 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02748}02748         \textcolor{keywordflow}{if} (uio-\/>uio\_td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02749}02749                 uio-\/>uio\_td-\/>td\_ru.ru\_msgrcv++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02750}02750         SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02751}02751         SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02752}02752         nextrecord = m-\/>m\_nextpkt;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02753}02753         \textcolor{keywordflow}{if} (nextrecord == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02754}02754                 KASSERT(so-\/>so\_rcv.sb\_lastrecord == m,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02755}02755                     (\textcolor{stringliteral}{"{}soreceive\_dgram: lastrecord != m"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02756}02756         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02757}02757 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02758}02758         KASSERT(so-\/>so\_rcv.sb\_mb-\/>m\_nextpkt == nextrecord,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02759}02759             (\textcolor{stringliteral}{"{}soreceive\_dgram: m\_nextpkt != nextrecord"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02760}02760 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02761}02761         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02762}02762 \textcolor{comment}{         * Pull 'm' and its chain off the front of the packet queue.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02763}02763 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02764}02764         so-\/>so\_rcv.sb\_mb = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02765}02765         \mbox{\hyperlink{uipc__socket_8c_a6612cf22eca2c37e157231f32053b087}{sockbuf\_pushsync}}(\&so-\/>so\_rcv, nextrecord);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02766}02766 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02767}02767         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02768}02768 \textcolor{comment}{         * Walk 'm's chain and free that many bytes from the socket buffer.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02769}02769 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02770}02770         \textcolor{keywordflow}{for} (m2 = m; m2 != NULL; m2 = m2-\/>m\_next)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02771}02771                 \mbox{\hyperlink{uipc__sockbuf_8c_a54e1321d218d81ff280426678623e1b9}{sbfree}}(\&so-\/>so\_rcv, m2);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02772}02772 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02773}02773         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02774}02774 \textcolor{comment}{         * Do a few last checks before we let go of the lock.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02775}02775 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02776}02776         SBLASTRECORDCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02777}02777         SBLASTMBUFCHK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02778}02778         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02779}02779 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02780}02780         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_ADDR) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02781}02781                 KASSERT(m-\/>m\_type == MT\_SONAME,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02782}02782                     (\textcolor{stringliteral}{"{}m-\/>m\_type == \%d"{}}, m-\/>m\_type));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02783}02783                 \textcolor{keywordflow}{if} (psa != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02784}02784                         *psa = \mbox{\hyperlink{uipc__socket_8c_aca7434add845c908cf772490a53efffe}{sodupsockaddr}}(mtod(m, \textcolor{keyword}{struct} sockaddr *),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02785}02785                             M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02786}02786                 m = m\_free(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02787}02787         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02788}02788         \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02789}02789                 \textcolor{comment}{/* XXXRW: Can this happen? */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02790}02790                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02791}02791         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02792}02792 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02793}02793         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02794}02794 \textcolor{comment}{         * Packet to copyout() is now in 'm' and it is disconnected from the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02795}02795 \textcolor{comment}{         * queue.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02796}02796 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02797}02797 \textcolor{comment}{         * Process one or more MT\_CONTROL mbufs present before any data mbufs}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02798}02798 \textcolor{comment}{         * in the first mbuf chain on the socket buffer.  We call into the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02799}02799 \textcolor{comment}{         * protocol to perform externalization (or freeing if controlp ==}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02800}02800 \textcolor{comment}{         * NULL). In some cases there can be only MT\_CONTROL mbufs without}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02801}02801 \textcolor{comment}{         * MT\_DATA mbufs.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02802}02802 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02803}02803         \textcolor{keywordflow}{if} (m-\/>m\_type == MT\_CONTROL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02804}02804                 \textcolor{keyword}{struct }mbuf *cm = NULL, *cmn;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02805}02805                 \textcolor{keyword}{struct }mbuf **cme = \&cm;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02806}02806 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02807}02807                 \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02808}02808                         m2 = m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02809}02809                         m-\/>m\_next = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02810}02810                         *cme = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02811}02811                         cme = \&(*cme)-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02812}02812                         m = m2;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02813}02813                 \} \textcolor{keywordflow}{while} (m != NULL \&\& m-\/>m\_type == MT\_CONTROL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02814}02814                 \textcolor{keywordflow}{while} (cm != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02815}02815                         cmn = cm-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02816}02816                         cm-\/>m\_next = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02817}02817                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_domain-\/>dom\_externalize != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02818}02818                                 error = (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_domain-\/>dom\_externalize)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02819}02819                                     (cm, controlp, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02820}02820                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (controlp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02821}02821                                 *controlp = cm;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02822}02822                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02823}02823                                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(cm);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02824}02824                         \textcolor{keywordflow}{if} (controlp != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02825}02825                                 \textcolor{keywordflow}{while} (*controlp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02826}02826                                         controlp = \&(*controlp)-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02827}02827                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02828}02828                         cm = cmn;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02829}02829                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02830}02830         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02831}02831         KASSERT(m == NULL || m-\/>m\_type == MT\_DATA,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02832}02832             (\textcolor{stringliteral}{"{}soreceive\_dgram: !data"{}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02833}02833         \textcolor{keywordflow}{while} (m != NULL \&\& uio-\/>uio\_resid > 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02834}02834                 len = uio-\/>uio\_resid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02835}02835                 \textcolor{keywordflow}{if} (len > m-\/>m\_len)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02836}02836                         len = m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02837}02837                 error = \mbox{\hyperlink{subr__uio_8c_aa4232d34ca9bc2bc4786b368c5de60c9}{uiomove}}(mtod(m, \textcolor{keywordtype}{char} *), (\textcolor{keywordtype}{int})len, uio);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02838}02838                 \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02839}02839                         \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02840}02840                         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02841}02841                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02842}02842                 \textcolor{keywordflow}{if} (len == m-\/>m\_len)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02843}02843                         m = m\_free(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02844}02844                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02845}02845                         m-\/>m\_data += len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02846}02846                         m-\/>m\_len -\/= len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02847}02847                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02848}02848         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02849}02849         \textcolor{keywordflow}{if} (m != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02850}02850                 \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} |= MSG\_TRUNC;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02851}02851                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02852}02852         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02853}02853         \textcolor{keywordflow}{if} (flagsp != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02854}02854                 *flagsp |= \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02855}02855         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02856}02856 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02857}02857 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02858}02858 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02859}\mbox{\hyperlink{uipc__socket_8c_ac78382ab249ec0cf060400bdb7ab1679}{02859}} \mbox{\hyperlink{uipc__socket_8c_ac78382ab249ec0cf060400bdb7ab1679}{soreceive}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **psa, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02860}02860     \textcolor{keyword}{struct} mbuf **mp0, \textcolor{keyword}{struct} mbuf **controlp, \textcolor{keywordtype}{int} *flagsp)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02861}02861 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02862}02862         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02863}02863 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02864}02864         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02865}02865         error = (so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_soreceive(so, psa, uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02866}02866             mp0, controlp, flagsp));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02867}02867         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02868}02868         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02869}02869 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02870}02870 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02871}02871 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02872}\mbox{\hyperlink{uipc__socket_8c_ac5ed643d23540af841bd1d6fad7e3d51}{02872}} \mbox{\hyperlink{uipc__socket_8c_ac5ed643d23540af841bd1d6fad7e3d51}{soshutdown}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} how)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02873}02873 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02874}02874         \textcolor{keyword}{struct }protosw *\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02875}02875         \textcolor{keywordtype}{int} error, soerror\_enotconn;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02876}02876 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02877}02877         \textcolor{keywordflow}{if} (!(how == SHUT\_RD || how == SHUT\_WR || how == SHUT\_RDWR))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02878}02878                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02879}02879 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02880}02880         soerror\_enotconn = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02881}02881         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02882}02882         \textcolor{keywordflow}{if} ((so-\/>so\_state \&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02883}02883             (SS\_ISCONNECTED | SS\_ISCONNECTING | SS\_ISDISCONNECTING)) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02884}02884                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02885}02885 \textcolor{comment}{                 * POSIX mandates us to return ENOTCONN when shutdown(2) is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02886}02886 \textcolor{comment}{                 * invoked on a datagram sockets, however historically we would}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02887}02887 \textcolor{comment}{                 * actually tear socket down. This is known to be leveraged by}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02888}02888 \textcolor{comment}{                 * some applications to unblock process waiting in recvXXX(2)}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02889}02889 \textcolor{comment}{                 * by other process that it shares that socket with. Try to meet}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02890}02890 \textcolor{comment}{                 * both backward-\/compatibility and POSIX requirements by forcing}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02891}02891 \textcolor{comment}{                 * ENOTCONN but still asking protocol to perform pru\_shutdown().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02892}02892 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02893}02893                 \textcolor{keywordflow}{if} (so-\/>so\_type != SOCK\_DGRAM \&\& !SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02894}02894                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02895}02895                         \textcolor{keywordflow}{return} (ENOTCONN);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02896}02896                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02897}02897                 soerror\_enotconn = 1;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02898}02898         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02899}02899 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02900}02900         \textcolor{keywordflow}{if} (SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02901}02901                 \textcolor{keywordflow}{if} (how != SHUT\_WR) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02902}02902                         so-\/>so\_error = ECONNABORTED;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02903}02903                         \mbox{\hyperlink{uipc__socket_8c_a53f0083b2aea01e2a04594b9dba99b30}{solisten\_wakeup}}(so);     \textcolor{comment}{/* unlocks so */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02904}02904                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02905}02905                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02906}02906                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02907}02907                 \textcolor{keywordflow}{goto} done;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02908}02908         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02909}02909         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02910}02910 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02911}02911         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02912}02912         \mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}} = so-\/>so\_proto;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02913}02913         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_flush != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02914}02914                 (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_flush)(so, how);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02915}02915         \textcolor{keywordflow}{if} (how != SHUT\_WR)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02916}02916                 \mbox{\hyperlink{uipc__socket_8c_a2a6f62f3faaa89daeb479d188389310d}{sorflush}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02917}02917         \textcolor{keywordflow}{if} (how != SHUT\_RD) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02918}02918                 error = (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_usrreqs-\/>pru\_shutdown)(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02919}02919                 \mbox{\hyperlink{kern__synch_8c_ab5e31e48f559b1015c09a61a83c59f19}{wakeup}}(\&so-\/>so\_timeo);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02920}02920                 CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02921}02921                 \textcolor{keywordflow}{return} ((error == 0 \&\& soerror\_enotconn) ? ENOTCONN : error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02922}02922         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02923}02923         \mbox{\hyperlink{kern__synch_8c_ab5e31e48f559b1015c09a61a83c59f19}{wakeup}}(\&so-\/>so\_timeo);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02924}02924         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02925}02925 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02926}02926 done:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02927}02927         \textcolor{keywordflow}{return} (soerror\_enotconn ? ENOTCONN : 0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02928}02928 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02929}02929 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02930}02930 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02931}\mbox{\hyperlink{uipc__socket_8c_a2a6f62f3faaa89daeb479d188389310d}{02931}} \mbox{\hyperlink{uipc__socket_8c_a2a6f62f3faaa89daeb479d188389310d}{sorflush}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02932}02932 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02933}02933         \textcolor{keyword}{struct }socket aso;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02934}02934         \textcolor{keyword}{struct }protosw *\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02935}02935         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02936}02936 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02937}02937         \mbox{\hyperlink{uipc__socket_8c_a1add1c22e155d585d7daa1d163da3dbc}{VNET\_SO\_ASSERT}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02938}02938 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02939}02939         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02940}02940 \textcolor{comment}{         * In order to avoid calling dom\_dispose with the socket buffer mutex}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02941}02941 \textcolor{comment}{         * held, we make a partial copy of the socket buffer and clear the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02942}02942 \textcolor{comment}{         * original.  The new socket buffer copy won't have initialized locks so}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02943}02943 \textcolor{comment}{         * we can only call routines that won't use or assert those locks.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02944}02944 \textcolor{comment}{         * Ideally calling socantrcvmore() would prevent data from being added}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02945}02945 \textcolor{comment}{         * to the buffer, but currently it merely prevents buffered data from}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02946}02946 \textcolor{comment}{         * being read by userspace.  We make this effort to free buffered data}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02947}02947 \textcolor{comment}{         * nonetheless.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02948}02948 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02949}02949 \textcolor{comment}{         * Dislodge threads currently blocked in receive and wait to acquire}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02950}02950 \textcolor{comment}{         * a lock against other simultaneous readers before clearing the}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02951}02951 \textcolor{comment}{         * socket buffer.  Don't let our acquire be interrupted by a signal}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02952}02952 \textcolor{comment}{         * despite any existing socket disposition on interruptable waiting.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02953}02953 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02954}02954         \mbox{\hyperlink{uipc__sockbuf_8c_af2d7f93ee67b20beda0bc7192b8002ca}{socantrcvmore}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02955}02955 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02956}02956         error = SOCK\_IO\_RECV\_LOCK(so, SBL\_WAIT | SBL\_NOINTR);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02957}02957         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02958}02958                 KASSERT(SOLISTENING(so),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02959}02959                     (\textcolor{stringliteral}{"{}\%s: soiolock(\%p) failed"{}}, \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02960}02960                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02961}02961         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02962}02962 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02963}02963         SOCK\_RECVBUF\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02964}02964         bzero(\&aso, \textcolor{keyword}{sizeof}(aso));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02965}02965         aso.so\_pcb = so-\/>so\_pcb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02966}02966         bcopy(\&so-\/>so\_rcv.sb\_startzero, \&aso.so\_rcv.sb\_startzero,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02967}02967             offsetof(\textcolor{keyword}{struct} sockbuf, sb\_endzero) -\/}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02968}02968             offsetof(\textcolor{keyword}{struct} sockbuf, sb\_startzero));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02969}02969         bzero(\&so-\/>so\_rcv.sb\_startzero,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02970}02970             offsetof(\textcolor{keyword}{struct} sockbuf, sb\_endzero) -\/}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02971}02971             offsetof(\textcolor{keyword}{struct} sockbuf, sb\_startzero));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02972}02972         SOCK\_RECVBUF\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02973}02973         SOCK\_IO\_RECV\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02974}02974 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02975}02975         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02976}02976 \textcolor{comment}{         * Dispose of special rights and flush the copied socket.  Don't call}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02977}02977 \textcolor{comment}{         * any unsafe routines (that rely on locks being initialized) on aso.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02978}02978 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02979}02979         \mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}} = so-\/>so\_proto;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02980}02980         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_flags \& PR\_RIGHTS \&\& \mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_domain-\/>dom\_dispose != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02981}02981                 (*\mbox{\hyperlink{kern__poll_8c_a18e32b1f69fa6affa136620d0aadca4c}{pr}}-\/>pr\_domain-\/>dom\_dispose)(\&aso);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02982}02982         \mbox{\hyperlink{uipc__sockbuf_8c_aceaf7247cf8c55cc8568508952944ca5}{sbrelease\_internal}}(\&aso.so\_rcv, so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02983}02983 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02984}02984 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02985}02985 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02986}02986 \textcolor{comment}{ * Wrapper for Socket established helper hook.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02987}02987 \textcolor{comment}{ * Parameters: socket, context of the hook point, hook id.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02988}02988 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02989}02989 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \textcolor{keyword}{inline}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02990}\mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{02990}} \mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{hhook\_run\_socket}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{void} *hctx, int32\_t h\_id)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02991}02991 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02992}02992         \textcolor{keyword}{struct }socket\_hhook\_data hhook\_data = \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02993}02993                 .so = so,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02994}02994                 .hctx = hctx,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02995}02995                 .m = NULL,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02996}02996                 .status = 0}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02997}02997         \};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02998}02998 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l02999}02999         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03000}03000         HHOOKS\_RUN\_IF(\mbox{\hyperlink{uipc__socket_8c_aedc0c0c5e6c3ac244635a279b54a0c21}{V\_socket\_hhh}}[h\_id], \&hhook\_data, \&so-\/>osd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03001}03001         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03002}03002 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03003}03003         \textcolor{comment}{/* Ugly but needed, since hhooks return void for now */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03004}03004         \textcolor{keywordflow}{return} (hhook\_data.status);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03005}03005 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03006}03006 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03007}03007 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03008}03008 \textcolor{comment}{ * Perhaps this routine, and sooptcopyout(), below, ought to come in an}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03009}03009 \textcolor{comment}{ * additional variant to handle the case where the option value needs to be}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03010}03010 \textcolor{comment}{ * some kind of integer, but not a specific size.  In addition to their use}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03011}03011 \textcolor{comment}{ * here, these functions are also called by the protocol-\/level pr\_ctloutput()}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03012}03012 \textcolor{comment}{ * routines.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03013}03013 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03014}03014 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03015}\mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{03015}} \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(\textcolor{keyword}{struct} sockopt *sopt, \textcolor{keywordtype}{void} *\mbox{\hyperlink{vfs__syscalls_8c_a6defe41b89c760943b86089ec1838319}{buf}}, \textcolor{keywordtype}{size\_t} len, \textcolor{keywordtype}{size\_t} minlen)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03016}03016 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03017}03017         \textcolor{keywordtype}{size\_t}  valsize;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03018}03018 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03019}03019         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03020}03020 \textcolor{comment}{         * If the user gives us more than we wanted, we ignore it, but if we}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03021}03021 \textcolor{comment}{         * don't get the minimum length the caller wants, we return EINVAL.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03022}03022 \textcolor{comment}{         * On success, sopt-\/>sopt\_valsize is set to however much we actually}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03023}03023 \textcolor{comment}{         * retrieved.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03024}03024 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03025}03025         \textcolor{keywordflow}{if} ((valsize = sopt-\/>sopt\_valsize) < minlen)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03026}03026                 \textcolor{keywordflow}{return} EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03027}03027         \textcolor{keywordflow}{if} (valsize > len)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03028}03028                 sopt-\/>sopt\_valsize = valsize = len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03029}03029 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03030}03030         \textcolor{keywordflow}{if} (sopt-\/>sopt\_td != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03031}03031                 \textcolor{keywordflow}{return} (copyin(sopt-\/>sopt\_val, \mbox{\hyperlink{vfs__syscalls_8c_a6defe41b89c760943b86089ec1838319}{buf}}, valsize));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03032}03032 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03033}03033         bcopy(sopt-\/>sopt\_val, \mbox{\hyperlink{vfs__syscalls_8c_a6defe41b89c760943b86089ec1838319}{buf}}, valsize);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03034}03034         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03035}03035 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03036}03036 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03037}03037 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03038}03038 \textcolor{comment}{ * Kernel version of setsockopt(2).}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03039}03039 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03040}03040 \textcolor{comment}{ * XXX: optlen is size\_t, not socklen\_t}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03041}03041 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03042}03042 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03043}\mbox{\hyperlink{uipc__socket_8c_a64da468bc3cda0cfad94e2b368091f43}{03043}} \mbox{\hyperlink{uipc__socket_8c_a64da468bc3cda0cfad94e2b368091f43}{so\_setsockopt}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} \mbox{\hyperlink{cpufreq__if_8m_a198331b23dfcce50cdc50b304652b965}{level}}, \textcolor{keywordtype}{int} optname, \textcolor{keywordtype}{void} *optval,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03044}03044     \textcolor{keywordtype}{size\_t} optlen)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03045}03045 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03046}03046         \textcolor{keyword}{struct }sockopt sopt;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03047}03047 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03048}03048         sopt.sopt\_level = \mbox{\hyperlink{cpufreq__if_8m_a198331b23dfcce50cdc50b304652b965}{level}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03049}03049         sopt.sopt\_name = optname;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03050}03050         sopt.sopt\_dir = SOPT\_SET;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03051}03051         sopt.sopt\_val = optval;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03052}03052         sopt.sopt\_valsize = optlen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03053}03053         sopt.sopt\_td = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03054}03054         \textcolor{keywordflow}{return} (\mbox{\hyperlink{uipc__socket_8c_a0361f7f460fccf9d5a13de14585b6488}{sosetopt}}(so, \&sopt));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03055}03055 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03056}03056 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03057}03057 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03058}\mbox{\hyperlink{uipc__socket_8c_a0361f7f460fccf9d5a13de14585b6488}{03058}} \mbox{\hyperlink{uipc__socket_8c_a0361f7f460fccf9d5a13de14585b6488}{sosetopt}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockopt *sopt)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03059}03059 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03060}03060         \textcolor{keywordtype}{int}     error, optval;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03061}03061         \textcolor{keyword}{struct  }linger l;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03062}03062         \textcolor{keyword}{struct  }timeval tv;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03063}03063         sbintime\_t val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03064}03064         uint32\_t val32;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03065}03065 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03066}03066         \textcolor{keyword}{struct }mac extmac;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03067}03067 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03068}03068 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03069}03069         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03070}03070         error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03071}03071         \textcolor{keywordflow}{if} (sopt-\/>sopt\_level != SOL\_SOCKET) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03072}03072                 \textcolor{keywordflow}{if} (so-\/>so\_proto-\/>pr\_ctloutput != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03073}03073                         error = (*so-\/>so\_proto-\/>pr\_ctloutput)(so, sopt);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03074}03074                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03075}03075                         error = ENOPROTOOPT;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03076}03076         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03077}03077                 \textcolor{keywordflow}{switch} (sopt-\/>sopt\_name) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03078}03078                 \textcolor{keywordflow}{case} SO\_ACCEPTFILTER:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03079}03079                         error = \mbox{\hyperlink{uipc__accf_8c_a49088a70a95422c0516c3e8835d728d9}{accept\_filt\_setopt}}(so, sopt);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03080}03080                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03081}03081                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03082}03082                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03083}03083 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03084}03084                 \textcolor{keywordflow}{case} SO\_LINGER:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03085}03085                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&l, \textcolor{keyword}{sizeof} l, \textcolor{keyword}{sizeof} l);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03086}03086                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03087}03087                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03088}03088                         \textcolor{keywordflow}{if} (l.l\_linger < 0 ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03089}03089                             l.l\_linger > USHRT\_MAX ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03090}03090                             l.l\_linger > (INT\_MAX / \mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}})) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03091}03091                                 error = EDOM;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03092}03092                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03093}03093                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03094}03094                         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03095}03095                         so-\/>so\_linger = l.l\_linger;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03096}03096                         \textcolor{keywordflow}{if} (l.l\_onoff)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03097}03097                                 so-\/>so\_options |= SO\_LINGER;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03098}03098                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03099}03099                                 so-\/>so\_options \&= \string~SO\_LINGER;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03100}03100                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03101}03101                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03102}03102 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03103}03103                 \textcolor{keywordflow}{case} SO\_DEBUG:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03104}03104                 \textcolor{keywordflow}{case} SO\_KEEPALIVE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03105}03105                 \textcolor{keywordflow}{case} SO\_DONTROUTE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03106}03106                 \textcolor{keywordflow}{case} SO\_USELOOPBACK:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03107}03107                 \textcolor{keywordflow}{case} SO\_BROADCAST:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03108}03108                 \textcolor{keywordflow}{case} SO\_REUSEADDR:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03109}03109                 \textcolor{keywordflow}{case} SO\_REUSEPORT:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03110}03110                 \textcolor{keywordflow}{case} SO\_REUSEPORT\_LB:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03111}03111                 \textcolor{keywordflow}{case} SO\_OOBINLINE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03112}03112                 \textcolor{keywordflow}{case} SO\_TIMESTAMP:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03113}03113                 \textcolor{keywordflow}{case} SO\_BINTIME:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03114}03114                 \textcolor{keywordflow}{case} SO\_NOSIGPIPE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03115}03115                 \textcolor{keywordflow}{case} SO\_NO\_DDP:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03116}03116                 \textcolor{keywordflow}{case} SO\_NO\_OFFLOAD:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03117}03117                 \textcolor{keywordflow}{case} SO\_RERROR:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03118}03118                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&optval, \textcolor{keyword}{sizeof} optval,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03119}03119                             \textcolor{keyword}{sizeof} optval);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03120}03120                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03121}03121                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03122}03122                         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03123}03123                         \textcolor{keywordflow}{if} (optval)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03124}03124                                 so-\/>so\_options |= sopt-\/>sopt\_name;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03125}03125                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03126}03126                                 so-\/>so\_options \&= \string~sopt-\/>sopt\_name;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03127}03127                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03128}03128                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03129}03129 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03130}03130                 \textcolor{keywordflow}{case} SO\_SETFIB:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03131}03131                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&optval, \textcolor{keyword}{sizeof} optval,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03132}03132                             \textcolor{keyword}{sizeof} optval);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03133}03133                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03134}03134                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03135}03135 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03136}03136                         \textcolor{keywordflow}{if} (optval < 0 || optval >= rt\_numfibs) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03137}03137                                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03138}03138                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03139}03139                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03140}03140                         \textcolor{keywordflow}{if} (((so-\/>so\_proto-\/>pr\_domain-\/>dom\_family == PF\_INET) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03141}03141                            (so-\/>so\_proto-\/>pr\_domain-\/>dom\_family == PF\_INET6) ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03142}03142                            (so-\/>so\_proto-\/>pr\_domain-\/>dom\_family == PF\_ROUTE)))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03143}03143                                 so-\/>so\_fibnum = optval;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03144}03144                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03145}03145                                 so-\/>so\_fibnum = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03146}03146                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03147}03147 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03148}03148                 \textcolor{keywordflow}{case} SO\_USER\_COOKIE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03149}03149                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&val32, \textcolor{keyword}{sizeof} val32,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03150}03150                             \textcolor{keyword}{sizeof} val32);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03151}03151                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03152}03152                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03153}03153                         so-\/>so\_user\_cookie = val32;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03154}03154                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03155}03155 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03156}03156                 \textcolor{keywordflow}{case} SO\_SNDBUF:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03157}03157                 \textcolor{keywordflow}{case} SO\_RCVBUF:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03158}03158                 \textcolor{keywordflow}{case} SO\_SNDLOWAT:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03159}03159                 \textcolor{keywordflow}{case} SO\_RCVLOWAT:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03160}03160                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&optval, \textcolor{keyword}{sizeof} optval,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03161}03161                             \textcolor{keyword}{sizeof} optval);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03162}03162                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03163}03163                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03164}03164 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03165}03165                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03166}03166 \textcolor{comment}{                         * Values < 1 make no sense for any of these options,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03167}03167 \textcolor{comment}{                         * so disallow them.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03168}03168 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03169}03169                         \textcolor{keywordflow}{if} (optval < 1) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03170}03170                                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03171}03171                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03172}03172                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03173}03173 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03174}03174                         error = \mbox{\hyperlink{uipc__sockbuf_8c_a2de5a02de7fdf233a2443fbdbc15d1fd}{sbsetopt}}(so, sopt-\/>sopt\_name, optval);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03175}03175                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03176}03176 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03177}03177                 \textcolor{keywordflow}{case} SO\_SNDTIMEO:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03178}03178                 \textcolor{keywordflow}{case} SO\_RCVTIMEO:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03179}03179 \textcolor{preprocessor}{\#ifdef COMPAT\_FREEBSD32}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03180}03180                         \textcolor{keywordflow}{if} (SV\_CURPROC\_FLAG(SV\_ILP32)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03181}03181                                 \textcolor{keyword}{struct }timeval32 tv32;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03182}03182 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03183}03183                                 error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&tv32, \textcolor{keyword}{sizeof} tv32,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03184}03184                                     \textcolor{keyword}{sizeof} tv32);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03185}03185                                 CP(tv32, tv, tv\_sec);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03186}03186                                 CP(tv32, tv, tv\_usec);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03187}03187                         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03188}03188 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03189}03189                                 error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&tv, \textcolor{keyword}{sizeof} tv,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03190}03190                                     \textcolor{keyword}{sizeof} tv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03191}03191                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03192}03192                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03193}03193                         \textcolor{keywordflow}{if} (tv.tv\_sec < 0 || tv.tv\_usec < 0 ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03194}03194                             tv.tv\_usec >= 1000000) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03195}03195                                 error = EDOM;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03196}03196                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03197}03197                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03198}03198                         \textcolor{keywordflow}{if} (tv.tv\_sec > INT32\_MAX)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03199}03199                                 val = SBT\_MAX;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03200}03200                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03201}03201                                 val = tvtosbt(tv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03202}03202                         \textcolor{keywordflow}{switch} (sopt-\/>sopt\_name) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03203}03203                         \textcolor{keywordflow}{case} SO\_SNDTIMEO:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03204}03204                                 so-\/>so\_snd.sb\_timeo = val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03205}03205                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03206}03206                         \textcolor{keywordflow}{case} SO\_RCVTIMEO:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03207}03207                                 so-\/>so\_rcv.sb\_timeo = val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03208}03208                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03209}03209                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03210}03210                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03211}03211 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03212}03212                 \textcolor{keywordflow}{case} SO\_LABEL:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03213}03213 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03214}03214                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&extmac, \textcolor{keyword}{sizeof} extmac,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03215}03215                             \textcolor{keyword}{sizeof} extmac);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03216}03216                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03217}03217                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03218}03218                         error = mac\_setsockopt\_label(sopt-\/>sopt\_td-\/>td\_ucred,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03219}03219                             so, \&extmac);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03220}03220 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03221}03221                         error = EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03222}03222 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03223}03223                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03224}03224 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03225}03225                 \textcolor{keywordflow}{case} SO\_TS\_CLOCK:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03226}03226                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&optval, \textcolor{keyword}{sizeof} optval,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03227}03227                             \textcolor{keyword}{sizeof} optval);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03228}03228                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03229}03229                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03230}03230                         \textcolor{keywordflow}{if} (optval < 0 || optval > SO\_TS\_CLOCK\_MAX) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03231}03231                                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03232}03232                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03233}03233                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03234}03234                         so-\/>so\_ts\_clock = optval;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03235}03235                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03236}03236 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03237}03237                 \textcolor{keywordflow}{case} SO\_MAX\_PACING\_RATE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03238}03238                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&val32, \textcolor{keyword}{sizeof}(val32),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03239}03239                             \textcolor{keyword}{sizeof}(val32));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03240}03240                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03241}03241                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03242}03242                         so-\/>so\_max\_pacing\_rate = val32;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03243}03243                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03244}03244 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03245}03245                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03246}03246                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{uipc__socket_8c_aedc0c0c5e6c3ac244635a279b54a0c21}{V\_socket\_hhh}}[HHOOK\_SOCKET\_OPT]-\/>hhh\_nhooks > 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03247}03247                                 error = \mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{hhook\_run\_socket}}(so, sopt,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03248}03248                                     HHOOK\_SOCKET\_OPT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03249}03249                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03250}03250                                 error = ENOPROTOOPT;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03251}03251                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03252}03252                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03253}03253                 \textcolor{keywordflow}{if} (error == 0 \&\& so-\/>so\_proto-\/>pr\_ctloutput != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03254}03254                         (void)(*so-\/>so\_proto-\/>pr\_ctloutput)(so, sopt);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03255}03255         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03256}03256 bad:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03257}03257         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03258}03258         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03259}03259 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03260}03260 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03261}03261 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03262}03262 \textcolor{comment}{ * Helper routine for getsockopt.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03263}03263 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03264}03264 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03265}\mbox{\hyperlink{uipc__socket_8c_ae63a308cbb7aefee2cb5266a7edbac3f}{03265}} \mbox{\hyperlink{uipc__socket_8c_ae63a308cbb7aefee2cb5266a7edbac3f}{sooptcopyout}}(\textcolor{keyword}{struct} sockopt *sopt, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *\mbox{\hyperlink{vfs__syscalls_8c_a6defe41b89c760943b86089ec1838319}{buf}}, \textcolor{keywordtype}{size\_t} len)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03266}03266 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03267}03267         \textcolor{keywordtype}{int}     error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03268}03268         \textcolor{keywordtype}{size\_t}  valsize;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03269}03269 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03270}03270         error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03271}03271 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03272}03272         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03273}03273 \textcolor{comment}{         * Documented get behavior is that we always return a value, possibly}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03274}03274 \textcolor{comment}{         * truncated to fit in the user's buffer.  Traditional behavior is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03275}03275 \textcolor{comment}{         * that we always tell the user precisely how much we copied, rather}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03276}03276 \textcolor{comment}{         * than something useful like the total amount we had available for}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03277}03277 \textcolor{comment}{         * her.  Note that this interface is not idempotent; the entire}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03278}03278 \textcolor{comment}{         * answer must be generated ahead of time.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03279}03279 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03280}03280         valsize = min(len, sopt-\/>sopt\_valsize);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03281}03281         sopt-\/>sopt\_valsize = valsize;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03282}03282         \textcolor{keywordflow}{if} (sopt-\/>sopt\_val != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03283}03283                 \textcolor{keywordflow}{if} (sopt-\/>sopt\_td != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03284}03284                         error = copyout(\mbox{\hyperlink{vfs__syscalls_8c_a6defe41b89c760943b86089ec1838319}{buf}}, sopt-\/>sopt\_val, valsize);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03285}03285                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03286}03286                         bcopy(\mbox{\hyperlink{vfs__syscalls_8c_a6defe41b89c760943b86089ec1838319}{buf}}, sopt-\/>sopt\_val, valsize);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03287}03287         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03288}03288         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03289}03289 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03290}03290 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03291}03291 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03292}\mbox{\hyperlink{uipc__socket_8c_a713e243168539fe0bb22dd9c859e9314}{03292}} \mbox{\hyperlink{uipc__socket_8c_a713e243168539fe0bb22dd9c859e9314}{sogetopt}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockopt *sopt)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03293}03293 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03294}03294         \textcolor{keywordtype}{int}     error, optval;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03295}03295         \textcolor{keyword}{struct  }linger l;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03296}03296         \textcolor{keyword}{struct  }timeval tv;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03297}03297 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03298}03298         \textcolor{keyword}{struct }mac extmac;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03299}03299 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03300}03300 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03301}03301         CURVNET\_SET(so-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03302}03302         error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03303}03303         \textcolor{keywordflow}{if} (sopt-\/>sopt\_level != SOL\_SOCKET) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03304}03304                 \textcolor{keywordflow}{if} (so-\/>so\_proto-\/>pr\_ctloutput != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03305}03305                         error = (*so-\/>so\_proto-\/>pr\_ctloutput)(so, sopt);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03306}03306                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03307}03307                         error = ENOPROTOOPT;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03308}03308                 CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03309}03309                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03310}03310         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03311}03311                 \textcolor{keywordflow}{switch} (sopt-\/>sopt\_name) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03312}03312                 \textcolor{keywordflow}{case} SO\_ACCEPTFILTER:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03313}03313                         error = \mbox{\hyperlink{uipc__accf_8c_a292d57ed23d9167273a8eb0ae4f7e92a}{accept\_filt\_getopt}}(so, sopt);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03314}03314                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03315}03315 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03316}03316                 \textcolor{keywordflow}{case} SO\_LINGER:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03317}03317                         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03318}03318                         l.l\_onoff = so-\/>so\_options \& SO\_LINGER;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03319}03319                         l.l\_linger = so-\/>so\_linger;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03320}03320                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03321}03321                         error = \mbox{\hyperlink{uipc__socket_8c_ae63a308cbb7aefee2cb5266a7edbac3f}{sooptcopyout}}(sopt, \&l, \textcolor{keyword}{sizeof} l);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03322}03322                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03323}03323 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03324}03324                 \textcolor{keywordflow}{case} SO\_USELOOPBACK:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03325}03325                 \textcolor{keywordflow}{case} SO\_DONTROUTE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03326}03326                 \textcolor{keywordflow}{case} SO\_DEBUG:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03327}03327                 \textcolor{keywordflow}{case} SO\_KEEPALIVE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03328}03328                 \textcolor{keywordflow}{case} SO\_REUSEADDR:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03329}03329                 \textcolor{keywordflow}{case} SO\_REUSEPORT:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03330}03330                 \textcolor{keywordflow}{case} SO\_REUSEPORT\_LB:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03331}03331                 \textcolor{keywordflow}{case} SO\_BROADCAST:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03332}03332                 \textcolor{keywordflow}{case} SO\_OOBINLINE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03333}03333                 \textcolor{keywordflow}{case} SO\_ACCEPTCONN:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03334}03334                 \textcolor{keywordflow}{case} SO\_TIMESTAMP:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03335}03335                 \textcolor{keywordflow}{case} SO\_BINTIME:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03336}03336                 \textcolor{keywordflow}{case} SO\_NOSIGPIPE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03337}03337                 \textcolor{keywordflow}{case} SO\_NO\_DDP:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03338}03338                 \textcolor{keywordflow}{case} SO\_NO\_OFFLOAD:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03339}03339                 \textcolor{keywordflow}{case} SO\_RERROR:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03340}03340                         optval = so-\/>so\_options \& sopt-\/>sopt\_name;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03341}03341 integer:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03342}03342                         error = \mbox{\hyperlink{uipc__socket_8c_ae63a308cbb7aefee2cb5266a7edbac3f}{sooptcopyout}}(sopt, \&optval, \textcolor{keyword}{sizeof} optval);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03343}03343                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03344}03344 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03345}03345                 \textcolor{keywordflow}{case} SO\_DOMAIN:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03346}03346                         optval = so-\/>so\_proto-\/>pr\_domain-\/>dom\_family;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03347}03347                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03348}03348 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03349}03349                 \textcolor{keywordflow}{case} SO\_TYPE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03350}03350                         optval = so-\/>so\_type;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03351}03351                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03352}03352 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03353}03353                 \textcolor{keywordflow}{case} SO\_PROTOCOL:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03354}03354                         optval = so-\/>so\_proto-\/>pr\_protocol;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03355}03355                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03356}03356 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03357}03357                 \textcolor{keywordflow}{case} SO\_ERROR:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03358}03358                         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03359}03359                         \textcolor{keywordflow}{if} (so-\/>so\_error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03360}03360                                 optval = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03361}03361                                 so-\/>so\_error = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03362}03362                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03363}03363                                 optval = so-\/>so\_rerror;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03364}03364                                 so-\/>so\_rerror = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03365}03365                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03366}03366                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03367}03367                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03368}03368 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03369}03369                 \textcolor{keywordflow}{case} SO\_SNDBUF:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03370}03370                         optval = SOLISTENING(so) ? so-\/>sol\_sbsnd\_hiwat :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03371}03371                             so-\/>so\_snd.sb\_hiwat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03372}03372                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03373}03373 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03374}03374                 \textcolor{keywordflow}{case} SO\_RCVBUF:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03375}03375                         optval = SOLISTENING(so) ? so-\/>sol\_sbrcv\_hiwat :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03376}03376                             so-\/>so\_rcv.sb\_hiwat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03377}03377                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03378}03378 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03379}03379                 \textcolor{keywordflow}{case} SO\_SNDLOWAT:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03380}03380                         optval = SOLISTENING(so) ? so-\/>sol\_sbsnd\_lowat :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03381}03381                             so-\/>so\_snd.sb\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03382}03382                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03383}03383 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03384}03384                 \textcolor{keywordflow}{case} SO\_RCVLOWAT:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03385}03385                         optval = SOLISTENING(so) ? so-\/>sol\_sbrcv\_lowat :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03386}03386                             so-\/>so\_rcv.sb\_lowat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03387}03387                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03388}03388 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03389}03389                 \textcolor{keywordflow}{case} SO\_SNDTIMEO:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03390}03390                 \textcolor{keywordflow}{case} SO\_RCVTIMEO:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03391}03391                         tv = sbttotv(sopt-\/>sopt\_name == SO\_SNDTIMEO ?}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03392}03392                             so-\/>so\_snd.sb\_timeo : so-\/>so\_rcv.sb\_timeo);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03393}03393 \textcolor{preprocessor}{\#ifdef COMPAT\_FREEBSD32}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03394}03394                         \textcolor{keywordflow}{if} (SV\_CURPROC\_FLAG(SV\_ILP32)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03395}03395                                 \textcolor{keyword}{struct }timeval32 tv32;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03396}03396 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03397}03397                                 CP(tv, tv32, tv\_sec);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03398}03398                                 CP(tv, tv32, tv\_usec);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03399}03399                                 error = \mbox{\hyperlink{uipc__socket_8c_ae63a308cbb7aefee2cb5266a7edbac3f}{sooptcopyout}}(sopt, \&tv32, \textcolor{keyword}{sizeof} tv32);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03400}03400                         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03401}03401 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03402}03402                                 error = \mbox{\hyperlink{uipc__socket_8c_ae63a308cbb7aefee2cb5266a7edbac3f}{sooptcopyout}}(sopt, \&tv, \textcolor{keyword}{sizeof} tv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03403}03403                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03404}03404 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03405}03405                 \textcolor{keywordflow}{case} SO\_LABEL:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03406}03406 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03407}03407                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&extmac, \textcolor{keyword}{sizeof}(extmac),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03408}03408                             \textcolor{keyword}{sizeof}(extmac));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03409}03409                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03410}03410                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03411}03411                         error = mac\_getsockopt\_label(sopt-\/>sopt\_td-\/>td\_ucred,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03412}03412                             so, \&extmac);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03413}03413                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03414}03414                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03415}03415                         error = \mbox{\hyperlink{uipc__socket_8c_ae63a308cbb7aefee2cb5266a7edbac3f}{sooptcopyout}}(sopt, \&extmac, \textcolor{keyword}{sizeof} extmac);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03416}03416 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03417}03417                         error = EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03418}03418 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03419}03419                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03420}03420 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03421}03421                 \textcolor{keywordflow}{case} SO\_PEERLABEL:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03422}03422 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03423}03423                         error = \mbox{\hyperlink{uipc__socket_8c_a963e757b80caddf537b6e102dc23cd7f}{sooptcopyin}}(sopt, \&extmac, \textcolor{keyword}{sizeof}(extmac),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03424}03424                             \textcolor{keyword}{sizeof}(extmac));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03425}03425                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03426}03426                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03427}03427                         error = mac\_getsockopt\_peerlabel(}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03428}03428                             sopt-\/>sopt\_td-\/>td\_ucred, so, \&extmac);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03429}03429                         \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03430}03430                                 \textcolor{keywordflow}{goto} bad;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03431}03431                         error = \mbox{\hyperlink{uipc__socket_8c_ae63a308cbb7aefee2cb5266a7edbac3f}{sooptcopyout}}(sopt, \&extmac, \textcolor{keyword}{sizeof} extmac);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03432}03432 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03433}03433                         error = EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03434}03434 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03435}03435                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03436}03436 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03437}03437                 \textcolor{keywordflow}{case} SO\_LISTENQLIMIT:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03438}03438                         optval = SOLISTENING(so) ? so-\/>sol\_qlimit : 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03439}03439                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03440}03440 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03441}03441                 \textcolor{keywordflow}{case} SO\_LISTENQLEN:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03442}03442                         optval = SOLISTENING(so) ? so-\/>sol\_qlen : 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03443}03443                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03444}03444 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03445}03445                 \textcolor{keywordflow}{case} SO\_LISTENINCQLEN:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03446}03446                         optval = SOLISTENING(so) ? so-\/>sol\_incqlen : 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03447}03447                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03448}03448 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03449}03449                 \textcolor{keywordflow}{case} SO\_TS\_CLOCK:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03450}03450                         optval = so-\/>so\_ts\_clock;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03451}03451                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03452}03452 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03453}03453                 \textcolor{keywordflow}{case} SO\_MAX\_PACING\_RATE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03454}03454                         optval = so-\/>so\_max\_pacing\_rate;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03455}03455                         \textcolor{keywordflow}{goto} integer;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03456}03456 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03457}03457                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03458}03458                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{uipc__socket_8c_aedc0c0c5e6c3ac244635a279b54a0c21}{V\_socket\_hhh}}[HHOOK\_SOCKET\_OPT]-\/>hhh\_nhooks > 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03459}03459                                 error = \mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{hhook\_run\_socket}}(so, sopt,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03460}03460                                     HHOOK\_SOCKET\_OPT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03461}03461                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03462}03462                                 error = ENOPROTOOPT;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03463}03463                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03464}03464                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03465}03465         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03466}03466 \textcolor{preprocessor}{\#ifdef MAC}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03467}03467 bad:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03468}03468 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03469}03469         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03470}03470         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03471}03471 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03472}03472 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03473}03473 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03474}\mbox{\hyperlink{uipc__socket_8c_a14f05e03f511afc6d543fd2099438893}{03474}} \mbox{\hyperlink{uipc__socket_8c_a14f05e03f511afc6d543fd2099438893}{soopt\_getm}}(\textcolor{keyword}{struct} sockopt *sopt, \textcolor{keyword}{struct} mbuf **mp)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03475}03475 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03476}03476         \textcolor{keyword}{struct }mbuf *m, *m\_prev;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03477}03477         \textcolor{keywordtype}{int} sopt\_size = sopt-\/>sopt\_valsize;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03478}03478 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03479}03479         MGET(m, sopt-\/>sopt\_td ? M\_WAITOK : M\_NOWAIT, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03480}03480         \textcolor{keywordflow}{if} (m == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03481}03481                 \textcolor{keywordflow}{return} ENOBUFS;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03482}03482         \textcolor{keywordflow}{if} (sopt\_size > MLEN) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03483}03483                 MCLGET(m, sopt-\/>sopt\_td ? M\_WAITOK : M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03484}03484                 \textcolor{keywordflow}{if} ((m-\/>m\_flags \& M\_EXT) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03485}03485                         m\_free(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03486}03486                         \textcolor{keywordflow}{return} ENOBUFS;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03487}03487                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03488}03488                 m-\/>m\_len = min(MCLBYTES, sopt\_size);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03489}03489         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03490}03490                 m-\/>m\_len = min(MLEN, sopt\_size);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03491}03491         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03492}03492         sopt\_size -\/= m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03493}03493         *mp = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03494}03494         m\_prev = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03495}03495 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03496}03496         \textcolor{keywordflow}{while} (sopt\_size) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03497}03497                 MGET(m, sopt-\/>sopt\_td ? M\_WAITOK : M\_NOWAIT, MT\_DATA);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03498}03498                 \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03499}03499                         \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(*mp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03500}03500                         \textcolor{keywordflow}{return} ENOBUFS;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03501}03501                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03502}03502                 \textcolor{keywordflow}{if} (sopt\_size > MLEN) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03503}03503                         MCLGET(m, sopt-\/>sopt\_td != NULL ? M\_WAITOK :}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03504}03504                             M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03505}03505                         \textcolor{keywordflow}{if} ((m-\/>m\_flags \& M\_EXT) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03506}03506                                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03507}03507                                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(*mp);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03508}03508                                 \textcolor{keywordflow}{return} ENOBUFS;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03509}03509                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03510}03510                         m-\/>m\_len = min(MCLBYTES, sopt\_size);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03511}03511                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03512}03512                         m-\/>m\_len = min(MLEN, sopt\_size);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03513}03513                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03514}03514                 sopt\_size -\/= m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03515}03515                 m\_prev-\/>m\_next = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03516}03516                 m\_prev = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03517}03517         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03518}03518         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03519}03519 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03520}03520 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03521}03521 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03522}\mbox{\hyperlink{uipc__socket_8c_ae65e835b786df04c3a23340436d7532b}{03522}} \mbox{\hyperlink{uipc__socket_8c_ae65e835b786df04c3a23340436d7532b}{soopt\_mcopyin}}(\textcolor{keyword}{struct} sockopt *sopt, \textcolor{keyword}{struct} mbuf *m)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03523}03523 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03524}03524         \textcolor{keyword}{struct }mbuf *m0 = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03525}03525 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03526}03526         \textcolor{keywordflow}{if} (sopt-\/>sopt\_val == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03527}03527                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03528}03528         \textcolor{keywordflow}{while} (m != NULL \&\& sopt-\/>sopt\_valsize >= m-\/>m\_len) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03529}03529                 \textcolor{keywordflow}{if} (sopt-\/>sopt\_td != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03530}03530                         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03531}03531 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03532}03532                         error = copyin(sopt-\/>sopt\_val, mtod(m, \textcolor{keywordtype}{char} *),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03533}03533                             m-\/>m\_len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03534}03534                         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03535}03535                                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(m0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03536}03536                                 \textcolor{keywordflow}{return}(error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03537}03537                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03538}03538                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03539}03539                         bcopy(sopt-\/>sopt\_val, mtod(m, \textcolor{keywordtype}{char} *), m-\/>m\_len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03540}03540                 sopt-\/>sopt\_valsize -\/= m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03541}03541                 sopt-\/>sopt\_val = (\textcolor{keywordtype}{char} *)sopt-\/>sopt\_val + m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03542}03542                 m = m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03543}03543         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03544}03544         \textcolor{keywordflow}{if} (m != NULL) \textcolor{comment}{/* should be allocated enoughly at ip6\_sooptmcopyin() */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03545}03545                 \mbox{\hyperlink{kern__shutdown_8c_ad1f1a1dc0581a11b597453f148106393}{panic}}(\textcolor{stringliteral}{"{}ip6\_sooptmcopyin"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03546}03546         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03547}03547 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03548}03548 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03549}03549 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03550}\mbox{\hyperlink{uipc__socket_8c_a44474445b44b64b20fe78f0fbc4eecf6}{03550}} \mbox{\hyperlink{uipc__socket_8c_a44474445b44b64b20fe78f0fbc4eecf6}{soopt\_mcopyout}}(\textcolor{keyword}{struct} sockopt *sopt, \textcolor{keyword}{struct} mbuf *m)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03551}03551 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03552}03552         \textcolor{keyword}{struct }mbuf *m0 = m;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03553}03553         \textcolor{keywordtype}{size\_t} valsize = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03554}03554 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03555}03555         \textcolor{keywordflow}{if} (sopt-\/>sopt\_val == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03556}03556                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03557}03557         \textcolor{keywordflow}{while} (m != NULL \&\& sopt-\/>sopt\_valsize >= m-\/>m\_len) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03558}03558                 \textcolor{keywordflow}{if} (sopt-\/>sopt\_td != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03559}03559                         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03560}03560 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03561}03561                         error = copyout(mtod(m, \textcolor{keywordtype}{char} *), sopt-\/>sopt\_val,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03562}03562                             m-\/>m\_len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03563}03563                         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03564}03564                                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(m0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03565}03565                                 \textcolor{keywordflow}{return}(error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03566}03566                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03567}03567                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03568}03568                         bcopy(mtod(m, \textcolor{keywordtype}{char} *), sopt-\/>sopt\_val, m-\/>m\_len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03569}03569                 sopt-\/>sopt\_valsize -\/= m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03570}03570                 sopt-\/>sopt\_val = (\textcolor{keywordtype}{char} *)sopt-\/>sopt\_val + m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03571}03571                 valsize += m-\/>m\_len;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03572}03572                 m = m-\/>m\_next;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03573}03573         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03574}03574         \textcolor{keywordflow}{if} (m != NULL) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03575}03575                 \textcolor{comment}{/* enough soopt buffer should be given from user-\/land */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03576}03576                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(m0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03577}03577                 \textcolor{keywordflow}{return}(EINVAL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03578}03578         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03579}03579         sopt-\/>sopt\_valsize = valsize;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03580}03580         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03581}03581 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03582}03582 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03583}03583 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03584}03584 \textcolor{comment}{ * sohasoutofband(): protocol notifies socket layer of the arrival of new}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03585}03585 \textcolor{comment}{ * out-\/of-\/band data, which will then notify socket consumers.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03586}03586 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03587}03587 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03588}\mbox{\hyperlink{uipc__socket_8c_ab475cdb1bba5f7e2839ab9a6533a9071}{03588}} \mbox{\hyperlink{uipc__socket_8c_ab475cdb1bba5f7e2839ab9a6533a9071}{sohasoutofband}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03589}03589 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03590}03590 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03591}03591         \textcolor{keywordflow}{if} (so-\/>so\_sigio != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03592}03592                 \mbox{\hyperlink{kern__sig_8c_a3843a140454e0c8530c9d2837e305f46}{pgsigio}}(\&so-\/>so\_sigio, SIGURG, 0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03593}03593         \mbox{\hyperlink{sys__generic_8c_a021f10d0043382f7a43937efac739909}{selwakeuppri}}(\&so-\/>so\_rdsel, PSOCK);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03594}03594 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03595}03595 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03596}03596 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03597}\mbox{\hyperlink{uipc__socket_8c_ae4f79f679b945c288fc2443b2d7d0d1b}{03597}} \mbox{\hyperlink{uipc__socket_8c_ae4f79f679b945c288fc2443b2d7d0d1b}{sopoll}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} events, \textcolor{keyword}{struct} ucred *active\_cred,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03598}03598     \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03599}03599 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03600}03600 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03601}03601         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03602}03602 \textcolor{comment}{         * We do not need to set or assert curvnet as long as everyone uses}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03603}03603 \textcolor{comment}{         * sopoll\_generic().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03604}03604 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03605}03605         \textcolor{keywordflow}{return} (so-\/>so\_proto-\/>pr\_usrreqs-\/>pru\_sopoll(so, events, active\_cred,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03606}03606             td));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03607}03607 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03608}03608 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03609}03609 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03610}\mbox{\hyperlink{uipc__socket_8c_aa705e1234b3bacb6547504bfb5b5fcb5}{03610}} \mbox{\hyperlink{uipc__socket_8c_aa705e1234b3bacb6547504bfb5b5fcb5}{sopoll\_generic}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} events, \textcolor{keyword}{struct} ucred *active\_cred,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03611}03611     \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03612}03612 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03613}03613         \textcolor{keywordtype}{int} revents;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03614}03614 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03615}03615         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03616}03616         \textcolor{keywordflow}{if} (SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03617}03617                 \textcolor{keywordflow}{if} (!(events \& (POLLIN | POLLRDNORM)))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03618}03618                         revents = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03619}03619                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!TAILQ\_EMPTY(\&so-\/>sol\_comp))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03620}03620                         revents = events \& (POLLIN | POLLRDNORM);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03621}03621                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} ((events \& POLLINIGNEOF) == 0 \&\& so-\/>so\_error)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03622}03622                         revents = (events \& (POLLIN | POLLRDNORM)) | POLLHUP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03623}03623                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03624}03624                         \mbox{\hyperlink{sys__generic_8c_a32f3d6e6ccd2b5851a42404c8acca0a0}{selrecord}}(td, \&so-\/>so\_rdsel);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03625}03625                         revents = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03626}03626                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03627}03627         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03628}03628                 revents = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03629}03629                 SOCKBUF\_LOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03630}03630                 SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03631}03631                 \textcolor{keywordflow}{if} (events \& (POLLIN | POLLRDNORM))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03632}03632                         \textcolor{keywordflow}{if} (soreadabledata(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03633}03633                                 revents |= events \& (POLLIN | POLLRDNORM);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03634}03634                 \textcolor{keywordflow}{if} (events \& (POLLOUT | POLLWRNORM))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03635}03635                         \textcolor{keywordflow}{if} (sowriteable(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03636}03636                                 revents |= events \& (POLLOUT | POLLWRNORM);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03637}03637                 \textcolor{keywordflow}{if} (events \& (POLLPRI | POLLRDBAND))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03638}03638                         \textcolor{keywordflow}{if} (so-\/>so\_oobmark ||}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03639}03639                             (so-\/>so\_rcv.sb\_state \& SBS\_RCVATMARK))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03640}03640                                 revents |= events \& (POLLPRI | POLLRDBAND);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03641}03641                 \textcolor{keywordflow}{if} ((events \& POLLINIGNEOF) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03642}03642                         \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_state \& SBS\_CANTRCVMORE) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03643}03643                                 revents |= events \& (POLLIN | POLLRDNORM);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03644}03644                                 \textcolor{keywordflow}{if} (so-\/>so\_snd.sb\_state \& SBS\_CANTSENDMORE)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03645}03645                                         revents |= POLLHUP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03646}03646                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03647}03647                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03648}03648                 \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_state \& SBS\_CANTRCVMORE)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03649}03649                         revents |= events \& POLLRDHUP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03650}03650                 \textcolor{keywordflow}{if} (revents == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03651}03651                         \textcolor{keywordflow}{if} (events \&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03652}03652                             (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND | POLLRDHUP)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03653}03653                                 \mbox{\hyperlink{sys__generic_8c_a32f3d6e6ccd2b5851a42404c8acca0a0}{selrecord}}(td, \&so-\/>so\_rdsel);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03654}03654                                 so-\/>so\_rcv.sb\_flags |= SB\_SEL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03655}03655                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03656}03656                         \textcolor{keywordflow}{if} (events \& (POLLOUT | POLLWRNORM)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03657}03657                                 \mbox{\hyperlink{sys__generic_8c_a32f3d6e6ccd2b5851a42404c8acca0a0}{selrecord}}(td, \&so-\/>so\_wrsel);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03658}03658                                 so-\/>so\_snd.sb\_flags |= SB\_SEL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03659}03659                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03660}03660                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03661}03661                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03662}03662                 SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03663}03663         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03664}03664         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03665}03665         \textcolor{keywordflow}{return} (revents);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03666}03666 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03667}03667 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03668}03668 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03669}\mbox{\hyperlink{uipc__socket_8c_a30f0653b0d04d0cb6a4967b6807022ba}{03669}} \mbox{\hyperlink{uipc__socket_8c_a19859e8ced8e323811f87176dd657df6}{soo\_kqfilter}}(\textcolor{keyword}{struct} file *fp, \textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03670}03670 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03671}03671         \textcolor{keyword}{struct }socket *so = kn-\/>kn\_fp-\/>f\_data;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03672}03672         \textcolor{keyword}{struct }sockbuf *sb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03673}03673         \textcolor{keyword}{struct }knlist *knl;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03674}03674 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03675}03675         \textcolor{keywordflow}{switch} (kn-\/>kn\_filter) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03676}03676         \textcolor{keywordflow}{case} EVFILT\_READ:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03677}03677                 kn-\/>kn\_fop = \&\mbox{\hyperlink{uipc__socket_8c_a539d0c7b1e25821a20b1f2da269f383e}{soread\_filtops}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03678}03678                 knl = \&so-\/>so\_rdsel.si\_note;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03679}03679                 sb = \&so-\/>so\_rcv;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03680}03680                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03681}03681         \textcolor{keywordflow}{case} EVFILT\_WRITE:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03682}03682                 kn-\/>kn\_fop = \&\mbox{\hyperlink{uipc__socket_8c_a09610123e61eaff5a53b986c07b71d35}{sowrite\_filtops}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03683}03683                 knl = \&so-\/>so\_wrsel.si\_note;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03684}03684                 sb = \&so-\/>so\_snd;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03685}03685                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03686}03686         \textcolor{keywordflow}{case} EVFILT\_EMPTY:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03687}03687                 kn-\/>kn\_fop = \&\mbox{\hyperlink{uipc__socket_8c_ab0c972a5e8d8bf81a8817c494f28d83b}{soempty\_filtops}};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03688}03688                 knl = \&so-\/>so\_wrsel.si\_note;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03689}03689                 sb = \&so-\/>so\_snd;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03690}03690                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03691}03691         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03692}03692                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03693}03693         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03694}03694 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03695}03695         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03696}03696         \textcolor{keywordflow}{if} (SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03697}03697                 \mbox{\hyperlink{kern__event_8c_a673f32ae879a559ca5a8a3f14e20ff0d}{knlist\_add}}(knl, kn, 1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03698}03698         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03699}03699                 SOCKBUF\_LOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03700}03700                 \mbox{\hyperlink{kern__event_8c_a673f32ae879a559ca5a8a3f14e20ff0d}{knlist\_add}}(knl, kn, 1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03701}03701                 sb-\/>sb\_flags |= SB\_KNOTE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03702}03702                 SOCKBUF\_UNLOCK(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03703}03703         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03704}03704         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03705}03705         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03706}03706 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03707}03707 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03708}03708 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03709}03709 \textcolor{comment}{ * Some routines that return EOPNOTSUPP for entry points that are not}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03710}03710 \textcolor{comment}{ * supported by a protocol.  Fill in as needed.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03711}03711 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03712}03712 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03713}\mbox{\hyperlink{uipc__socket_8c_a51490c76fcaac0834c0485309f8f44d4}{03713}} \mbox{\hyperlink{uipc__socket_8c_a51490c76fcaac0834c0485309f8f44d4}{pru\_accept\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **nam)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03714}03714 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03715}03715 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03716}03716         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03717}03717 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03718}03718 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03719}03719 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03720}\mbox{\hyperlink{uipc__socket_8c_a3a06660cd6f13bcc3e95bf962deaffef}{03720}} \mbox{\hyperlink{uipc__socket_8c_a3a06660cd6f13bcc3e95bf962deaffef}{pru\_aio\_queue\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} kaiocb *job)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03721}03721 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03722}03722 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03723}03723         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03724}03724 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03725}03725 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03726}03726 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03727}\mbox{\hyperlink{uipc__socket_8c_a3930d8f8591630bc67d289ac38b4199a}{03727}} \mbox{\hyperlink{uipc__socket_8c_a3930d8f8591630bc67d289ac38b4199a}{pru\_attach\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} proto, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03728}03728 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03729}03729 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03730}03730         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03731}03731 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03732}03732 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03733}03733 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03734}\mbox{\hyperlink{uipc__socket_8c_a03a528825f73615dde4b11b0c1a70702}{03734}} \mbox{\hyperlink{uipc__socket_8c_a03a528825f73615dde4b11b0c1a70702}{pru\_bind\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03735}03735 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03736}03736 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03737}03737         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03738}03738 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03739}03739 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03740}03740 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03741}\mbox{\hyperlink{uipc__socket_8c_ade518905eb1ec9f615b1f8ebdb54015b}{03741}} \mbox{\hyperlink{uipc__socket_8c_ade518905eb1ec9f615b1f8ebdb54015b}{pru\_bindat\_notsupp}}(\textcolor{keywordtype}{int} \mbox{\hyperlink{vfs__syscalls_8c_a6f8059414f0228f0256115e024eeed4b}{fd}}, \textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03742}03742     \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03743}03743 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03744}03744 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03745}03745         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03746}03746 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03747}03747 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03748}03748 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03749}\mbox{\hyperlink{uipc__socket_8c_ae3c489281966c545e463a747df599468}{03749}} \mbox{\hyperlink{uipc__socket_8c_ae3c489281966c545e463a747df599468}{pru\_connect\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03750}03750 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03751}03751 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03752}03752         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03753}03753 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03754}03754 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03755}03755 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03756}\mbox{\hyperlink{uipc__socket_8c_aac7a2a837cd9387e2ecdde23befd7b58}{03756}} \mbox{\hyperlink{uipc__socket_8c_aac7a2a837cd9387e2ecdde23befd7b58}{pru\_connectat\_notsupp}}(\textcolor{keywordtype}{int} \mbox{\hyperlink{vfs__syscalls_8c_a6f8059414f0228f0256115e024eeed4b}{fd}}, \textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03757}03757     \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03758}03758 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03759}03759 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03760}03760         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03761}03761 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03762}03762 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03763}03763 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03764}\mbox{\hyperlink{uipc__socket_8c_a6756301dcbafd416ca3f5c0ef23cb22b}{03764}} \mbox{\hyperlink{uipc__socket_8c_a6756301dcbafd416ca3f5c0ef23cb22b}{pru\_connect2\_notsupp}}(\textcolor{keyword}{struct} socket *so1, \textcolor{keyword}{struct} socket *so2)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03765}03765 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03766}03766 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03767}03767         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03768}03768 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03769}03769 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03770}03770 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03771}\mbox{\hyperlink{uipc__socket_8c_a952f03b5c1974a631a2d8b0fc0e2280e}{03771}} \mbox{\hyperlink{uipc__socket_8c_a952f03b5c1974a631a2d8b0fc0e2280e}{pru\_control\_notsupp}}(\textcolor{keyword}{struct} socket *so, u\_long cmd, caddr\_t \mbox{\hyperlink{msi__if_8m_a67f97bb317cd4853ec5319a7da661c1f}{data}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03772}03772     \textcolor{keyword}{struct} ifnet *ifp, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03773}03773 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03774}03774 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03775}03775         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03776}03776 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03777}03777 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03778}03778 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03779}\mbox{\hyperlink{uipc__socket_8c_a81dd97676882cd5e01cddedfa0c2ca39}{03779}} \mbox{\hyperlink{uipc__socket_8c_a81dd97676882cd5e01cddedfa0c2ca39}{pru\_disconnect\_notsupp}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03780}03780 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03781}03781 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03782}03782         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03783}03783 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03784}03784 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03785}03785 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03786}\mbox{\hyperlink{uipc__socket_8c_a14252f163971e6a6649c58a276e706f1}{03786}} \mbox{\hyperlink{uipc__socket_8c_a14252f163971e6a6649c58a276e706f1}{pru\_listen\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} backlog, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03787}03787 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03788}03788 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03789}03789         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03790}03790 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03791}03791 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03792}03792 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03793}\mbox{\hyperlink{uipc__socket_8c_a21263b55328d5c01afb3ab9a064a2c17}{03793}} \mbox{\hyperlink{uipc__socket_8c_a21263b55328d5c01afb3ab9a064a2c17}{pru\_peeraddr\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **nam)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03794}03794 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03795}03795 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03796}03796         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03797}03797 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03798}03798 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03799}03799 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03800}\mbox{\hyperlink{uipc__socket_8c_a50bb13bad226bfcc56dbe5df9d17093d}{03800}} \mbox{\hyperlink{uipc__socket_8c_a50bb13bad226bfcc56dbe5df9d17093d}{pru\_rcvd\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03801}03801 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03802}03802 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03803}03803         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03804}03804 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03805}03805 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03806}03806 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03807}\mbox{\hyperlink{uipc__socket_8c_a04b7636e59a95f90ce8864017e20faeb}{03807}} \mbox{\hyperlink{uipc__socket_8c_a04b7636e59a95f90ce8864017e20faeb}{pru\_rcvoob\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} mbuf *m, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03808}03808 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03809}03809 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03810}03810         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03811}03811 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03812}03812 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03813}03813 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03814}\mbox{\hyperlink{uipc__socket_8c_a85610f3df3a4a00e550b7beb9b053d0f}{03814}} \mbox{\hyperlink{uipc__socket_8c_a85610f3df3a4a00e550b7beb9b053d0f}{pru\_send\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, \textcolor{keyword}{struct} mbuf *m,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03815}03815     \textcolor{keyword}{struct} sockaddr *\mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}}, \textcolor{keyword}{struct} mbuf *control, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03816}03816 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03817}03817 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03818}03818         \textcolor{keywordflow}{if} (control != NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03819}03819                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(control);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03820}03820         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& PRUS\_NOTREADY) == 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03821}03821                 \mbox{\hyperlink{kern__mbuf_8c_a2ea2fd04c019649e482047d1d370580c}{m\_freem}}(m);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03822}03822         \textcolor{keywordflow}{return} (EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03823}03823 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03824}03824 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03825}03825 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03826}\mbox{\hyperlink{uipc__socket_8c_a6958c8492ad3a61d69f2b30c7dcdac02}{03826}} \mbox{\hyperlink{uipc__socket_8c_a6958c8492ad3a61d69f2b30c7dcdac02}{pru\_ready\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} mbuf *m, \textcolor{keywordtype}{int} \mbox{\hyperlink{cpufreq__if_8m_ad43c3812e6d13e0518d9f8b8f463ffcf}{count}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03827}03827 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03828}03828 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03829}03829         \textcolor{keywordflow}{return} (EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03830}03830 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03831}03831 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03832}03832 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03833}03833 \textcolor{comment}{ * This isn't really a ``null'' operation, but it's the default one and}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03834}03834 \textcolor{comment}{ * doesn't do anything destructive.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03835}03835 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03836}03836 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03837}\mbox{\hyperlink{uipc__socket_8c_a5b3d36135f053432c6bdc2d1516d544e}{03837}} \mbox{\hyperlink{uipc__socket_8c_a5b3d36135f053432c6bdc2d1516d544e}{pru\_sense\_null}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} stat *sb)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03838}03838 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03839}03839 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03840}03840         sb-\/>st\_blksize = so-\/>so\_snd.sb\_hiwat;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03841}03841         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03842}03842 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03843}03843 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03844}03844 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03845}\mbox{\hyperlink{uipc__socket_8c_a2894b2387872a836a971387f0acd9332}{03845}} \mbox{\hyperlink{uipc__socket_8c_a2894b2387872a836a971387f0acd9332}{pru\_shutdown\_notsupp}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03846}03846 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03847}03847 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03848}03848         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03849}03849 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03850}03850 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03851}03851 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03852}\mbox{\hyperlink{uipc__socket_8c_a71c80419e21f66c186235418db95a3e0}{03852}} \mbox{\hyperlink{uipc__socket_8c_a71c80419e21f66c186235418db95a3e0}{pru\_sockaddr\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **nam)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03853}03853 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03854}03854 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03855}03855         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03856}03856 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03857}03857 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03858}03858 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03859}\mbox{\hyperlink{uipc__socket_8c_a63fd4b6ba6cfb8c8102a3aab719d433d}{03859}} \mbox{\hyperlink{uipc__socket_8c_a63fd4b6ba6cfb8c8102a3aab719d433d}{pru\_sosend\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *\mbox{\hyperlink{msi__if_8m_a7345ae8680eeb32913b762d1d5e502b4}{addr}}, \textcolor{keyword}{struct} uio *uio,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03860}03860     \textcolor{keyword}{struct} mbuf *top, \textcolor{keyword}{struct} mbuf *control, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03861}03861 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03862}03862 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03863}03863         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03864}03864 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03865}03865 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03866}03866 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03867}\mbox{\hyperlink{uipc__socket_8c_a8959d040299c18298b84c6df31e93063}{03867}} \mbox{\hyperlink{uipc__socket_8c_a8959d040299c18298b84c6df31e93063}{pru\_soreceive\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **paddr,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03868}03868     \textcolor{keyword}{struct} uio *uio, \textcolor{keyword}{struct} mbuf **mp0, \textcolor{keyword}{struct} mbuf **controlp, \textcolor{keywordtype}{int} *flagsp)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03869}03869 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03870}03870 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03871}03871         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03872}03872 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03873}03873 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03874}03874 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03875}\mbox{\hyperlink{uipc__socket_8c_a0d18e0a0a64dc20d1ee0dd47330f3d32}{03875}} \mbox{\hyperlink{uipc__socket_8c_a0d18e0a0a64dc20d1ee0dd47330f3d32}{pru\_sopoll\_notsupp}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} events, \textcolor{keyword}{struct} ucred *cred,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03876}03876     \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03877}03877 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03878}03878 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03879}03879         \textcolor{keywordflow}{return} EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03880}03880 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03881}03881 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03882}03882 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03883}\mbox{\hyperlink{uipc__socket_8c_ab904746cda39b2a4cd2db4e263dc0595}{03883}} \mbox{\hyperlink{uipc__socket_8c_ab904746cda39b2a4cd2db4e263dc0595}{filt\_sordetach}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03884}03884 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03885}03885         \textcolor{keyword}{struct }socket *so = kn-\/>kn\_fp-\/>f\_data;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03886}03886 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03887}03887         \mbox{\hyperlink{uipc__socket_8c_a73ec27450488af1257b58c83f3c09c26}{so\_rdknl\_lock}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03888}03888         \mbox{\hyperlink{kern__event_8c_a08d20ff44f3d4190ad1fd1e0cae63578}{knlist\_remove}}(\&so-\/>so\_rdsel.si\_note, kn, 1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03889}03889         \textcolor{keywordflow}{if} (!SOLISTENING(so) \&\& \mbox{\hyperlink{kern__event_8c_abefccd64b882eabf82443e6e7854de18}{knlist\_empty}}(\&so-\/>so\_rdsel.si\_note))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03890}03890                 so-\/>so\_rcv.sb\_flags \&= \string~SB\_KNOTE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03891}03891         \mbox{\hyperlink{uipc__socket_8c_ab8ffe6ae588b7e5252b6073701e4ee48}{so\_rdknl\_unlock}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03892}03892 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03893}03893 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03894}03894 \textcolor{comment}{/*ARGSUSED*/}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03895}03895 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03896}\mbox{\hyperlink{uipc__socket_8c_a24128d6a35a551e13cae73be5805600b}{03896}} \mbox{\hyperlink{uipc__socket_8c_a24128d6a35a551e13cae73be5805600b}{filt\_soread}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn, \textcolor{keywordtype}{long} hint)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03897}03897 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03898}03898         \textcolor{keyword}{struct }socket *so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03899}03899 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03900}03900         so = kn-\/>kn\_fp-\/>f\_data;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03901}03901 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03902}03902         \textcolor{keywordflow}{if} (SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03903}03903                 SOCK\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03904}03904                 kn-\/>kn\_data = so-\/>sol\_qlen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03905}03905                 \textcolor{keywordflow}{if} (so-\/>so\_error) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03906}03906                         kn-\/>kn\_flags |= EV\_EOF;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03907}03907                         kn-\/>kn\_fflags = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03908}03908                         \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03909}03909                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03910}03910                 \textcolor{keywordflow}{return} (!TAILQ\_EMPTY(\&so-\/>sol\_comp));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03911}03911         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03912}03912 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03913}03913         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03914}03914 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03915}03915         kn-\/>kn\_data = sbavail(\&so-\/>so\_rcv) -\/ so-\/>so\_rcv.sb\_ctl;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03916}03916         \textcolor{keywordflow}{if} (so-\/>so\_rcv.sb\_state \& SBS\_CANTRCVMORE) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03917}03917                 kn-\/>kn\_flags |= EV\_EOF;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03918}03918                 kn-\/>kn\_fflags = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03919}03919                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03920}03920         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (so-\/>so\_error || so-\/>so\_rerror)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03921}03921                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03922}03922 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03923}03923         \textcolor{keywordflow}{if} (kn-\/>kn\_sfflags \& NOTE\_LOWAT) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03924}03924                 \textcolor{keywordflow}{if} (kn-\/>kn\_data >= kn-\/>kn\_sdata)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03925}03925                         \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03926}03926         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sbavail(\&so-\/>so\_rcv) >= so-\/>so\_rcv.sb\_lowat)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03927}03927                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03928}03928 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03929}03929         \textcolor{comment}{/* This hook returning non-\/zero indicates an event, not error */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03930}03930         \textcolor{keywordflow}{return} (\mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{hhook\_run\_socket}}(so, NULL, HHOOK\_FILT\_SOREAD));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03931}03931 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03932}03932 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03933}03933 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03934}\mbox{\hyperlink{uipc__socket_8c_ab07a80d978fbb33500a81446ec9db479}{03934}} \mbox{\hyperlink{uipc__socket_8c_ab07a80d978fbb33500a81446ec9db479}{filt\_sowdetach}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03935}03935 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03936}03936         \textcolor{keyword}{struct }socket *so = kn-\/>kn\_fp-\/>f\_data;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03937}03937 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03938}03938         \mbox{\hyperlink{uipc__socket_8c_a07eaf32fb3031b83c272475a7617ccf1}{so\_wrknl\_lock}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03939}03939         \mbox{\hyperlink{kern__event_8c_a08d20ff44f3d4190ad1fd1e0cae63578}{knlist\_remove}}(\&so-\/>so\_wrsel.si\_note, kn, 1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03940}03940         \textcolor{keywordflow}{if} (!SOLISTENING(so) \&\& \mbox{\hyperlink{kern__event_8c_abefccd64b882eabf82443e6e7854de18}{knlist\_empty}}(\&so-\/>so\_wrsel.si\_note))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03941}03941                 so-\/>so\_snd.sb\_flags \&= \string~SB\_KNOTE;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03942}03942         \mbox{\hyperlink{uipc__socket_8c_a3ed2a2de261da401d25b9c2e78330b90}{so\_wrknl\_unlock}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03943}03943 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03944}03944 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03945}03945 \textcolor{comment}{/*ARGSUSED*/}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03946}03946 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03947}\mbox{\hyperlink{uipc__socket_8c_acefec058a8a2fbc2c4192f3bcb50308a}{03947}} \mbox{\hyperlink{uipc__socket_8c_acefec058a8a2fbc2c4192f3bcb50308a}{filt\_sowrite}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn, \textcolor{keywordtype}{long} hint)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03948}03948 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03949}03949         \textcolor{keyword}{struct }socket *so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03950}03950 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03951}03951         so = kn-\/>kn\_fp-\/>f\_data;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03952}03952 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03953}03953         \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03954}03954                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03955}03955 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03956}03956         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03957}03957         kn-\/>kn\_data = sbspace(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03958}03958 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03959}03959         \mbox{\hyperlink{uipc__socket_8c_a34a299ae568497c24cedb5ae0edb479e}{hhook\_run\_socket}}(so, kn, HHOOK\_FILT\_SOWRITE);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03960}03960 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03961}03961         \textcolor{keywordflow}{if} (so-\/>so\_snd.sb\_state \& SBS\_CANTSENDMORE) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03962}03962                 kn-\/>kn\_flags |= EV\_EOF;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03963}03963                 kn-\/>kn\_fflags = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03964}03964                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03965}03965         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (so-\/>so\_error)        \textcolor{comment}{/* temporary udp error */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03966}03966                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03967}03967         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (((so-\/>so\_state \& SS\_ISCONNECTED) == 0) \&\&}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03968}03968             (so-\/>so\_proto-\/>pr\_flags \& PR\_CONNREQUIRED))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03969}03969                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03970}03970         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (kn-\/>kn\_sfflags \& NOTE\_LOWAT)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03971}03971                 \textcolor{keywordflow}{return} (kn-\/>kn\_data >= kn-\/>kn\_sdata);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03972}03972         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03973}03973                 \textcolor{keywordflow}{return} (kn-\/>kn\_data >= so-\/>so\_snd.sb\_lowat);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03974}03974 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03975}03975 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03976}03976 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03977}\mbox{\hyperlink{uipc__socket_8c_a4718e9e26afe05c4e00c865a857083fc}{03977}} \mbox{\hyperlink{uipc__socket_8c_a4718e9e26afe05c4e00c865a857083fc}{filt\_soempty}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__event_8c_ab03733941495e32f0f3c3038f1bc9802}{knote}} *kn, \textcolor{keywordtype}{long} hint)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03978}03978 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03979}03979         \textcolor{keyword}{struct }socket *so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03980}03980 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03981}03981         so = kn-\/>kn\_fp-\/>f\_data;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03982}03982 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03983}03983         \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03984}03984                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03985}03985 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03986}03986         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03987}03987         kn-\/>kn\_data = sbused(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03988}03988 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03989}03989         \textcolor{keywordflow}{if} (kn-\/>kn\_data == 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03990}03990                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03991}03991         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03992}03992                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03993}03993 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03994}03994 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03995}03995 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03996}\mbox{\hyperlink{uipc__socket_8c_aa5e3472c228f6a6e73202531f4100e97}{03996}} \mbox{\hyperlink{uipc__socket_8c_aa5e3472c228f6a6e73202531f4100e97}{socheckuid}}(\textcolor{keyword}{struct} socket *so, uid\_t uid)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03997}03997 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03998}03998 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l03999}03999         \textcolor{keywordflow}{if} (so == NULL)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04000}04000                 \textcolor{keywordflow}{return} (EPERM);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04001}04001         \textcolor{keywordflow}{if} (so-\/>so\_cred-\/>cr\_uid != uid)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04002}04002                 \textcolor{keywordflow}{return} (EPERM);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04003}04003         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04004}04004 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04005}04005 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04006}04006 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04007}04007 \textcolor{comment}{ * These functions are used by protocols to notify the socket layer (and its}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04008}04008 \textcolor{comment}{ * consumers) of state changes in the sockets driven by protocol-\/side events.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04009}04009 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04010}04010 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04011}04011 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04012}04012 \textcolor{comment}{ * Procedures to manipulate state flags of socket and do appropriate wakeups.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04013}04013 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04014}04014 \textcolor{comment}{ * Normal sequence from the active (originating) side is that}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04015}04015 \textcolor{comment}{ * soisconnecting() is called during processing of connect() call, resulting}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04016}04016 \textcolor{comment}{ * in an eventual call to soisconnected() if/when the connection is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04017}04017 \textcolor{comment}{ * established.  When the connection is torn down soisdisconnecting() is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04018}04018 \textcolor{comment}{ * called during processing of disconnect() call, and soisdisconnected() is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04019}04019 \textcolor{comment}{ * called when the connection to the peer is totally severed.  The semantics}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04020}04020 \textcolor{comment}{ * of these routines are such that connectionless protocols can call}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04021}04021 \textcolor{comment}{ * soisconnected() and soisdisconnected() only, bypassing the in-\/progress}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04022}04022 \textcolor{comment}{ * calls when setting up a ``connection'' takes no time.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04023}04023 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04024}04024 \textcolor{comment}{ * From the passive side, a socket is created with two queues of sockets:}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04025}04025 \textcolor{comment}{ * so\_incomp for connections in progress and so\_comp for connections already}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04026}04026 \textcolor{comment}{ * made and awaiting user acceptance.  As a protocol is preparing incoming}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04027}04027 \textcolor{comment}{ * connections, it creates a socket structure queued on so\_incomp by calling}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04028}04028 \textcolor{comment}{ * sonewconn().  When the connection is established, soisconnected() is}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04029}04029 \textcolor{comment}{ * called, and transfers the socket structure to so\_comp, making it available}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04030}04030 \textcolor{comment}{ * to accept().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04031}04031 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04032}04032 \textcolor{comment}{ * If a socket is closed with sockets on either so\_incomp or so\_comp, these}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04033}04033 \textcolor{comment}{ * sockets are dropped.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04034}04034 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04035}04035 \textcolor{comment}{ * If higher-\/level protocols are implemented in the kernel, the wakeups done}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04036}04036 \textcolor{comment}{ * here will sometimes cause software-\/interrupt process scheduling.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04037}04037 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04038}04038 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04039}\mbox{\hyperlink{uipc__socket_8c_ac4a7f5daced202a8d1788c1d4a615247}{04039}} \mbox{\hyperlink{uipc__socket_8c_ac4a7f5daced202a8d1788c1d4a615247}{soisconnecting}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04040}04040 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04041}04041 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04042}04042         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04043}04043         so-\/>so\_state \&= \string~(SS\_ISCONNECTED|SS\_ISDISCONNECTING);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04044}04044         so-\/>so\_state |= SS\_ISCONNECTING;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04045}04045         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04046}04046 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04047}04047 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04048}04048 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04049}\mbox{\hyperlink{uipc__socket_8c_a7db5b93535cfeeec3ce4fb9193b19c39}{04049}} \mbox{\hyperlink{uipc__socket_8c_a7db5b93535cfeeec3ce4fb9193b19c39}{soisconnected}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04050}04050 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04051}04051         \textcolor{keywordtype}{bool} last \_\_diagused;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04052}04052 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04053}04053         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04054}04054         so-\/>so\_state \&= \string~(SS\_ISCONNECTING|SS\_ISDISCONNECTING|SS\_ISCONFIRMING);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04055}04055         so-\/>so\_state |= SS\_ISCONNECTED;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04056}04056 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04057}04057         \textcolor{keywordflow}{if} (so-\/>so\_qstate == SQ\_INCOMP) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04058}04058                 \textcolor{keyword}{struct }socket *head = so-\/>so\_listen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04059}04059                 \textcolor{keywordtype}{int} ret;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04060}04060 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04061}04061                 KASSERT(head, (\textcolor{stringliteral}{"{}\%s: so \%p on incomp of NULL"{}}, \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04062}04062                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04063}04063 \textcolor{comment}{                 * Promoting a socket from incomplete queue to complete, we}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04064}04064 \textcolor{comment}{                 * need to go through reverse order of locking.  We first do}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04065}04065 \textcolor{comment}{                 * trylock, and if that doesn't succeed, we go the hard way}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04066}04066 \textcolor{comment}{                 * leaving a reference and rechecking consistency after proper}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04067}04067 \textcolor{comment}{                 * locking.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04068}04068 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04069}04069                 \textcolor{keywordflow}{if} (\_\_predict\_false(SOLISTEN\_TRYLOCK(head) == 0)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04070}04070                         soref(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04071}04071                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04072}04072                         SOLISTEN\_LOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04073}04073                         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04074}04074                         \textcolor{keywordflow}{if} (\_\_predict\_false(head != so-\/>so\_listen)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04075}04075                                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04076}04076 \textcolor{comment}{                                 * The socket went off the listen queue,}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04077}04077 \textcolor{comment}{                                 * should be lost race to close(2) of sol.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04078}04078 \textcolor{comment}{                                 * The socket is about to soabort().}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04079}04079 \textcolor{comment}{                                 */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04080}04080                                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04081}04081                                 \mbox{\hyperlink{uipc__socket_8c_ac3328ee2d74de136b477641516e4543f}{sorele\_locked}}(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04082}04082                                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04083}04083                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04084}04084                         last = refcount\_release(\&head-\/>so\_count);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04085}04085                         KASSERT(!last, (\textcolor{stringliteral}{"{}\%s: released last reference for \%p"{}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04086}04086                             \_\_func\_\_, head));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04087}04087                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04088}04088 again:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04089}04089                 \textcolor{keywordflow}{if} ((so-\/>so\_options \& SO\_ACCEPTFILTER) == 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04090}04090                         TAILQ\_REMOVE(\&head-\/>sol\_incomp, so, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04091}04091                         head-\/>sol\_incqlen-\/-\/;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04092}04092                         TAILQ\_INSERT\_TAIL(\&head-\/>sol\_comp, so, so\_list);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04093}04093                         head-\/>sol\_qlen++;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04094}04094                         so-\/>so\_qstate = SQ\_COMP;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04095}04095                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04096}04096                         \mbox{\hyperlink{uipc__socket_8c_a53f0083b2aea01e2a04594b9dba99b30}{solisten\_wakeup}}(head);   \textcolor{comment}{/* unlocks */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04097}04097                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04098}04098                         SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04099}04099                         \mbox{\hyperlink{uipc__socket_8c_ada983a0a18ffda3a63668030b683e5f4}{soupcall\_set}}(so, SO\_RCV,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04100}04100                             head-\/>sol\_accept\_filter-\/>accf\_callback,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04101}04101                             head-\/>sol\_accept\_filter\_arg);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04102}04102                         so-\/>so\_options \&= \string~SO\_ACCEPTFILTER;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04103}04103                         ret = head-\/>sol\_accept\_filter-\/>accf\_callback(so,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04104}04104                             head-\/>sol\_accept\_filter\_arg, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04105}04105                         \textcolor{keywordflow}{if} (ret == SU\_ISCONNECTED) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04106}04106                                 \mbox{\hyperlink{uipc__socket_8c_af0e04dbcdcaa412152aaad6600e9ef30}{soupcall\_clear}}(so, SO\_RCV);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04107}04107                                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04108}04108                                 \textcolor{keywordflow}{goto} again;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04109}04109                         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04110}04110                         SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04111}04111                         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04112}04112                         SOLISTEN\_UNLOCK(head);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04113}04113                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04114}04114                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04115}04115         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04116}04116         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04117}04117         \mbox{\hyperlink{kern__synch_8c_ab5e31e48f559b1015c09a61a83c59f19}{wakeup}}(\&so-\/>so\_timeo);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04118}04118         sorwakeup(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04119}04119         sowwakeup(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04120}04120 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04121}04121 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04122}04122 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04123}\mbox{\hyperlink{uipc__socket_8c_aba6490c4f7d0848b0a059d75faf07069}{04123}} \mbox{\hyperlink{uipc__socket_8c_aba6490c4f7d0848b0a059d75faf07069}{soisdisconnecting}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04124}04124 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04125}04125 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04126}04126         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04127}04127         so-\/>so\_state \&= \string~SS\_ISCONNECTING;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04128}04128         so-\/>so\_state |= SS\_ISDISCONNECTING;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04129}04129 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04130}04130         \textcolor{keywordflow}{if} (!SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04131}04131                 SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04132}04132                 \mbox{\hyperlink{uipc__sockbuf_8c_a99cbc043752d16aa2f880772f865d4d2}{socantrcvmore\_locked}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04133}04133                 SOCKBUF\_LOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04134}04134                 \mbox{\hyperlink{uipc__sockbuf_8c_a169691032222d2ac6c1e90ef4683d04b}{socantsendmore\_locked}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04135}04135         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04136}04136         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04137}04137         \mbox{\hyperlink{kern__synch_8c_ab5e31e48f559b1015c09a61a83c59f19}{wakeup}}(\&so-\/>so\_timeo);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04138}04138 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04139}04139 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04140}04140 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04141}\mbox{\hyperlink{uipc__socket_8c_a4152a43b45fd80a24574e1453c6a26bf}{04141}} \mbox{\hyperlink{uipc__socket_8c_a4152a43b45fd80a24574e1453c6a26bf}{soisdisconnected}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04142}04142 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04143}04143 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04144}04144         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04145}04145 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04146}04146         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04147}04147 \textcolor{comment}{         * There is at least one reader of so\_state that does not}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04148}04148 \textcolor{comment}{         * acquire socket lock, namely soreceive\_generic().  Ensure}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04149}04149 \textcolor{comment}{         * that it never sees all flags that track connection status}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04150}04150 \textcolor{comment}{         * cleared, by ordering the update with a barrier semantic of}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04151}04151 \textcolor{comment}{         * our release thread fence.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04152}04152 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04153}04153         so-\/>so\_state |= SS\_ISDISCONNECTED;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04154}04154         atomic\_thread\_fence\_rel();}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04155}04155         so-\/>so\_state \&= \string~(SS\_ISCONNECTING|SS\_ISCONNECTED|SS\_ISDISCONNECTING);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04156}04156 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04157}04157         \textcolor{keywordflow}{if} (!SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04158}04158                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04159}04159                 SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04160}04160                 \mbox{\hyperlink{uipc__sockbuf_8c_a99cbc043752d16aa2f880772f865d4d2}{socantrcvmore\_locked}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04161}04161                 SOCKBUF\_LOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04162}04162                 \mbox{\hyperlink{uipc__sockbuf_8c_ac5962acfd53a7362a6189a55a2ded68a}{sbdrop\_locked}}(\&so-\/>so\_snd, sbused(\&so-\/>so\_snd));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04163}04163                 \mbox{\hyperlink{uipc__sockbuf_8c_a169691032222d2ac6c1e90ef4683d04b}{socantsendmore\_locked}}(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04164}04164         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04165}04165                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04166}04166         \mbox{\hyperlink{kern__synch_8c_ab5e31e48f559b1015c09a61a83c59f19}{wakeup}}(\&so-\/>so\_timeo);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04167}04167 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04168}04168 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04169}04169 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04170}\mbox{\hyperlink{uipc__socket_8c_af34d13baffd9114a576f1fd4e2cc2ea0}{04170}} \mbox{\hyperlink{uipc__socket_8c_af34d13baffd9114a576f1fd4e2cc2ea0}{soiolock}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sx *sx, \textcolor{keywordtype}{int} \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}})}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04171}04171 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04172}04172         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04173}04173 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04174}04174         KASSERT((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& SBL\_VALID) == \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}},}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04175}04175             (\textcolor{stringliteral}{"{}soiolock: invalid flags \%\#x"{}}, \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}}));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04176}04176 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04177}04177         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& SBL\_WAIT) != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04178}04178                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& SBL\_NOINTR) != 0) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04179}04179                         sx\_xlock(sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04180}04180                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04181}04181                         error = sx\_xlock\_sig(sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04182}04182                         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04183}04183                                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04184}04184                 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04185}04185         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!sx\_try\_xlock(sx)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04186}04186                 \textcolor{keywordflow}{return} (EWOULDBLOCK);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04187}04187         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04188}04188 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04189}04189         \textcolor{keywordflow}{if} (\_\_predict\_false(SOLISTENING(so))) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04190}04190                 sx\_xunlock(sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04191}04191                 \textcolor{keywordflow}{return} (ENOTCONN);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04192}04192         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04193}04193         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04194}04194 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04195}04195 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04196}04196 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04197}\mbox{\hyperlink{uipc__socket_8c_affb16b3a1ed7cc0736e30c5e992e6d1f}{04197}} \mbox{\hyperlink{uipc__socket_8c_affb16b3a1ed7cc0736e30c5e992e6d1f}{soiounlock}}(\textcolor{keyword}{struct} sx *sx)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04198}04198 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04199}04199         sx\_xunlock(sx);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04200}04200 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04201}04201 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04202}04202 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04203}04203 \textcolor{comment}{ * Make a copy of a sockaddr in a malloced buffer of type M\_SONAME.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04204}04204 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04205}04205 \textcolor{keyword}{struct }sockaddr *}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04206}\mbox{\hyperlink{uipc__socket_8c_aca7434add845c908cf772490a53efffe}{04206}} \mbox{\hyperlink{uipc__socket_8c_aca7434add845c908cf772490a53efffe}{sodupsockaddr}}(\textcolor{keyword}{const} \textcolor{keyword}{struct} sockaddr *sa, \textcolor{keywordtype}{int} mflags)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04207}04207 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04208}04208         \textcolor{keyword}{struct }sockaddr *sa2;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04209}04209 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04210}04210         sa2 = \mbox{\hyperlink{kern__malloc_8c_a13e924a88f20870d2d55e3f7fb660352}{malloc}}(sa-\/>sa\_len, M\_SONAME, mflags);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04211}04211         \textcolor{keywordflow}{if} (sa2)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04212}04212                 bcopy(sa, sa2, sa-\/>sa\_len);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04213}04213         \textcolor{keywordflow}{return} sa2;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04214}04214 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04215}04215 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04216}04216 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04217}04217 \textcolor{comment}{ * Register per-\/socket destructor.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04218}04218 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04219}04219 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04220}\mbox{\hyperlink{uipc__socket_8c_aa2d06b487366e60dfd2bc3080913afe4}{04220}} \mbox{\hyperlink{uipc__socket_8c_aa2d06b487366e60dfd2bc3080913afe4}{sodtor\_set}}(\textcolor{keyword}{struct} socket *so, so\_dtor\_t *func)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04221}04221 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04222}04222 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04223}04223         SOCK\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04224}04224         so-\/>so\_dtor = func;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04225}04225 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04226}04226 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04227}04227 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04228}04228 \textcolor{comment}{ * Register per-\/socket buffer upcalls.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04229}04229 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04230}04230 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04231}\mbox{\hyperlink{uipc__socket_8c_ada983a0a18ffda3a63668030b683e5f4}{04231}} \mbox{\hyperlink{uipc__socket_8c_ada983a0a18ffda3a63668030b683e5f4}{soupcall\_set}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} which, so\_upcall\_t func, \textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04232}04232 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04233}04233         \textcolor{keyword}{struct }sockbuf *sb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04234}04234 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04235}04235         KASSERT(!SOLISTENING(so), (\textcolor{stringliteral}{"{}\%s: so \%p listening"{}}, \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04236}04236 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04237}04237         \textcolor{keywordflow}{switch} (which) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04238}04238         \textcolor{keywordflow}{case} SO\_RCV:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04239}04239                 sb = \&so-\/>so\_rcv;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04240}04240                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04241}04241         \textcolor{keywordflow}{case} SO\_SND:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04242}04242                 sb = \&so-\/>so\_snd;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04243}04243                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04244}04244         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04245}04245                 \mbox{\hyperlink{kern__shutdown_8c_ad1f1a1dc0581a11b597453f148106393}{panic}}(\textcolor{stringliteral}{"{}soupcall\_set: bad which"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04246}04246         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04247}04247         SOCKBUF\_LOCK\_ASSERT(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04248}04248         sb-\/>sb\_upcall = func;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04249}04249         sb-\/>sb\_upcallarg = arg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04250}04250         sb-\/>sb\_flags |= SB\_UPCALL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04251}04251 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04252}04252 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04253}04253 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04254}\mbox{\hyperlink{uipc__socket_8c_af0e04dbcdcaa412152aaad6600e9ef30}{04254}} \mbox{\hyperlink{uipc__socket_8c_af0e04dbcdcaa412152aaad6600e9ef30}{soupcall\_clear}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} which)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04255}04255 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04256}04256         \textcolor{keyword}{struct }sockbuf *sb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04257}04257 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04258}04258         KASSERT(!SOLISTENING(so), (\textcolor{stringliteral}{"{}\%s: so \%p listening"{}}, \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04259}04259 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04260}04260         \textcolor{keywordflow}{switch} (which) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04261}04261         \textcolor{keywordflow}{case} SO\_RCV:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04262}04262                 sb = \&so-\/>so\_rcv;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04263}04263                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04264}04264         \textcolor{keywordflow}{case} SO\_SND:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04265}04265                 sb = \&so-\/>so\_snd;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04266}04266                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04267}04267         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04268}04268                 \mbox{\hyperlink{kern__shutdown_8c_ad1f1a1dc0581a11b597453f148106393}{panic}}(\textcolor{stringliteral}{"{}soupcall\_clear: bad which"{}});}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04269}04269         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04270}04270         SOCKBUF\_LOCK\_ASSERT(sb);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04271}04271         KASSERT(sb-\/>sb\_upcall != NULL,}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04272}04272             (\textcolor{stringliteral}{"{}\%s: so \%p no upcall to clear"{}}, \_\_func\_\_, so));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04273}04273         sb-\/>sb\_upcall = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04274}04274         sb-\/>sb\_upcallarg = NULL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04275}04275         sb-\/>sb\_flags \&= \string~SB\_UPCALL;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04276}04276 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04277}04277 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04278}04278 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04279}\mbox{\hyperlink{uipc__socket_8c_a0f1fb685854e43c1a95e5c3cc8be626d}{04279}} \mbox{\hyperlink{uipc__socket_8c_a0f1fb685854e43c1a95e5c3cc8be626d}{solisten\_upcall\_set}}(\textcolor{keyword}{struct} socket *so, so\_upcall\_t func, \textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04280}04280 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04281}04281 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04282}04282         SOLISTEN\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04283}04283         so-\/>sol\_upcall = func;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04284}04284         so-\/>sol\_upcallarg = arg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04285}04285 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04286}04286 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04287}04287 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04288}\mbox{\hyperlink{uipc__socket_8c_a73ec27450488af1257b58c83f3c09c26}{04288}} \mbox{\hyperlink{uipc__socket_8c_a73ec27450488af1257b58c83f3c09c26}{so\_rdknl\_lock}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04289}04289 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04290}04290         \textcolor{keyword}{struct }socket *so = arg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04291}04291 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04292}04292         \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04293}04293                 SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04294}04294         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04295}04295                 SOCKBUF\_LOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04296}04296 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04297}04297 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04298}04298 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04299}\mbox{\hyperlink{uipc__socket_8c_ab8ffe6ae588b7e5252b6073701e4ee48}{04299}} \mbox{\hyperlink{uipc__socket_8c_ab8ffe6ae588b7e5252b6073701e4ee48}{so\_rdknl\_unlock}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04300}04300 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04301}04301         \textcolor{keyword}{struct }socket *so = arg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04302}04302 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04303}04303         \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04304}04304                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04305}04305         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04306}04306                 SOCKBUF\_UNLOCK(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04307}04307 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04308}04308 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04309}04309 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04310}\mbox{\hyperlink{uipc__socket_8c_a44baa810e5996c29a9784e8f29d2b156}{04310}} \mbox{\hyperlink{uipc__socket_8c_a44baa810e5996c29a9784e8f29d2b156}{so\_rdknl\_assert\_lock}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} what)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04311}04311 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04312}04312         \textcolor{keyword}{struct }socket *so = arg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04313}04313 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04314}04314         \textcolor{keywordflow}{if} (what == LA\_LOCKED) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04315}04315                 \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04316}04316                         SOCK\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04317}04317                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04318}04318                         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04319}04319         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04320}04320                 \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04321}04321                         SOCK\_UNLOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04322}04322                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04323}04323                         SOCKBUF\_UNLOCK\_ASSERT(\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04324}04324         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04325}04325 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04326}04326 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04327}04327 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04328}\mbox{\hyperlink{uipc__socket_8c_a07eaf32fb3031b83c272475a7617ccf1}{04328}} \mbox{\hyperlink{uipc__socket_8c_a07eaf32fb3031b83c272475a7617ccf1}{so\_wrknl\_lock}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04329}04329 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04330}04330         \textcolor{keyword}{struct }socket *so = arg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04331}04331 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04332}04332         \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04333}04333                 SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04334}04334         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04335}04335                 SOCKBUF\_LOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04336}04336 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04337}04337 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04338}04338 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04339}\mbox{\hyperlink{uipc__socket_8c_a3ed2a2de261da401d25b9c2e78330b90}{04339}} \mbox{\hyperlink{uipc__socket_8c_a3ed2a2de261da401d25b9c2e78330b90}{so\_wrknl\_unlock}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04340}04340 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04341}04341         \textcolor{keyword}{struct }socket *so = arg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04342}04342 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04343}04343         \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04344}04344                 SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04345}04345         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04346}04346                 SOCKBUF\_UNLOCK(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04347}04347 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04348}04348 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04349}04349 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04350}\mbox{\hyperlink{uipc__socket_8c_a1f6c3f66e4c47be4f6369e5b7fcbb57d}{04350}} \mbox{\hyperlink{uipc__socket_8c_a1f6c3f66e4c47be4f6369e5b7fcbb57d}{so\_wrknl\_assert\_lock}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} what)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04351}04351 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04352}04352         \textcolor{keyword}{struct }socket *so = arg;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04353}04353 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04354}04354         \textcolor{keywordflow}{if} (what == LA\_LOCKED) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04355}04355                 \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04356}04356                         SOCK\_LOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04357}04357                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04358}04358                         SOCKBUF\_LOCK\_ASSERT(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04359}04359         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04360}04360                 \textcolor{keywordflow}{if} (SOLISTENING(so))}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04361}04361                         SOCK\_UNLOCK\_ASSERT(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04362}04362                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04363}04363                         SOCKBUF\_UNLOCK\_ASSERT(\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04364}04364         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04365}04365 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04366}04366 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04367}04367 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04368}04368 \textcolor{comment}{ * Create an external-\/format (``xsocket'') structure using the information in}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04369}04369 \textcolor{comment}{ * the kernel-\/format socket structure pointed to by so.  This is done to}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04370}04370 \textcolor{comment}{ * reduce the spew of irrelevant information over this interface, to isolate}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04371}04371 \textcolor{comment}{ * user code from changes in the kernel structure, and potentially to provide}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04372}04372 \textcolor{comment}{ * information-\/hiding if we decide that some of this information should be}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04373}04373 \textcolor{comment}{ * hidden from users.}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04374}04374 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04375}04375 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04376}\mbox{\hyperlink{uipc__socket_8c_a96035980fbca6664bc69ea2dd7e062ff}{04376}} \mbox{\hyperlink{uipc__socket_8c_a96035980fbca6664bc69ea2dd7e062ff}{sotoxsocket}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} xsocket *xso)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04377}04377 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04378}04378 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04379}04379         bzero(xso, \textcolor{keyword}{sizeof}(*xso));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04380}04380         xso-\/>xso\_len = \textcolor{keyword}{sizeof} *xso;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04381}04381         xso-\/>xso\_so = (uintptr\_t)so;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04382}04382         xso-\/>so\_type = so-\/>so\_type;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04383}04383         xso-\/>so\_options = so-\/>so\_options;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04384}04384         xso-\/>so\_linger = so-\/>so\_linger;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04385}04385         xso-\/>so\_state = so-\/>so\_state;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04386}04386         xso-\/>so\_pcb = (uintptr\_t)so-\/>so\_pcb;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04387}04387         xso-\/>xso\_protocol = so-\/>so\_proto-\/>pr\_protocol;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04388}04388         xso-\/>xso\_family = so-\/>so\_proto-\/>pr\_domain-\/>dom\_family;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04389}04389         xso-\/>so\_timeo = so-\/>so\_timeo;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04390}04390         xso-\/>so\_error = so-\/>so\_error;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04391}04391         xso-\/>so\_uid = so-\/>so\_cred-\/>cr\_uid;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04392}04392         xso-\/>so\_pgid = so-\/>so\_sigio ? so-\/>so\_sigio-\/>sio\_pgid : 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04393}04393         if (SOLISTENING(so)) \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04394}04394                 xso-\/>so\_qlen = so-\/>sol\_qlen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04395}04395                 xso-\/>so\_incqlen = so-\/>sol\_incqlen;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04396}04396                 xso-\/>so\_qlimit = so-\/>sol\_qlimit;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04397}04397                 xso-\/>so\_oobmark = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04398}04398         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04399}04399                 xso-\/>so\_state |= so-\/>so\_qstate;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04400}04400                 xso-\/>so\_qlen = xso-\/>so\_incqlen = xso-\/>so\_qlimit = 0;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04401}04401                 xso-\/>so\_oobmark = so-\/>so\_oobmark;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04402}04402                 \mbox{\hyperlink{uipc__sockbuf_8c_a7db837ab4546250954482202d762e83e}{sbtoxsockbuf}}(\&so-\/>so\_snd, \&xso-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04403}04403                 \mbox{\hyperlink{uipc__sockbuf_8c_a7db837ab4546250954482202d762e83e}{sbtoxsockbuf}}(\&so-\/>so\_rcv, \&xso-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04404}04404         \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04405}04405 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04406}04406 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04407}04407 \textcolor{keyword}{struct }sockbuf *}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04408}\mbox{\hyperlink{uipc__socket_8c_af3fdc12d83918ddb7163ed3b5b04ac57}{04408}} \mbox{\hyperlink{uipc__socket_8c_af3fdc12d83918ddb7163ed3b5b04ac57}{so\_sockbuf\_rcv}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04409}04409 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04410}04410 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04411}04411         \textcolor{keywordflow}{return} (\&so-\/>so\_rcv);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04412}04412 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04413}04413 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04414}04414 \textcolor{keyword}{struct }sockbuf *}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04415}\mbox{\hyperlink{uipc__socket_8c_a3794822d5accec80a507c7e46e9dee7b}{04415}} \mbox{\hyperlink{uipc__socket_8c_a3794822d5accec80a507c7e46e9dee7b}{so\_sockbuf\_snd}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04416}04416 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04417}04417 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04418}04418         \textcolor{keywordflow}{return} (\&so-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04419}04419 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04420}04420 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04421}04421 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04422}\mbox{\hyperlink{uipc__socket_8c_a8ffb67704f17531ee6f4c078f3cd6797}{04422}} \mbox{\hyperlink{uipc__socket_8c_a8ffb67704f17531ee6f4c078f3cd6797}{so\_state\_get}}(\textcolor{keyword}{const} \textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04423}04423 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04424}04424 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04425}04425         \textcolor{keywordflow}{return} (so-\/>so\_state);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04426}04426 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04427}04427 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04428}04428 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04429}\mbox{\hyperlink{uipc__socket_8c_a4198d1567660b147208bf5bd1edd75d3}{04429}} \mbox{\hyperlink{uipc__socket_8c_a4198d1567660b147208bf5bd1edd75d3}{so\_state\_set}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} val)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04430}04430 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04431}04431 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04432}04432         so-\/>so\_state = val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04433}04433 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04434}04434 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04435}04435 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04436}\mbox{\hyperlink{uipc__socket_8c_a60a4a562da07c733f61f31e553249e71}{04436}} \mbox{\hyperlink{uipc__socket_8c_a60a4a562da07c733f61f31e553249e71}{so\_options\_get}}(\textcolor{keyword}{const} \textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04437}04437 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04438}04438 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04439}04439         \textcolor{keywordflow}{return} (so-\/>so\_options);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04440}04440 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04441}04441 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04442}04442 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04443}\mbox{\hyperlink{uipc__socket_8c_ab9f795d35c6b4fbffc1bef679968325b}{04443}} \mbox{\hyperlink{uipc__socket_8c_ab9f795d35c6b4fbffc1bef679968325b}{so\_options\_set}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} val)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04444}04444 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04445}04445 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04446}04446         so-\/>so\_options = val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04447}04447 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04448}04448 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04449}04449 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04450}\mbox{\hyperlink{uipc__socket_8c_a78460082370c8be31169dea7bb0c3158}{04450}} \mbox{\hyperlink{uipc__socket_8c_a78460082370c8be31169dea7bb0c3158}{so\_error\_get}}(\textcolor{keyword}{const} \textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04451}04451 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04452}04452 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04453}04453         \textcolor{keywordflow}{return} (so-\/>so\_error);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04454}04454 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04455}04455 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04456}04456 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04457}\mbox{\hyperlink{uipc__socket_8c_a8fca4b75abee16a3b4a4a19cabfb3462}{04457}} \mbox{\hyperlink{uipc__socket_8c_a8fca4b75abee16a3b4a4a19cabfb3462}{so\_error\_set}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} val)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04458}04458 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04459}04459 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04460}04460         so-\/>so\_error = val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04461}04461 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04462}04462 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04463}04463 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04464}\mbox{\hyperlink{uipc__socket_8c_a6745b079165f4f089bd46a50893e4e06}{04464}} \mbox{\hyperlink{uipc__socket_8c_a6745b079165f4f089bd46a50893e4e06}{so\_linger\_get}}(\textcolor{keyword}{const} \textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04465}04465 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04466}04466 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04467}04467         \textcolor{keywordflow}{return} (so-\/>so\_linger);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04468}04468 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04469}04469 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04470}04470 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04471}\mbox{\hyperlink{uipc__socket_8c_a3e0d74a459485fc8ad6392ccf5b18bbc}{04471}} \mbox{\hyperlink{uipc__socket_8c_a3e0d74a459485fc8ad6392ccf5b18bbc}{so\_linger\_set}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} val)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04472}04472 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04473}04473 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04474}04474         KASSERT(val >= 0 \&\& val <= USHRT\_MAX \&\& val <= (INT\_MAX / \mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}}),}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04475}04475             (\textcolor{stringliteral}{"{}\%s: val \%d out of range"{}}, \_\_func\_\_, val));}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04476}04476 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04477}04477         so-\/>so\_linger = val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04478}04478 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04479}04479 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04480}04480 \textcolor{keyword}{struct }protosw *}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04481}\mbox{\hyperlink{uipc__socket_8c_a371985f574d063dc729a8aef03ca0948}{04481}} \mbox{\hyperlink{uipc__socket_8c_a371985f574d063dc729a8aef03ca0948}{so\_protosw\_get}}(\textcolor{keyword}{const} \textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04482}04482 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04483}04483 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04484}04484         \textcolor{keywordflow}{return} (so-\/>so\_proto);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04485}04485 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04486}04486 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04487}04487 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04488}\mbox{\hyperlink{uipc__socket_8c_a038bd9d8742ae6117bc6ce23ec875e76}{04488}} \mbox{\hyperlink{uipc__socket_8c_a038bd9d8742ae6117bc6ce23ec875e76}{so\_protosw\_set}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} protosw *val)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04489}04489 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04490}04490 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04491}04491         so-\/>so\_proto = val;}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04492}04492 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04493}04493 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04494}04494 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04495}\mbox{\hyperlink{uipc__socket_8c_acc4daf8b6a8b20f89efc065984a1442c}{04495}} \mbox{\hyperlink{uipc__socket_8c_acc4daf8b6a8b20f89efc065984a1442c}{so\_sorwakeup}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04496}04496 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04497}04497 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04498}04498         sorwakeup(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04499}04499 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04500}04500 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04501}04501 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04502}\mbox{\hyperlink{uipc__socket_8c_ac296c37225249eedec70854d5395691f}{04502}} \mbox{\hyperlink{uipc__socket_8c_ac296c37225249eedec70854d5395691f}{so\_sowwakeup}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04503}04503 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04504}04504 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04505}04505         sowwakeup(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04506}04506 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04507}04507 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04508}04508 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04509}\mbox{\hyperlink{uipc__socket_8c_a60651aba47649ae53acac5cab434ead0}{04509}} \mbox{\hyperlink{uipc__socket_8c_a60651aba47649ae53acac5cab434ead0}{so\_sorwakeup\_locked}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04510}04510 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04511}04511 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04512}04512         sorwakeup\_locked(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04513}04513 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04514}04514 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04515}04515 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04516}\mbox{\hyperlink{uipc__socket_8c_a219bd09451733a0a51af0426feca95af}{04516}} \mbox{\hyperlink{uipc__socket_8c_a219bd09451733a0a51af0426feca95af}{so\_sowwakeup\_locked}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04517}04517 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04518}04518 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04519}04519         sowwakeup\_locked(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04520}04520 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04521}04521 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04522}04522 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04523}\mbox{\hyperlink{uipc__socket_8c_a9576e9b1f0ea5c96078dea94de598086}{04523}} \mbox{\hyperlink{uipc__socket_8c_a9576e9b1f0ea5c96078dea94de598086}{so\_lock}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04524}04524 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04525}04525 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04526}04526         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04527}04527 \}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04528}04528 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04529}04529 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04530}\mbox{\hyperlink{uipc__socket_8c_a750c726bde84e379d817ad5b96d280f9}{04530}} \mbox{\hyperlink{uipc__socket_8c_a750c726bde84e379d817ad5b96d280f9}{so\_unlock}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04531}04531 \{}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04532}04532 }
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04533}04533         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{uipc__socket_8c_source_l04534}04534 \}}

\end{DoxyCode}
