ncp_conn.c (66538) | ncp_conn.c (66615) |
---|---|
1/* 2 * Copyright (c) 1999, Boris Popov 3 * 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 --- 14 unchanged lines hidden (view full) --- 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. | 1/* 2 * Copyright (c) 1999, Boris Popov 3 * 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 --- 14 unchanged lines hidden (view full) --- 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. |
31 * $FreeBSD: head/sys/netncp/ncp_conn.c 66538 2000-10-02 09:10:22Z bp $ | 31 * $FreeBSD: head/sys/netncp/ncp_conn.c 66615 2000-10-04 01:29:17Z jasone $ |
32 * 33 * Connection tables 34 */ 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/malloc.h> 39#include <sys/proc.h> --- 34 unchanged lines hidden (view full) --- 74int 75ncp_conn_init(void) { 76 lockinit(&listlock, PSOCK, "ncpll", 0, 0); 77 lockinit(&lhlock, PSOCK, "ncplh", 0, 0); 78 return 0; 79} 80 81int | 32 * 33 * Connection tables 34 */ 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/malloc.h> 39#include <sys/proc.h> --- 34 unchanged lines hidden (view full) --- 74int 75ncp_conn_init(void) { 76 lockinit(&listlock, PSOCK, "ncpll", 0, 0); 77 lockinit(&lhlock, PSOCK, "ncplh", 0, 0); 78 return 0; 79} 80 81int |
82ncp_conn_destroy(void) { 83 lockdestroy(&listlock); 84 lockdestroy(&lhlock); 85 return 0; 86} 87 88int |
|
82ncp_conn_locklist(int flags, struct proc *p){ 83 return lockmgr(&listlock, flags | LK_CANRECURSE, 0, p); 84} 85 86void 87ncp_conn_unlocklist(struct proc *p){ 88 lockmgr(&listlock, LK_RELEASE, 0, p); 89} --- 136 unchanged lines hidden (view full) --- 226 * Mark conn as died and wait for other process 227 */ 228 ncp->nc_id = 0; 229 ncp_conn_unlock(ncp,ncp->procp); 230 /* 231 * if signal is raised - how I do react ? 232 */ 233 lockmgr(&ncp->nc_lock, LK_DRAIN, 0, ncp->procp); | 89ncp_conn_locklist(int flags, struct proc *p){ 90 return lockmgr(&listlock, flags | LK_CANRECURSE, 0, p); 91} 92 93void 94ncp_conn_unlocklist(struct proc *p){ 95 lockmgr(&listlock, LK_RELEASE, 0, p); 96} --- 136 unchanged lines hidden (view full) --- 233 * Mark conn as died and wait for other process 234 */ 235 ncp->nc_id = 0; 236 ncp_conn_unlock(ncp,ncp->procp); 237 /* 238 * if signal is raised - how I do react ? 239 */ 240 lockmgr(&ncp->nc_lock, LK_DRAIN, 0, ncp->procp); |
241 lockdestroy(&ncp->nc_lock); |
|
234 while (ncp->nc_lwant) { 235 printf("lwant = %d\n", ncp->nc_lwant); 236 tsleep(&ncp->nc_lwant, PZERO,"ncpdr",2*hz); 237 } 238 ncp_conn_locklist(LK_EXCLUSIVE, ncp->procp); 239 /* 240 * It is possible, that other process destroy connection while we draining, 241 * and free it. So, we must rescan list --- 298 unchanged lines hidden --- | 242 while (ncp->nc_lwant) { 243 printf("lwant = %d\n", ncp->nc_lwant); 244 tsleep(&ncp->nc_lwant, PZERO,"ncpdr",2*hz); 245 } 246 ncp_conn_locklist(LK_EXCLUSIVE, ncp->procp); 247 /* 248 * It is possible, that other process destroy connection while we draining, 249 * and free it. So, we must rescan list --- 298 unchanged lines hidden --- |