docs/how-to-build.md: use proper markup for directory names
[unleashed/tickless.git] / include / sys / port.h
blobd4d74d55eacc9ffa01189ea8137fa93364c3877d
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
31 #ifndef _SYS_PORT_H
32 #define _SYS_PORT_H
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #include <sys/types.h>
40 /* port sources */
41 #define PORT_SOURCE_AIO 1
42 #define PORT_SOURCE_TIMER 2
43 #define PORT_SOURCE_USER 3
44 #define PORT_SOURCE_FD 4
45 #define PORT_SOURCE_ALERT 5
46 #define PORT_SOURCE_MQ 6
47 #define PORT_SOURCE_FILE 7
49 typedef struct port_event {
50 int portev_events; /* event data is source specific */
51 ushort_t portev_source; /* event source */
52 ushort_t portev_pad; /* port internal use */
53 uintptr_t portev_object; /* source specific object */
54 void *portev_user; /* user cookie */
55 } port_event_t;
57 typedef struct port_notify {
58 int portnfy_port; /* bind request(s) to port */
59 void *portnfy_user; /* user defined */
60 } port_notify_t;
63 typedef struct file_obj {
64 timestruc_t fo_atime; /* Access time from stat(2) */
65 timestruc_t fo_mtime; /* Modification time from stat(2) */
66 timestruc_t fo_ctime; /* Change time from stat(2) */
67 uintptr_t fo_pad[3]; /* For future expansion */
68 char *fo_name; /* Null terminated file name */
69 } file_obj_t;
71 #if defined(_SYSCALL32)
73 typedef struct file_obj32 {
74 timestruc32_t fo_atime; /* Access time got from stat(2) */
75 timestruc32_t fo_mtime; /* Modification time from stat(2) */
76 timestruc32_t fo_ctime; /* Change time from stat(2) */
77 caddr32_t fo_pad[3]; /* For future expansion */
78 caddr32_t fo_name; /* Null terminated file name */
79 } file_obj32_t;
81 typedef struct port_event32 {
82 int portev_events; /* events detected */
83 ushort_t portev_source; /* user, timer, aio, etc */
84 ushort_t portev_pad; /* reserved */
85 caddr32_t portev_object; /* fd, timerid, ... */
86 caddr32_t portev_user; /* user cookie */
87 } port_event32_t;
89 typedef struct port_notify32 {
90 int portnfy_port; /* bind request(s) to port */
91 caddr32_t portnfy_user; /* user defined */
92 } port_notify32_t;
94 #endif /* _SYSCALL32 */
96 /* port_alert() flags */
97 #define PORT_ALERT_SET 0x01
98 #define PORT_ALERT_UPDATE 0x02
99 #define PORT_ALERT_INVALID (PORT_ALERT_SET | PORT_ALERT_UPDATE)
102 * PORT_SOURCE_FILE - events
106 * User watchable file events
108 #define FILE_ACCESS 0x00000001
109 #define FILE_MODIFIED 0x00000002
110 #define FILE_ATTRIB 0x00000004
111 #define FILE_TRUNC 0x00100000
112 #define FILE_NOFOLLOW 0x10000000
115 * exception file events
119 * The watched file..
121 #define FILE_DELETE 0x00000010
122 #define FILE_RENAME_TO 0x00000020
123 #define FILE_RENAME_FROM 0x00000040
125 * The filesystem on which the watched file resides got
126 * unmounted.
128 #define UNMOUNTED 0x20000000
130 * Some other file/filesystem got mounted over the
131 * watched file/directory.
133 #define MOUNTEDOVER 0x40000000
136 * Helper type
138 #define FILE_EXCEPTION (UNMOUNTED|FILE_DELETE|FILE_RENAME_TO \
139 |FILE_RENAME_FROM|MOUNTEDOVER)
141 #ifdef __cplusplus
143 #endif
145 #endif /* _SYS_PORT_H */