Print this page
XXXX adding PID information to netstat output
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/fcntl.h
+++ new/usr/src/uts/common/sys/fcntl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 27 /* All Rights Reserved */
28 28
29 29 /*
30 30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 31 * The Regents of the University of California
32 32 * All Rights Reserved
33 33 *
34 34 * University Acknowledgment- Portions of this document are derived from
35 35 * software developed by the University of California, Berkeley, and its
36 36 * contributors.
37 37 */
38 38
39 39 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
40 40
41 41 #ifndef _SYS_FCNTL_H
42 42 #define _SYS_FCNTL_H
43 43
44 44 #include <sys/feature_tests.h>
45 45
46 46 #include <sys/types.h>
47 47
48 48 #ifdef __cplusplus
49 49 extern "C" {
50 50 #endif
51 51
52 52 /*
53 53 * Flag values accessible to open(2) and fcntl(2)
54 54 * The first five can only be set (exclusively) by open(2).
55 55 */
56 56 #define O_RDONLY 0
57 57 #define O_WRONLY 1
58 58 #define O_RDWR 2
59 59 #define O_SEARCH 0x200000
60 60 #define O_EXEC 0x400000
61 61 #if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE)
62 62 #define O_NDELAY 0x04 /* non-blocking I/O */
63 63 #endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) */
64 64 #define O_APPEND 0x08 /* append (writes guaranteed at the end) */
65 65 #if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \
66 66 (_POSIX_C_SOURCE > 2) || defined(_XOPEN_SOURCE)
67 67 #define O_SYNC 0x10 /* synchronized file update option */
68 68 #define O_DSYNC 0x40 /* synchronized data update option */
69 69 #define O_RSYNC 0x8000 /* synchronized file update option */
70 70 /* defines read/write file integrity */
71 71 #endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */
72 72 #define O_NONBLOCK 0x80 /* non-blocking I/O (POSIX) */
73 73 #ifdef _LARGEFILE_SOURCE
74 74 #define O_LARGEFILE 0x2000
75 75 #endif
76 76
77 77 /*
78 78 * Flag values accessible only to open(2).
79 79 */
80 80 #define O_CREAT 0x100 /* open with file create (uses third arg) */
81 81 #define O_TRUNC 0x200 /* open with truncation */
82 82 #define O_EXCL 0x400 /* exclusive open */
83 83 #define O_NOCTTY 0x800 /* don't allocate controlling tty (POSIX) */
84 84 #define O_XATTR 0x4000 /* extended attribute */
85 85 #define O_NOFOLLOW 0x20000 /* don't follow symlinks */
86 86 #define O_NOLINKS 0x40000 /* don't allow multiple hard links */
87 87 #define O_CLOEXEC 0x800000 /* set the close-on-exec flag */
88 88
89 89 /*
90 90 * fcntl(2) requests
91 91 *
92 92 * N.B.: values are not necessarily assigned sequentially below.
93 93 */
94 94 #define F_DUPFD 0 /* Duplicate fildes */
95 95 #define F_GETFD 1 /* Get fildes flags */
96 96 #define F_SETFD 2 /* Set fildes flags */
97 97 #define F_GETFL 3 /* Get file flags */
98 98 #define F_GETXFL 45 /* Get file flags including open-only flags */
99 99 #define F_SETFL 4 /* Set file flags */
100 100
101 101 /*
102 102 * Applications that read /dev/mem must be built like the kernel. A
103 103 * new symbol "_KMEMUSER" is defined for this purpose.
104 104 */
105 105 #if defined(_KERNEL) || defined(_KMEMUSER)
106 106 #define F_O_GETLK 5 /* SVR3 Get file lock (need for rfs, across */
107 107 /* the wire compatibility */
108 108 /* clustering: lock id contains both per-node sysid and node id */
109 109 #define SYSIDMASK 0x0000ffff
110 110 #define GETSYSID(id) (id & SYSIDMASK)
111 111 #define NODEIDMASK 0xffff0000
112 112 #define BITS_IN_SYSID 16
113 113 #define GETNLMID(sysid) ((int)(((uint_t)(sysid) & NODEIDMASK) >> \
114 114 BITS_IN_SYSID))
115 115
116 116 /* Clustering: Macro used for PXFS locks */
117 117 #define GETPXFSID(sysid) ((int)(((uint_t)(sysid) & NODEIDMASK) >> \
118 118 BITS_IN_SYSID))
119 119 #endif /* defined(_KERNEL) */
120 120
121 121 #define F_CHKFL 8 /* Unused */
122 122 #define F_DUP2FD 9 /* Duplicate fildes at third arg */
123 123 #define F_DUP2FD_CLOEXEC 36 /* Like F_DUP2FD with O_CLOEXEC set */
124 124 /* EINVAL is fildes matches arg1 */
125 125 #define F_DUPFD_CLOEXEC 37 /* Like F_DUPFD with O_CLOEXEC set */
126 126
127 127 #define F_ISSTREAM 13 /* Is the file desc. a stream ? */
128 128 #define F_PRIV 15 /* Turn on private access to file */
129 129 #define F_NPRIV 16 /* Turn off private access to file */
130 130 #define F_QUOTACTL 17 /* UFS quota call */
131 131 #define F_BLOCKS 18 /* Get number of BLKSIZE blocks allocated */
132 132 #define F_BLKSIZE 19 /* Get optimal I/O block size */
133 133 /*
134 134 * Numbers 20-22 have been removed and should not be reused.
135 135 */
136 136 #define F_GETOWN 23 /* Get owner (socket emulation) */
137 137 #define F_SETOWN 24 /* Set owner (socket emulation) */
138 138 #define F_REVOKE 25 /* Object reuse revoke access to file desc. */
139 139
140 140 #define F_HASREMOTELOCKS 26 /* Does vp have NFS locks; private to lock */
141 141 /* manager */
142 142
143 143 /*
144 144 * Commands that refer to flock structures. The argument types differ between
145 145 * the large and small file environments; therefore, the #defined values must
146 146 * as well.
147 147 * The NBMAND forms are private and should not be used.
148 148 */
149 149
150 150 #if defined(_LP64) || _FILE_OFFSET_BITS == 32
151 151 /* "Native" application compilation environment */
152 152 #define F_SETLK 6 /* Set file lock */
153 153 #define F_SETLKW 7 /* Set file lock and wait */
154 154 #define F_ALLOCSP 10 /* Allocate file space */
155 155 #define F_FREESP 11 /* Free file space */
156 156 #define F_GETLK 14 /* Get file lock */
157 157 #define F_SETLK_NBMAND 42 /* private */
↓ open down ↓ |
157 lines elided |
↑ open up ↑ |
158 158 #else
159 159 /* ILP32 large file application compilation environment version */
160 160 #define F_SETLK 34 /* Set file lock */
161 161 #define F_SETLKW 35 /* Set file lock and wait */
162 162 #define F_ALLOCSP 28 /* Alllocate file space */
163 163 #define F_FREESP 27 /* Free file space */
164 164 #define F_GETLK 33 /* Get file lock */
165 165 #define F_SETLK_NBMAND 44 /* private */
166 166 #endif /* _LP64 || _FILE_OFFSET_BITS == 32 */
167 167
168 +#define F_FORKED 29
169 +#define F_CLOSED 30
170 +
168 171 #if defined(_LARGEFILE64_SOURCE)
169 172
170 173 #if !defined(_LP64) || defined(_KERNEL)
171 174 /*
172 175 * transitional large file interface version
173 176 * These are only valid in a 32 bit application compiled with large files
174 177 * option, for source compatibility, the 64-bit versions are mapped back
175 178 * to the native versions.
176 179 */
177 180 #define F_SETLK64 34 /* Set file lock */
178 181 #define F_SETLKW64 35 /* Set file lock and wait */
179 182 #define F_ALLOCSP64 28 /* Allocate file space */
180 183 #define F_FREESP64 27 /* Free file space */
181 184 #define F_GETLK64 33 /* Get file lock */
182 185 #define F_SETLK64_NBMAND 44 /* private */
183 186 #else
184 187 #define F_SETLK64 6 /* Set file lock */
185 188 #define F_SETLKW64 7 /* Set file lock and wait */
186 189 #define F_ALLOCSP64 10 /* Allocate file space */
187 190 #define F_FREESP64 11 /* Free file space */
188 191 #define F_GETLK64 14 /* Get file lock */
189 192 #define F_SETLK64_NBMAND 42 /* private */
190 193 #endif /* !_LP64 || _KERNEL */
191 194
192 195 #endif /* _LARGEFILE64_SOURCE */
193 196
194 197 #define F_SHARE 40 /* Set a file share reservation */
195 198 #define F_UNSHARE 41 /* Remove a file share reservation */
196 199 #define F_SHARE_NBMAND 43 /* private */
197 200
198 201 #define F_BADFD 46 /* Create Poison FD */
199 202
200 203 /*
201 204 * File segment locking set data type - information passed to system by user.
202 205 */
203 206
204 207 /* regular version, for both small and large file compilation environment */
205 208 typedef struct flock {
206 209 short l_type;
207 210 short l_whence;
208 211 off_t l_start;
209 212 off_t l_len; /* len == 0 means until end of file */
210 213 int l_sysid;
211 214 pid_t l_pid;
212 215 long l_pad[4]; /* reserve area */
213 216 } flock_t;
214 217
215 218 #if defined(_SYSCALL32)
216 219
217 220 /* Kernel's view of ILP32 flock structure */
218 221
219 222 typedef struct flock32 {
220 223 int16_t l_type;
221 224 int16_t l_whence;
222 225 off32_t l_start;
223 226 off32_t l_len; /* len == 0 means until end of file */
224 227 int32_t l_sysid;
225 228 pid32_t l_pid;
226 229 int32_t l_pad[4]; /* reserve area */
227 230 } flock32_t;
228 231
229 232 #endif /* _SYSCALL32 */
230 233
231 234 /* transitional large file interface version */
232 235
233 236 #if defined(_LARGEFILE64_SOURCE)
234 237
235 238 typedef struct flock64 {
236 239 short l_type;
237 240 short l_whence;
238 241 off64_t l_start;
239 242 off64_t l_len; /* len == 0 means until end of file */
240 243 int l_sysid;
241 244 pid_t l_pid;
242 245 long l_pad[4]; /* reserve area */
243 246 } flock64_t;
244 247
245 248 #if defined(_SYSCALL32)
246 249
247 250 /* Kernel's view of ILP32 flock64 */
248 251
249 252 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
250 253 #pragma pack(4)
251 254 #endif
252 255
253 256 typedef struct flock64_32 {
254 257 int16_t l_type;
255 258 int16_t l_whence;
256 259 off64_t l_start;
257 260 off64_t l_len; /* len == 0 means until end of file */
258 261 int32_t l_sysid;
259 262 pid32_t l_pid;
260 263 int32_t l_pad[4]; /* reserve area */
261 264 } flock64_32_t;
262 265
263 266 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
264 267 #pragma pack()
265 268 #endif
266 269
267 270 /* Kernel's view of LP64 flock64 */
268 271
269 272 typedef struct flock64_64 {
270 273 int16_t l_type;
271 274 int16_t l_whence;
272 275 off64_t l_start;
273 276 off64_t l_len; /* len == 0 means until end of file */
274 277 int32_t l_sysid;
275 278 pid32_t l_pid;
276 279 int64_t l_pad[4]; /* reserve area */
277 280 } flock64_64_t;
278 281
279 282 #endif /* _SYSCALL32 */
280 283
281 284 #endif /* _LARGEFILE64_SOURCE */
282 285
283 286 #if defined(_KERNEL) || defined(_KMEMUSER)
284 287 /* SVr3 flock type; needed for rfs across the wire compatibility */
285 288 typedef struct o_flock {
286 289 int16_t l_type;
287 290 int16_t l_whence;
288 291 int32_t l_start;
289 292 int32_t l_len; /* len == 0 means until end of file */
290 293 int16_t l_sysid;
291 294 int16_t l_pid;
292 295 } o_flock_t;
293 296 #endif /* defined(_KERNEL) */
294 297
295 298 /*
296 299 * File segment locking types.
297 300 */
298 301 #define F_RDLCK 01 /* Read lock */
299 302 #define F_WRLCK 02 /* Write lock */
300 303 #define F_UNLCK 03 /* Remove lock(s) */
301 304 #define F_UNLKSYS 04 /* remove remote locks for a given system */
302 305
303 306 /*
304 307 * POSIX constants
305 308 */
306 309
307 310 /* Mask for file access modes */
308 311 #define O_ACCMODE (O_SEARCH | O_EXEC | 0x3)
309 312 #define FD_CLOEXEC 1 /* close on exec flag */
310 313
311 314 /*
312 315 * DIRECTIO
313 316 */
314 317 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
315 318 #define DIRECTIO_OFF (0)
316 319 #define DIRECTIO_ON (1)
317 320
318 321 /*
319 322 * File share reservation type
320 323 */
321 324 typedef struct fshare {
322 325 short f_access;
323 326 short f_deny;
324 327 int f_id;
325 328 } fshare_t;
326 329
327 330 /*
328 331 * f_access values
329 332 */
330 333 #define F_RDACC 0x1 /* Read-only share access */
331 334 #define F_WRACC 0x2 /* Write-only share access */
332 335 #define F_RWACC 0x3 /* Read-Write share access */
333 336 #define F_RMACC 0x4 /* private flag: Delete share access */
334 337 #define F_MDACC 0x20 /* private flag: Metadata share access */
335 338
336 339 /*
337 340 * f_deny values
338 341 */
339 342 #define F_NODNY 0x0 /* Don't deny others access */
340 343 #define F_RDDNY 0x1 /* Deny others read share access */
341 344 #define F_WRDNY 0x2 /* Deny others write share access */
342 345 #define F_RWDNY 0x3 /* Deny others read or write share access */
343 346 #define F_RMDNY 0x4 /* private flag: Deny delete share access */
344 347 #define F_COMPAT 0x8 /* Set share to old DOS compatibility mode */
345 348 #define F_MANDDNY 0x10 /* private flag: mandatory enforcement */
346 349 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
347 350
348 351 /*
349 352 * Special flags for functions such as openat(), fstatat()....
350 353 */
351 354 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
352 355 defined(__EXTENSIONS__)
353 356 /* || defined(_XPG7) */
354 357 #define AT_FDCWD 0xffd19553
355 358 #define AT_SYMLINK_NOFOLLOW 0x1000
356 359 #define AT_SYMLINK_FOLLOW 0x2000 /* only for linkat() */
357 360 #define AT_REMOVEDIR 0x1
358 361 #define _AT_TRIGGER 0x2
359 362 #define AT_EACCESS 0x4 /* use EUID/EGID for access */
360 363 #endif
361 364
362 365 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
363 366 /* advice for posix_fadvise */
364 367 #define POSIX_FADV_NORMAL 0
365 368 #define POSIX_FADV_RANDOM 1
366 369 #define POSIX_FADV_SEQUENTIAL 2
367 370 #define POSIX_FADV_WILLNEED 3
368 371 #define POSIX_FADV_DONTNEED 4
369 372 #define POSIX_FADV_NOREUSE 5
370 373 #endif
371 374
372 375 #ifdef __cplusplus
373 376 }
374 377 #endif
375 378
376 379 #endif /* _SYS_FCNTL_H */
↓ open down ↓ |
199 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX