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