xref: /illumos-gate/usr/src/uts/common/sys/port.h (revision 72102e74)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
534709573Sraf  * Common Development and Distribution License (the "License").
634709573Sraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
2134709573Sraf 
227c478bd9Sstevel@tonic-gate /*
23df2381bfSpraks  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
27*72102e74SBryan Cantrill /*
28*72102e74SBryan Cantrill  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
29*72102e74SBryan Cantrill  */
30*72102e74SBryan Cantrill 
317c478bd9Sstevel@tonic-gate #ifndef	_SYS_PORT_H
327c478bd9Sstevel@tonic-gate #define	_SYS_PORT_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
357c478bd9Sstevel@tonic-gate extern "C" {
367c478bd9Sstevel@tonic-gate #endif
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #include <sys/types.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /* port sources */
417c478bd9Sstevel@tonic-gate #define	PORT_SOURCE_AIO		1
427c478bd9Sstevel@tonic-gate #define	PORT_SOURCE_TIMER	2
437c478bd9Sstevel@tonic-gate #define	PORT_SOURCE_USER	3
447c478bd9Sstevel@tonic-gate #define	PORT_SOURCE_FD		4
457c478bd9Sstevel@tonic-gate #define	PORT_SOURCE_ALERT	5
4634709573Sraf #define	PORT_SOURCE_MQ		6
47df2381bfSpraks #define	PORT_SOURCE_FILE	7
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate typedef struct port_event {
507c478bd9Sstevel@tonic-gate 	int		portev_events;	/* event data is source specific */
517c478bd9Sstevel@tonic-gate 	ushort_t	portev_source;	/* event source */
527c478bd9Sstevel@tonic-gate 	ushort_t	portev_pad;	/* port internal use */
537c478bd9Sstevel@tonic-gate 	uintptr_t	portev_object;	/* source specific object */
547c478bd9Sstevel@tonic-gate 	void		*portev_user;	/* user cookie */
557c478bd9Sstevel@tonic-gate } port_event_t;
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate typedef	struct	port_notify {
587c478bd9Sstevel@tonic-gate 	int		portnfy_port;	/* bind request(s) to port */
597c478bd9Sstevel@tonic-gate 	void		*portnfy_user;	/* user defined */
607c478bd9Sstevel@tonic-gate } port_notify_t;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate 
63df2381bfSpraks typedef struct file_obj {
64df2381bfSpraks 	timestruc_t	fo_atime;	/* Access time from stat(2) */
65df2381bfSpraks 	timestruc_t	fo_mtime;	/* Modification time from stat(2) */
66df2381bfSpraks 	timestruc_t	fo_ctime;	/* Change time from stat(2) */
67df2381bfSpraks 	uintptr_t	fo_pad[3];	/* For future expansion */
68df2381bfSpraks 	char		*fo_name;	/* Null terminated file name */
69df2381bfSpraks } file_obj_t;
70df2381bfSpraks 
717c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
727c478bd9Sstevel@tonic-gate 
73df2381bfSpraks typedef struct file_obj32 {
74df2381bfSpraks 	timestruc32_t	fo_atime;	/* Access time got from stat(2) */
75df2381bfSpraks 	timestruc32_t	fo_mtime;	/* Modification time from stat(2) */
76df2381bfSpraks 	timestruc32_t	fo_ctime;	/* Change time from stat(2) */
77df2381bfSpraks 	caddr32_t	fo_pad[3];	/* For future expansion */
78df2381bfSpraks 	caddr32_t	fo_name;	/* Null terminated file name */
79df2381bfSpraks } file_obj32_t;
80df2381bfSpraks 
817c478bd9Sstevel@tonic-gate typedef struct port_event32 {
827c478bd9Sstevel@tonic-gate 	int		portev_events;	/* events detected */
837c478bd9Sstevel@tonic-gate 	ushort_t	portev_source;	/* user, timer, aio, etc */
847c478bd9Sstevel@tonic-gate 	ushort_t	portev_pad;	/* reserved */
857c478bd9Sstevel@tonic-gate 	caddr32_t	portev_object;	/* fd, timerid, ... */
867c478bd9Sstevel@tonic-gate 	caddr32_t	portev_user;	/* user cookie */
877c478bd9Sstevel@tonic-gate } port_event32_t;
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate typedef	struct	port_notify32 {
907c478bd9Sstevel@tonic-gate 	int		portnfy_port;	/* bind request(s) to port */
917c478bd9Sstevel@tonic-gate 	caddr32_t 	portnfy_user;	/* user defined */
927c478bd9Sstevel@tonic-gate } port_notify32_t;
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /* port_alert() flags */
977c478bd9Sstevel@tonic-gate #define	PORT_ALERT_SET		0x01
987c478bd9Sstevel@tonic-gate #define	PORT_ALERT_UPDATE	0x02
997c478bd9Sstevel@tonic-gate #define	PORT_ALERT_INVALID	(PORT_ALERT_SET | PORT_ALERT_UPDATE)
1007c478bd9Sstevel@tonic-gate 
101df2381bfSpraks /*
102df2381bfSpraks  * PORT_SOURCE_FILE - events
103df2381bfSpraks  */
104df2381bfSpraks 
105df2381bfSpraks /*
106df2381bfSpraks  * User watchable file events
107df2381bfSpraks  */
108df2381bfSpraks #define	FILE_ACCESS		0x00000001
109df2381bfSpraks #define	FILE_MODIFIED		0x00000002
110df2381bfSpraks #define	FILE_ATTRIB		0x00000004
111*72102e74SBryan Cantrill #define	FILE_TRUNC		0x00100000
112df2381bfSpraks #define	FILE_NOFOLLOW		0x10000000
113df2381bfSpraks 
114df2381bfSpraks /*
115df2381bfSpraks  * exception file events
116df2381bfSpraks  */
117df2381bfSpraks 
118df2381bfSpraks /*
119df2381bfSpraks  * The watched file..
120df2381bfSpraks  */
121df2381bfSpraks #define	FILE_DELETE		0x00000010
122df2381bfSpraks #define	FILE_RENAME_TO		0x00000020
123df2381bfSpraks #define	FILE_RENAME_FROM	0x00000040
124df2381bfSpraks /*
125df2381bfSpraks  * The filesystem on which the watched file resides got
126df2381bfSpraks  * unmounted.
127df2381bfSpraks  */
128df2381bfSpraks #define	UNMOUNTED		0x20000000
129df2381bfSpraks /*
130df2381bfSpraks  * Some other file/filesystem got mounted over the
131df2381bfSpraks  * watched file/directory.
132df2381bfSpraks  */
133df2381bfSpraks #define	MOUNTEDOVER		0x40000000
134df2381bfSpraks 
135df2381bfSpraks /*
136df2381bfSpraks  * Helper type
137df2381bfSpraks  */
138df2381bfSpraks #define	FILE_EXCEPTION		(UNMOUNTED|FILE_DELETE|FILE_RENAME_TO \
139df2381bfSpraks 				|FILE_RENAME_FROM|MOUNTEDOVER)
140df2381bfSpraks 
1417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1427c478bd9Sstevel@tonic-gate }
1437c478bd9Sstevel@tonic-gate #endif
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate #endif	/* _SYS_PORT_H */
146