Print this page
XXXX adding PID information to netstat output
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/file.h
+++ new/usr/src/uts/common/sys/file.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 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
30 30 /* Copyright 2015 Joyent, Inc. */
31 31
32 32 #ifndef _SYS_FILE_H
33 33 #define _SYS_FILE_H
34 34
35 35 #include <sys/t_lock.h>
36 36 #ifdef _KERNEL
37 37 #include <sys/model.h>
38 38 #include <sys/user.h>
39 39 #endif
40 40
41 41 #ifdef __cplusplus
42 42 extern "C" {
43 43 #endif
44 44
45 45 /*
46 46 * fio locking:
47 47 * f_rwlock protects f_vnode and f_cred
48 48 * f_tlock protects the rest
49 49 *
50 50 * The purpose of locking in this layer is to keep the kernel
51 51 * from panicing if, for example, a thread calls close() while
52 52 * another thread is doing a read(). It is up to higher levels
53 53 * to make sure 2 threads doing I/O to the same file don't
54 54 * screw each other up.
55 55 */
56 56 /*
57 57 * One file structure is allocated for each open/creat/pipe call.
58 58 * Main use is to hold the read/write pointer (and OFD locks) associated with
59 59 * each open file.
60 60 */
61 61 typedef struct file {
62 62 kmutex_t f_tlock; /* short term lock */
63 63 ushort_t f_flag;
64 64 ushort_t f_flag2; /* extra flags (FSEARCH, FEXEC) */
65 65 struct vnode *f_vnode; /* pointer to vnode structure */
66 66 offset_t f_offset; /* read/write character pointer */
67 67 struct cred *f_cred; /* credentials of user who opened it */
68 68 struct f_audit_data *f_audit_data; /* file audit data */
69 69 int f_count; /* reference count */
70 70 struct filock *f_filock; /* ptr to single lock_descriptor_t */
71 71 } file_t;
72 72
73 73 /*
74 74 * fpollinfo struct - used by poll caching to track who has polled the fd
75 75 */
76 76 typedef struct fpollinfo {
77 77 struct _kthread *fp_thread; /* thread caching poll info */
78 78 struct fpollinfo *fp_next;
79 79 } fpollinfo_t;
80 80
81 81 /* f_flag */
82 82
83 83 #define FOPEN 0xffffffff
84 84 #define FREAD 0x01 /* <sys/aiocb.h> LIO_READ must be identical */
85 85 #define FWRITE 0x02 /* <sys/aiocb.h> LIO_WRITE must be identical */
86 86 #define FNDELAY 0x04
87 87 #define FAPPEND 0x08
88 88 #define FSYNC 0x10 /* file (data+inode) integrity while writing */
89 89 #define FREVOKED 0x20 /* Object reuse Revoked file */
90 90 #define FDSYNC 0x40 /* file data only integrity while writing */
91 91 #define FNONBLOCK 0x80
92 92
93 93 #define FMASK 0xa0ff /* all flags that can be changed by F_SETFL */
94 94
95 95 /* open-only modes */
96 96
97 97 #define FCREAT 0x0100
98 98 #define FTRUNC 0x0200
99 99 #define FEXCL 0x0400
100 100 #define FASYNC 0x1000 /* asyncio in progress pseudo flag */
101 101 #define FOFFMAX 0x2000 /* large file */
102 102 #define FXATTR 0x4000 /* open as extended attribute */
103 103 #define FNOCTTY 0x0800
104 104 #define FRSYNC 0x8000 /* sync read operations at same level of */
105 105 /* integrity as specified for writes by */
106 106 /* FSYNC and FDSYNC flags */
107 107
108 108 #define FNODSYNC 0x10000 /* fsync pseudo flag */
109 109
110 110 #define FNOFOLLOW 0x20000 /* don't follow symlinks */
111 111 #define FNOLINKS 0x40000 /* don't allow multiple hard links */
112 112 #define FIGNORECASE 0x80000 /* request case-insensitive lookups */
113 113 #define FXATTRDIROPEN 0x100000 /* only opening hidden attribute directory */
114 114
115 115 /* f_flag2 (open-only) */
116 116
117 117 #define FSEARCH 0x200000 /* O_SEARCH = 0x200000 */
118 118 #define FEXEC 0x400000 /* O_EXEC = 0x400000 */
119 119
120 120 #define FCLOEXEC 0x800000 /* O_CLOEXEC = 0x800000 */
121 121
122 122 #ifdef _KERNEL
123 123
124 124 /*
125 125 * This is a flag that is set on f_flag2, but is never user-visible
126 126 */
127 127 #define FEPOLLED 0x8000
128 128
129 129 /*
130 130 * Fake flags for driver ioctl calls to inform them of the originating
131 131 * process' model. See <sys/model.h>
132 132 *
133 133 * Part of the Solaris 2.6+ DDI/DKI
134 134 */
135 135 #define FMODELS DATAMODEL_MASK /* Note: 0x0ff00000 */
136 136 #define FILP32 DATAMODEL_ILP32
137 137 #define FLP64 DATAMODEL_LP64
138 138 #define FNATIVE DATAMODEL_NATIVE
139 139
140 140 /*
141 141 * Large Files: The macro gets the offset maximum (refer to LFS API doc)
142 142 * corresponding to a file descriptor. We had the choice of storing
143 143 * this value in file descriptor. Right now we only have two
144 144 * offset maximums one if MAXOFF_T and other is MAXOFFSET_T. It is
145 145 * inefficient to store these two values in a separate member in
146 146 * file descriptor. To avoid wasting spaces we define this macro.
147 147 * The day there are more than two offset maximum we may want to
148 148 * rewrite this macro.
149 149 */
150 150
151 151 #define OFFSET_MAX(fd) ((fd->f_flag & FOFFMAX) ? MAXOFFSET_T : MAXOFF32_T)
152 152
153 153 /*
154 154 * Fake flag => internal ioctl call for layered drivers.
155 155 * Note that this flag deliberately *won't* fit into
156 156 * the f_flag field of a file_t.
157 157 *
158 158 * Part of the Solaris 2.x DDI/DKI.
159 159 */
160 160 #define FKIOCTL 0x80000000 /* ioctl addresses are from kernel */
161 161
162 162 /*
163 163 * Fake flag => this time to specify that the open(9E)
164 164 * comes from another part of the kernel, not userland.
165 165 *
166 166 * Part of the Solaris 2.x DDI/DKI.
167 167 */
168 168 #define FKLYR 0x40000000 /* layered driver call */
169 169
170 170 #endif /* _KERNEL */
171 171
172 172 /* miscellaneous defines */
173 173
174 174 #ifndef L_SET
175 175 #define L_SET 0 /* for lseek */
176 176 #endif /* L_SET */
177 177
178 178 /*
179 179 * For flock(3C). These really don't belong here but for historical reasons
180 180 * the interface defines them to be here.
181 181 */
182 182 #define LOCK_SH 1
183 183 #define LOCK_EX 2
184 184 #define LOCK_NB 4
185 185 #define LOCK_UN 8
186 186
187 187 #if !defined(_STRICT_SYMBOLS)
188 188 extern int flock(int, int);
189 189 #endif
190 190
191 191 #if defined(_KERNEL)
192 192
193 193 /*
194 194 * Routines dealing with user per-open file flags and
195 195 * user open files.
196 196 */
↓ open down ↓ |
196 lines elided |
↑ open up ↑ |
197 197 struct proc; /* forward reference for function prototype */
198 198 struct vnodeops;
199 199 struct vattr;
200 200
201 201 extern file_t *getf(int);
202 202 extern void releasef(int);
203 203 extern void areleasef(int, uf_info_t *);
204 204 #ifndef _BOOT
205 205 extern void closeall(uf_info_t *);
206 206 #endif
207 -extern void flist_fork(uf_info_t *, uf_info_t *);
207 +extern void flist_fork(proc_t *, proc_t *);
208 208 extern int closef(file_t *);
209 209 extern int closeandsetf(int, file_t *);
210 210 extern int ufalloc_file(int, file_t *);
211 211 extern int ufalloc(int);
212 212 extern int ufcanalloc(struct proc *, uint_t);
213 213 extern int falloc(struct vnode *, int, file_t **, int *);
214 214 extern void finit(void);
215 215 extern void unfalloc(file_t *);
216 216 extern void setf(int, file_t *);
217 217 extern int f_getfd_error(int, int *);
218 218 extern char f_getfd(int);
219 219 extern int f_setfd_error(int, int);
220 220 extern void f_setfd(int, char);
221 221 extern int f_getfl(int, int *);
222 222 extern int f_badfd(int, int *, int);
223 223 extern int fassign(struct vnode **, int, int *);
224 224 extern void fcnt_add(uf_info_t *, int);
225 225 extern void close_exec(uf_info_t *);
226 226 extern void clear_stale_fd(void);
227 227 extern void clear_active_fd(int);
228 228 extern void free_afd(afd_t *afd);
229 229 extern int fgetstartvp(int, char *, struct vnode **);
230 230 extern int fsetattrat(int, char *, int, struct vattr *);
231 231 extern int fisopen(struct vnode *);
232 232 extern void delfpollinfo(int);
233 233 extern void addfpollinfo(int);
234 234 extern int sock_getfasync(struct vnode *);
235 235 extern int files_can_change_zones(void);
236 236 #ifdef DEBUG
237 237 /* The following functions are only used in ASSERT()s */
238 238 extern void checkwfdlist(struct vnode *, fpollinfo_t *);
239 239 extern void checkfpollinfo(void);
240 240 extern int infpollinfo(int);
241 241 #endif /* DEBUG */
242 242
243 243 #endif /* defined(_KERNEL) */
244 244
245 245 #ifdef __cplusplus
246 246 }
247 247 #endif
248 248
249 249 #endif /* _SYS_FILE_H */
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX