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

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

84 * these interfaces are not preferred, and should be avoided.
85 *
86 * XXXRW: The behavior of sockets after soclose() but before the last
87 * sorele() is poorly defined. We can probably entirely eliminate them with
88 * a little work, since consumers are managing references anyway.
89 */
90
91#include <sys/cdefs.h>
92__FBSDID("$FreeBSD: head/sys/kern/uipc_socket.c 157359 2006-04-01 10:45:52Z rwatson $");
93
94#include "opt_inet.h"
95#include "opt_mac.h"
96#include "opt_zero.h"
97#include "opt_compat.h"
98
99#include <sys/param.h>
100#include <sys/systm.h>

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

538 SOCK_LOCK(so);
539 KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF"));
540 so->so_state |= SS_NOFDREF;
541 sorele(so);
542 return (error);
543}
544
545/*
546 * soabort() must not be called with any socket locks held, as it calls
547 * into the protocol, which will call back into the socket code causing
548 * it to acquire additional socket locks that may cause recursion or lock
549 * order reversals.
550 */
551void
552soabort(so)
553 struct socket *so;
554{
555 int error;
556
557 error = (*so->so_proto->pr_usrreqs->pru_abort)(so);
558 if (error) {
559 ACCEPT_LOCK();
560 SOCK_LOCK(so);
561 sotryfree(so); /* note: does not decrement the ref count */
562 }
563}
564
565int
566soaccept(so, nam)
567 struct socket *so;
568 struct sockaddr **nam;
569{
570 int error;

--- 1863 unchanged lines hidden ---