1139825Simp/*-
2108524Salfred * Copyright (c) 1990, 1993
3108524Salfred *	The Regents of the University of California.  All rights reserved.
4108524Salfred *
5108524Salfred * Redistribution and use in source and binary forms, with or without
6108524Salfred * modification, are permitted provided that the following conditions
7108524Salfred * are met:
8108524Salfred * 1. Redistributions of source code must retain the above copyright
9108524Salfred *    notice, this list of conditions and the following disclaimer.
10108524Salfred * 2. Redistributions in binary form must reproduce the above copyright
11108524Salfred *    notice, this list of conditions and the following disclaimer in the
12108524Salfred *    documentation and/or other materials provided with the distribution.
13108524Salfred * 4. Neither the name of the University nor the names of its contributors
14108524Salfred *    may be used to endorse or promote products derived from this software
15108524Salfred *    without specific prior written permission.
16108524Salfred *
17108524Salfred * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18108524Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19108524Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20108524Salfred * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21108524Salfred * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22108524Salfred * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23108524Salfred * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24108524Salfred * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25108524Salfred * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26108524Salfred * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27108524Salfred * SUCH DAMAGE.
28108524Salfred *
29108524Salfred *	@(#)filedesc.h	8.1 (Berkeley) 6/2/93
30108524Salfred * $FreeBSD$
31108524Salfred */
32108524Salfred
33108524Salfred#ifndef _SYS_SIGIO_H_
34108524Salfred#define _SYS_SIGIO_H_
35108524Salfred
36108524Salfred/*
37108524Salfred * This structure holds the information needed to send a SIGIO or
38108524Salfred * a SIGURG signal to a process or process group when new data arrives
39108524Salfred * on a device or socket.  The structure is placed on an SLIST belonging
40108524Salfred * to the proc or pgrp so that the entire list may be revoked when the
41108524Salfred * process exits or the process group disappears.
42108524Salfred *
43108524Salfred * (c)	const
44108524Salfred * (pg)	locked by either the process or process group lock
45108524Salfred */
46108524Salfredstruct sigio {
47108524Salfred	union {
48108524Salfred		struct	proc *siu_proc; /* (c)	process to receive SIGIO/SIGURG */
49108524Salfred		struct	pgrp *siu_pgrp; /* (c)	process group to receive ... */
50108524Salfred	} sio_u;
51108524Salfred	SLIST_ENTRY(sigio) sio_pgsigio;	/* (pg)	sigio's for process or group */
52108524Salfred	struct	sigio **sio_myref;	/* (c)	location of the pointer that holds
53108524Salfred					 * 	the reference to this structure */
54108524Salfred	struct	ucred *sio_ucred;	/* (c)	current credentials */
55108524Salfred	pid_t	sio_pgid;		/* (c)	pgid for signals */
56108524Salfred};
57108524Salfred#define	sio_proc	sio_u.siu_proc
58108524Salfred#define	sio_pgrp	sio_u.siu_pgrp
59108524Salfred
60108524SalfredSLIST_HEAD(sigiolst, sigio);
61108524Salfred
62108524Salfredpid_t	fgetown(struct sigio **sigiop);
63108524Salfredint	fsetown(pid_t pgid, struct sigio **sigiop);
64108524Salfredvoid	funsetown(struct sigio **sigiop);
65108524Salfredvoid	funsetownlst(struct sigiolst *sigiolst);
66108524Salfred
67108524Salfred#endif /* _SYS_SIGIO_H_ */
68