xref: /onnv-gate/usr/src/uts/common/sys/port.h (revision 4863:7b14ad153d91)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51885Sraf  * Common Development and Distribution License (the "License").
61885Sraf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
211885Sraf 
220Sstevel@tonic-gate /*
23*4863Spraks  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef	_SYS_PORT_H
280Sstevel@tonic-gate #define	_SYS_PORT_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef	__cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include <sys/types.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate /* port sources */
390Sstevel@tonic-gate #define	PORT_SOURCE_AIO		1
400Sstevel@tonic-gate #define	PORT_SOURCE_TIMER	2
410Sstevel@tonic-gate #define	PORT_SOURCE_USER	3
420Sstevel@tonic-gate #define	PORT_SOURCE_FD		4
430Sstevel@tonic-gate #define	PORT_SOURCE_ALERT	5
441885Sraf #define	PORT_SOURCE_MQ		6
45*4863Spraks #define	PORT_SOURCE_FILE	7
460Sstevel@tonic-gate 
470Sstevel@tonic-gate typedef struct port_event {
480Sstevel@tonic-gate 	int		portev_events;	/* event data is source specific */
490Sstevel@tonic-gate 	ushort_t	portev_source;	/* event source */
500Sstevel@tonic-gate 	ushort_t	portev_pad;	/* port internal use */
510Sstevel@tonic-gate 	uintptr_t	portev_object;	/* source specific object */
520Sstevel@tonic-gate 	void		*portev_user;	/* user cookie */
530Sstevel@tonic-gate } port_event_t;
540Sstevel@tonic-gate 
550Sstevel@tonic-gate typedef	struct	port_notify {
560Sstevel@tonic-gate 	int		portnfy_port;	/* bind request(s) to port */
570Sstevel@tonic-gate 	void		*portnfy_user;	/* user defined */
580Sstevel@tonic-gate } port_notify_t;
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 
61*4863Spraks typedef struct file_obj {
62*4863Spraks 	timestruc_t	fo_atime;	/* Access time from stat(2) */
63*4863Spraks 	timestruc_t	fo_mtime;	/* Modification time from stat(2) */
64*4863Spraks 	timestruc_t	fo_ctime;	/* Change time from stat(2) */
65*4863Spraks 	uintptr_t	fo_pad[3];	/* For future expansion */
66*4863Spraks 	char		*fo_name;	/* Null terminated file name */
67*4863Spraks } file_obj_t;
68*4863Spraks 
690Sstevel@tonic-gate #if defined(_SYSCALL32)
700Sstevel@tonic-gate 
71*4863Spraks typedef struct file_obj32 {
72*4863Spraks 	timestruc32_t	fo_atime;	/* Access time got from stat(2) */
73*4863Spraks 	timestruc32_t	fo_mtime;	/* Modification time from stat(2) */
74*4863Spraks 	timestruc32_t	fo_ctime;	/* Change time from stat(2) */
75*4863Spraks 	caddr32_t	fo_pad[3];	/* For future expansion */
76*4863Spraks 	caddr32_t	fo_name;	/* Null terminated file name */
77*4863Spraks } file_obj32_t;
78*4863Spraks 
790Sstevel@tonic-gate typedef struct port_event32 {
800Sstevel@tonic-gate 	int		portev_events;	/* events detected */
810Sstevel@tonic-gate 	ushort_t	portev_source;	/* user, timer, aio, etc */
820Sstevel@tonic-gate 	ushort_t	portev_pad;	/* reserved */
830Sstevel@tonic-gate 	caddr32_t	portev_object;	/* fd, timerid, ... */
840Sstevel@tonic-gate 	caddr32_t	portev_user;	/* user cookie */
850Sstevel@tonic-gate } port_event32_t;
860Sstevel@tonic-gate 
870Sstevel@tonic-gate typedef	struct	port_notify32 {
880Sstevel@tonic-gate 	int		portnfy_port;	/* bind request(s) to port */
890Sstevel@tonic-gate 	caddr32_t 	portnfy_user;	/* user defined */
900Sstevel@tonic-gate } port_notify32_t;
910Sstevel@tonic-gate 
920Sstevel@tonic-gate #endif /* _SYSCALL32 */
930Sstevel@tonic-gate 
940Sstevel@tonic-gate /* port_alert() flags */
950Sstevel@tonic-gate #define	PORT_ALERT_SET		0x01
960Sstevel@tonic-gate #define	PORT_ALERT_UPDATE	0x02
970Sstevel@tonic-gate #define	PORT_ALERT_INVALID	(PORT_ALERT_SET | PORT_ALERT_UPDATE)
980Sstevel@tonic-gate 
99*4863Spraks /*
100*4863Spraks  * PORT_SOURCE_FILE - events
101*4863Spraks  */
102*4863Spraks 
103*4863Spraks /*
104*4863Spraks  * User watchable file events
105*4863Spraks  */
106*4863Spraks #define	FILE_ACCESS		0x00000001
107*4863Spraks #define	FILE_MODIFIED		0x00000002
108*4863Spraks #define	FILE_ATTRIB		0x00000004
109*4863Spraks #define	FILE_NOFOLLOW		0x10000000
110*4863Spraks 
111*4863Spraks /*
112*4863Spraks  * exception file events
113*4863Spraks  */
114*4863Spraks 
115*4863Spraks /*
116*4863Spraks  * The watched file..
117*4863Spraks  */
118*4863Spraks #define	FILE_DELETE		0x00000010
119*4863Spraks #define	FILE_RENAME_TO		0x00000020
120*4863Spraks #define	FILE_RENAME_FROM	0x00000040
121*4863Spraks /*
122*4863Spraks  * The filesystem on which the watched file resides got
123*4863Spraks  * unmounted.
124*4863Spraks  */
125*4863Spraks #define	UNMOUNTED		0x20000000
126*4863Spraks /*
127*4863Spraks  * Some other file/filesystem got mounted over the
128*4863Spraks  * watched file/directory.
129*4863Spraks  */
130*4863Spraks #define	MOUNTEDOVER		0x40000000
131*4863Spraks 
132*4863Spraks /*
133*4863Spraks  * Helper type
134*4863Spraks  */
135*4863Spraks #define	FILE_EXCEPTION		(UNMOUNTED|FILE_DELETE|FILE_RENAME_TO \
136*4863Spraks 				|FILE_RENAME_FROM|MOUNTEDOVER)
137*4863Spraks 
1380Sstevel@tonic-gate #ifdef	__cplusplus
1390Sstevel@tonic-gate }
1400Sstevel@tonic-gate #endif
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate #endif	/* _SYS_PORT_H */
143