1*252f0718Sderaadt /* $OpenBSD: handles.c,v 1.3 1997/09/17 23:09:35 deraadt Exp $ */ 22950da7fSmillert 3084c2ccbSderaadt /* 4084c2ccbSderaadt * Copyright (c) 1995 5084c2ccbSderaadt * A.R. Gordon (andrew.gordon@net-tel.co.uk). All rights reserved. 6084c2ccbSderaadt * 7084c2ccbSderaadt * Redistribution and use in source and binary forms, with or without 8084c2ccbSderaadt * modification, are permitted provided that the following conditions 9084c2ccbSderaadt * are met: 10084c2ccbSderaadt * 1. Redistributions of source code must retain the above copyright 11084c2ccbSderaadt * notice, this list of conditions and the following disclaimer. 12084c2ccbSderaadt * 2. Redistributions in binary form must reproduce the above copyright 13084c2ccbSderaadt * notice, this list of conditions and the following disclaimer in the 14084c2ccbSderaadt * documentation and/or other materials provided with the distribution. 15084c2ccbSderaadt * 3. All advertising materials mentioning features or use of this software 16084c2ccbSderaadt * must display the following acknowledgement: 17084c2ccbSderaadt * This product includes software developed for the FreeBSD project 18084c2ccbSderaadt * 4. Neither the name of the author nor the names of any co-contributors 19084c2ccbSderaadt * may be used to endorse or promote products derived from this software 20084c2ccbSderaadt * without specific prior written permission. 21084c2ccbSderaadt * 22084c2ccbSderaadt * THIS SOFTWARE IS PROVIDED BY ANDREW GORDON AND CONTRIBUTORS ``AS IS'' AND 23084c2ccbSderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24084c2ccbSderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25084c2ccbSderaadt * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 26084c2ccbSderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27084c2ccbSderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28084c2ccbSderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29084c2ccbSderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30084c2ccbSderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31084c2ccbSderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32084c2ccbSderaadt * SUCH DAMAGE. 33084c2ccbSderaadt * 34084c2ccbSderaadt */ 35084c2ccbSderaadt 36084c2ccbSderaadt 37084c2ccbSderaadt 38084c2ccbSderaadt #include "nlm_prot.h" 39084c2ccbSderaadt 40084c2ccbSderaadt /* ------------------------------------------------------------------------- */ 41084c2ccbSderaadt /* 42084c2ccbSderaadt 43084c2ccbSderaadt 44084c2ccbSderaadt * need to find all fds in use by a host and free them when host crashes 45084c2ccbSderaadt (need not be efficient) 46084c2ccbSderaadt 47084c2ccbSderaadt * need to find fd corresponding to <inode, device> 48084c2ccbSderaadt 49084c2ccbSderaadt */ 50084c2ccbSderaadt 51*252f0718Sderaadt typedef struct fdinfo { 52084c2ccbSderaadt int fd; /* The file descriptor itself */ 53084c2ccbSderaadt int ref_count; /* Count of hosts using the fd - fd is */ 54084c2ccbSderaadt /* closed when this reaches zero */ 55084c2ccbSderaadt ino_t inode_no; /* The inode number of this file. */ 56084c2ccbSderaadt dev_t device; /* device on which the file lives. */ 57084c2ccbSderaadt struct fdinfo *next; /* Chain of FdInfo structures */ 58084c2ccbSderaadt struct fdinfo *prev; 59084c2ccbSderaadt } FdInfo; 60