uipc_usrreq.c (91418) | uipc_usrreq.c (92654) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94 |
34 * $FreeBSD: head/sys/kern/uipc_usrreq.c 91418 2002-02-27 19:14:01Z jhb $ | 34 * $FreeBSD: head/sys/kern/uipc_usrreq.c 92654 2002-03-19 09:11:49Z jeff $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/kernel.h> 40#include <sys/fcntl.h> 41#include <sys/domain.h> 42#include <sys/filedesc.h> --- 13 unchanged lines hidden (view full) --- 56#include <sys/un.h> 57#include <sys/unpcb.h> 58#include <sys/vnode.h> 59#include <sys/jail.h> 60#include <sys/sx.h> 61 62#include <vm/vm_zone.h> 63 | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/kernel.h> 40#include <sys/fcntl.h> 41#include <sys/domain.h> 42#include <sys/filedesc.h> --- 13 unchanged lines hidden (view full) --- 56#include <sys/un.h> 57#include <sys/unpcb.h> 58#include <sys/vnode.h> 59#include <sys/jail.h> 60#include <sys/sx.h> 61 62#include <vm/vm_zone.h> 63 |
64static struct vm_zone *unp_zone; | 64static vm_zone_t unp_zone; |
65static unp_gen_t unp_gencnt; 66static u_int unp_count; 67 68static struct unp_head unp_shead, unp_dhead; 69 70/* 71 * Unix communications domain. 72 * --- 1285 unchanged lines hidden (view full) --- 1358 * descriptor. Then, we call sorflush ourself, since we know 1359 * it is a Unix domain socket anyhow. After we destroy all the 1360 * rights carried in messages, we do a last closef to get rid 1361 * of our extra reference. This is the last close, and the 1362 * unp_detach etc will shut down the socket. 1363 * 1364 * 91/09/19, bsy@cs.cmu.edu 1365 */ | 65static unp_gen_t unp_gencnt; 66static u_int unp_count; 67 68static struct unp_head unp_shead, unp_dhead; 69 70/* 71 * Unix communications domain. 72 * --- 1285 unchanged lines hidden (view full) --- 1358 * descriptor. Then, we call sorflush ourself, since we know 1359 * it is a Unix domain socket anyhow. After we destroy all the 1360 * rights carried in messages, we do a last closef to get rid 1361 * of our extra reference. This is the last close, and the 1362 * unp_detach etc will shut down the socket. 1363 * 1364 * 91/09/19, bsy@cs.cmu.edu 1365 */ |
1366 extra_ref = malloc(nfiles * sizeof(struct file *), M_FILE, M_WAITOK); | 1366 extra_ref = malloc(nfiles * sizeof(struct file *), M_TEMP, M_WAITOK); |
1367 sx_slock(&filelist_lock); 1368 for (nunref = 0, fp = LIST_FIRST(&filehead), fpp = extra_ref; fp != 0; 1369 fp = nextfp) { 1370 nextfp = LIST_NEXT(fp, f_list); 1371 FILE_LOCK(fp); 1372 /* 1373 * If it's not open, skip it 1374 */ --- 24 unchanged lines hidden (view full) --- 1399 if (tfp->f_type == DTYPE_SOCKET && tfp->f_data != NULL) { 1400 FILE_UNLOCK(tfp); 1401 sorflush((struct socket *)(tfp->f_data)); 1402 } else 1403 FILE_UNLOCK(tfp); 1404 } 1405 for (i = nunref, fpp = extra_ref; --i >= 0; ++fpp) 1406 closef(*fpp, (struct thread *) NULL); | 1367 sx_slock(&filelist_lock); 1368 for (nunref = 0, fp = LIST_FIRST(&filehead), fpp = extra_ref; fp != 0; 1369 fp = nextfp) { 1370 nextfp = LIST_NEXT(fp, f_list); 1371 FILE_LOCK(fp); 1372 /* 1373 * If it's not open, skip it 1374 */ --- 24 unchanged lines hidden (view full) --- 1399 if (tfp->f_type == DTYPE_SOCKET && tfp->f_data != NULL) { 1400 FILE_UNLOCK(tfp); 1401 sorflush((struct socket *)(tfp->f_data)); 1402 } else 1403 FILE_UNLOCK(tfp); 1404 } 1405 for (i = nunref, fpp = extra_ref; --i >= 0; ++fpp) 1406 closef(*fpp, (struct thread *) NULL); |
1407 free((caddr_t)extra_ref, M_FILE); | 1407 free((caddr_t)extra_ref, M_TEMP); |
1408 unp_gcing = 0; 1409} 1410 1411void 1412unp_dispose(m) 1413 struct mbuf *m; 1414{ 1415 --- 86 unchanged lines hidden --- | 1408 unp_gcing = 0; 1409} 1410 1411void 1412unp_dispose(m) 1413 struct mbuf *m; 1414{ 1415 --- 86 unchanged lines hidden --- |