]> git.saurik.com Git - apple/system_cmds.git/blob - lskq.tproj/common.h
system_cmds-880.100.5.tar.gz
[apple/system_cmds.git] / lskq.tproj / common.h
1 /*
2 * Copyright (c) 2015 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _LSKQ_COMMON_H_
25 #define _LSKQ_COMMON_H_
26
27 #include <stdint.h>
28
29 /*
30 * This file must be kept in sync with xnu headers
31 */
32
33 /*
34 * bsd/sys/event.h
35 */
36 __options_decl(kn_status_t, uint16_t /* 12 bits really */, {
37 KN_ACTIVE = 0x001, /* event has been triggered */
38 KN_QUEUED = 0x002, /* event is on queue */
39 KN_DISABLED = 0x004, /* event is disabled */
40 KN_DROPPING = 0x008, /* knote is being dropped */
41 KN_LOCKED = 0x010, /* knote is locked (kq_knlocks) */
42 KN_POSTING = 0x020, /* f_event() in flight */
43 KN_STAYACTIVE = 0x040, /* force event to stay active */
44 KN_DEFERDELETE = 0x080, /* defer delete until re-enabled */
45 KN_MERGE_QOS = 0x100, /* f_event() / f_* ran concurrently and overrides must merge */
46 KN_REQVANISH = 0x200, /* requested EV_VANISH */
47 KN_VANISHED = 0x400, /* has vanished */
48 KN_SUPPRESSED = 0x800, /* event is suppressed during delivery */
49 });
50
51 /*
52 * bsd/sys/eventvar.h
53 */
54 __options_decl(kq_state_t, uint16_t, {
55 KQ_SEL = 0x0001, /* select was recorded for kq */
56 KQ_SLEEP = 0x0002, /* thread is waiting for events */
57 KQ_PROCWAIT = 0x0004, /* thread waiting for processing */
58 KQ_KEV32 = 0x0008, /* kq is used with 32-bit events */
59 KQ_KEV64 = 0x0010, /* kq is used with 64-bit events */
60 KQ_KEV_QOS = 0x0020, /* kq events carry QoS info */
61 KQ_WORKQ = 0x0040, /* KQ is bound to process workq */
62 KQ_WORKLOOP = 0x0080, /* KQ is part of a workloop */
63 KQ_PROCESSING = 0x0100, /* KQ is being processed */
64 KQ_DRAIN = 0x0200, /* kq is draining */
65 KQ_WAKEUP = 0x0400, /* kq awakened while processing */
66 KQ_DYNAMIC = 0x0800, /* kqueue is dynamically managed */
67 KQ_R2K_ARMED = 0x1000, /* ast notification armed */
68 KQ_HAS_TURNSTILE = 0x2000, /* this kqueue has a turnstile */
69 });
70
71 /*
72 * bsd/pthread/workqueue_internal.h
73 */
74 __enum_decl(workq_tr_state_t, uint8_t, {
75 WORKQ_TR_STATE_IDLE = 0, /* request isn't in flight */
76 WORKQ_TR_STATE_NEW = 1, /* request is being initiated */
77 WORKQ_TR_STATE_QUEUED = 2, /* request is being queued */
78 WORKQ_TR_STATE_CANCELED = 3, /* request is canceled */
79 WORKQ_TR_STATE_BINDING = 4, /* request is preposted for bind */
80 WORKQ_TR_STATE_BOUND = 5, /* request is bound to a thread */
81 });
82
83
84 /*
85 * bsd/sys/signal.h
86 */
87 static const char *
88 sig_strs[] = {
89 [0] = "<UNKN>",
90 [1] = "SIGHUP",
91 [2] = "SIGINT",
92 [3] = "SIGQUIT",
93 [4] = "SIGILL",
94 [5] = "SIGTRAP",
95 [6] = "SIGABRT",
96 [7] = "SIGEMT",
97 [8] = "SIGFPE",
98 [9] = "SIGKILL",
99 [10] = "SIGBUS",
100 [11] = "SIGSEGV",
101 [12] = "SIGSYS",
102 [13] = "SIGPIPE",
103 [14] = "SIGALRM",
104 [15] = "SIGTERM",
105 [16] = "SIGURG",
106 [17] = "SIGSTOP",
107 [18] = "SIGTSTP",
108 [19] = "SIGCONT",
109 [20] = "SIGCHLD",
110 [21] = "SIGTTIN",
111 [22] = "SIGTTOU",
112 [23] = "SIGIO",
113 [24] = "SIGXCPU",
114 [25] = "SIGXFSZ",
115 [26] = "SIGVTALRM",
116 [27] = "SIGPROF",
117 [28] = "SIGWINCH",
118 [29] = "SIGINFO",
119 [30] = "SIGUSR1",
120 [31] = "SIGUSR2"
121 };
122
123 /*
124 * bsd/sys/event.h: EVFILT_*
125 */
126 static const char *
127 filt_strs[] = {
128 NULL,
129 "READ",
130 "WRITE",
131 "AIO",
132 "VNODE",
133 "PROC",
134 "SIGNAL",
135 "TIMER",
136 "MACHPORT",
137 "FS",
138 "USER",
139 "<inval>",
140 "VM",
141 "SOCK",
142 "MEMSTATUS",
143 "EXCEPT",
144 "CHANNEL",
145 "WORKLOOP",
146 };
147
148 /*
149 * bsd/sys/proc_info.h: PROX_FDTYPE_*
150 */
151 static const char *
152 fdtype_strs[] = {
153 "ATALK",
154 "VNODE",
155 "SOCKET",
156 "PSHM",
157 "PSEM",
158 "KQUEUE",
159 "PIPE",
160 "FSEVENTS",
161 "ATALK",
162 "POLICY",
163 "CHANNEL",
164 "NEXUS",
165 };
166
167 #endif /* _LSKQ_COMMON_H_ */