1: /*
2: * Copyright (c) 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)file.h 1.3 (2.11BSD GTE) 1/19/95
7: */
8:
9: #include <fcntl.h>
10:
11: #ifndef _SYS_FILE_H_
12: #define _SYS_FILE_H_
13:
14: /*
15: * Descriptor table entry.
16: * One for each kernel object.
17: */
18: struct file {
19: int f_flag; /* see below */
20: char f_type; /* descriptor type */
21: u_char f_count; /* reference count */
22: short f_msgcount; /* references from message queue */
23: union {
24: caddr_t f_Data;
25: struct socket *f_Socket;
26: } f_un;
27: off_t f_offset;
28: };
29:
30: #ifdef KERNEL
31: struct fileops {
32: int (*fo_rw)();
33: int (*fo_ioctl)();
34: int (*fo_select)();
35: int (*fo_close)();
36: };
37:
38: #define f_data f_un.f_Data
39: #define f_socket f_un.f_Socket
40:
41: #ifndef SUPERVISOR
42: extern struct file file[], *fileNFILE;
43: int nfile;
44: #endif
45:
46: struct file *getf();
47: struct file *falloc();
48: #endif
49:
50: /*
51: * Access call.
52: */
53: #define F_OK 0 /* does file exist */
54: #define X_OK 1 /* is it executable by caller */
55: #define W_OK 2 /* writable by caller */
56: #define R_OK 4 /* readable by caller */
57:
58: /*
59: * Lseek call.
60: */
61: #define L_SET 0 /* absolute offset */
62: #define L_INCR 1 /* relative to current offset */
63: #define L_XTND 2 /* relative to end of file */
64:
65: #ifdef KERNEL
66: #define GETF(fp, fd) { \
67: if ((unsigned)(fd) >= NOFILE || ((fp) = u.u_ofile[fd]) == NULL) { \
68: u.u_error = EBADF; \
69: return; \
70: } \
71: }
72: #define DTYPE_INODE 1 /* file */
73: #define DTYPE_SOCKET 2 /* communications endpoint */
74: #define DTYPE_PIPE 3 /* I don't want to hear it, okay? */
75: #endif
76: #endif /* _SYS_FILE_H_ */
Defined variables
nfile
defined in line
43; used 57 times
- in /usr/src/new/crash/crash.c line
274,
491(2)
- in /usr/src/new/pathalias/getstruct.c line
69-71(3)
- in /usr/src/new/pathalias/main.c line
166,
186
- in /usr/src/sys/pdp/machdep2.c line
128
- in /usr/src/sys/sys/kern_sysctl.c line
223
- in /usr/src/ucb/netstat/unix.c line
47(3),
58,
66-71(3)
- in /usr/src/ucb/tcopy.c line
120(2)
- in /usr/src/usr.bin/prof/prof.c line
64,
195-200(3),
213-214(2),
224,
240-244(2),
263-266(2)
- in /usr/src/usr.sbin/lpr/displayq.c line
341-349(6),
365-366(2),
376,
386,
396-397(2),
403-405(2)
- in /usr/src/usr.sbin/lpr/lpr.c line
247,
358
- in /usr/src/usr.sbin/pstat/pstat.c line
694,
702-706(5),
715-726(5)
Defined struct's
file
defined in line
18; used 234 times
- in line 42-47(6)
- in /usr/src/libexec/identd/src/kernel/2.11bsd.c line
85(2),
194(2),
293(2),
299(2)
- in /usr/src/sys/CURLY/param.c line
69(2),
146(2)
- in /usr/src/sys/GENERIC/param.c line
69(2),
146(2)
- in /usr/src/sys/QT/param.c line
69(2),
146(2)
- in /usr/src/sys/conf/param.c line
69(2),
146(2)
- in /usr/src/sys/h/sysctl.h line
215-216(4)
- in /usr/src/sys/h/user.h line
106(2)
- in /usr/src/sys/sys/kern_descrip.c line
42(2),
59(2),
79(2),
95(2),
157(2),
170(2),
187(2),
210(2),
223(2),
235(2),
288(2),
295-298(4),
330-334(4),
348(2),
376(2),
435-436(4)
- in /usr/src/sys/sys/kern_exec.c line
474(2)
- in /usr/src/sys/sys/kern_exit.c line
63(2)
- in /usr/src/sys/sys/kern_fork.c line
106(2)
- in /usr/src/sys/sys/kern_sysctl.c line
674-675(4)
- in /usr/src/sys/sys/sys_generic.c line
133(2),
178(2),
462(2),
530(2),
543(2),
555(2),
566(2)
- in /usr/src/sys/sys/sys_inode.c line
39(2),
328(2),
368(2),
452(2),
528(2),
603(2),
721(2)
- in /usr/src/sys/sys/sys_kern.c line
58(2),
67(2),
75(2),
159-161(4),
169(2)
- in /usr/src/sys/sys/sys_pipe.c line
32(2),
90(2),
101(2),
155(2),
223(2),
274(2)
- in /usr/src/sys/sys/ufs_syscalls.c line
127(2),
744(2),
1349(2)
- in /usr/src/sys/sys/ufs_syscalls2.c line
213(2)
- in /usr/src/sys/sys/uipc_syscalls.c line
47(2),
57(2),
82(2),
107(2),
124(2),
192(2),
245(2),
374(2),
517(2),
584(2),
603(2),
636(2),
678(2),
714(2),
765-769(4)
- in /usr/src/sys/sys/uipc_usrreq.c line
494-495(6),
525-534(8),
556-558(4),
619(2),
626-627(4),
637-639(4),
649(2)
- in /usr/src/sys/sys/vfs_vnops.c line
209(2)
- in /usr/src/ucb/netstat/unix.c line
38-39(4),
58-59(6),
66-67(4)
- in /usr/src/usr.bin/fstat/fstat.c line
600(2)
- in /usr/src/usr.sbin/pstat/pstat.c line
695-696(4),
703(4),
715(2)
Defined macros
F_OK
defined in line
53; used 9 times
GETF
defined in line
66; used 6 times
L_INCR
defined in line
62; used 17 times
L_SET
defined in line
61; used 252 times
- in /usr/src/bin/adb/sym.c line
172,
184,
210,
341
- in /usr/src/bin/ar/delete.c line
84-85(2)
- in /usr/src/bin/ar/move.c line
117-130(4)
- in /usr/src/bin/ar/replace.c line
168-173(2),
179
- in /usr/src/bin/df.c line
277
- in /usr/src/bin/disklabel/disklabel.c line
341,
418,
481
- in /usr/src/bin/ld/ld.c line
639,
652,
705,
750,
845,
1250,
1289,
1713,
1775
- in /usr/src/bin/login/login.c line
530,
543
- in /usr/src/bin/mail.c line
159,
315-321(3),
357
- in /usr/src/bin/nm/nm.c line
128,
149,
166,
268
- in /usr/src/bin/ps.c line
657,
671
- in /usr/src/bin/strip.c line
67
- in /usr/src/bin/tcsh/sh.dol.c line
745
- in /usr/src/bin/tcsh/sh.lex.c line
1413
- in /usr/src/games/battlestar/room.c line
29-34(2),
56,
67
- in /usr/src/lib/libc/gen/getpwent.c line
277
- in /usr/src/lib/libc/gen/ndbm.c line
130,
167,
202-207(2),
239,
278,
304,
326,
332
- in /usr/src/lib/libc/gen/nlist.c line
57,
88
- in /usr/src/lib/libc/gen/syserrlst.c line
69,
78
- in /usr/src/lib/mip/common.c line
130
- in /usr/src/libexec/comsat/comsat.c line
134,
204
- in /usr/src/libexec/ftpd/ftpd.c line
544,
604
- in /usr/src/libexec/identd/src/kernel/2.11bsd.c line
135,
269
- in /usr/src/libexec/popper/pop_updt.c line
101,
181
- in /usr/src/libexec/telnetd/telnetd.c line
1259
- in /usr/src/local/mkovmake/mkovmake.c line
516,
552,
565,
577
- in /usr/src/new/jove/fp.c line
49,
220
- in /usr/src/new/jove/rec.c line
20,
131
- in /usr/src/new/jove/recover.c line
35,
152,
459,
466
- in /usr/src/new/pathalias/getstruct.c line
186,
203,
211,
285,
301
- in /usr/src/sbin/clri/clri.c line
57,
69-74(2)
- in /usr/src/sbin/init/init.c line
581
- in /usr/src/sys/autoconfig/read_nlist.c line
101,
114-116(2)
- in /usr/src/sys/conf/checksys.c line
275
- in /usr/src/sys/conf/netbind.c line
108-112(2),
127-131(2)
- in /usr/src/ucb/PORT/systat/disks.c line
53,
99
- in /usr/src/ucb/PORT/systat/fetch.c line
25,
102,
112,
119,
132
- in /usr/src/ucb/PORT/systat/iostat.c line
102-110(5)
- in /usr/src/ucb/PORT/systat/main.c line
117,
163,
197
- in /usr/src/ucb/PORT/systat/mbufs.c line
123
- in /usr/src/ucb/PORT/systat/netstat.c line
140-145(2),
160-162(2)
- in /usr/src/ucb/PORT/systat/pigs.c line
184,
211,
225
- in /usr/src/ucb/PORT/systat/swap.c line
215,
247,
258
- in /usr/src/ucb/PORT/systat/vmstat.c line
203,
538,
616-640(10)
- in /usr/src/ucb/ex/ex_tagio.c line
54
- in /usr/src/ucb/finger/util.c line
138
- in /usr/src/ucb/ftp/ftp.c line
886,
928
- in /usr/src/ucb/gcore.c line
81-86(2),
118,
127-129(2)
- in /usr/src/ucb/lastcomm.c line
67
- in /usr/src/ucb/netstat/unix.c line
46-51(2),
64,
76-78(2),
105-110(2)
- in /usr/src/ucb/quota.c line
145
- in /usr/src/ucb/strcompact.c line
144
- in /usr/src/ucb/strings.c line
75-83(3)
- in /usr/src/ucb/symcompact.c line
106,
135,
160,
253
- in /usr/src/ucb/symdump.c line
73,
79,
88
- in /usr/src/ucb/symorder.c line
95,
171,
194
- in /usr/src/ucb/tail.c line
145
- in /usr/src/ucb/vmstat.c line
186,
214-224(5),
232,
298,
307-309(2),
317,
331-353(9),
490-494(3),
510,
582,
634-636(2),
652,
668-674(3)
- in /usr/src/usr.bin/fstat/fstat.c line
192-194(2),
238,
247,
253,
261,
277,
285,
303,
323,
428-431(2),
441-444(2),
454-457(2),
473-476(2),
509-512(2),
530-533(2),
607,
709
- in /usr/src/usr.bin/iostat.c line
102,
128-130(2),
177-191(8),
283-289(3)
- in /usr/src/usr.bin/ranlib/build.c line
102,
151,
187,
195,
214
- in /usr/src/usr.bin/ranlib/touch.c line
82
- in /usr/src/usr.lib/libutil/login.c line
38
- in /usr/src/usr.lib/libvmf/vmf.c line
193
- in /usr/src/usr.sbin/edquota/edquota.c line
218,
362,
397
- in /usr/src/usr.sbin/ntp/ntpd.c line
1248
- in /usr/src/usr.sbin/rwhod/rwhod.c line
265
L_XTND
defined in line
63; used 12 times
R_OK
defined in line
56; used 11 times
W_OK
defined in line
55; used 12 times
X_OK
defined in line
54; used 6 times
f_data
defined in line
38; used 32 times
- in /usr/src/libexec/identd/src/kernel/2.11bsd.c line
304
- in /usr/src/sys/sys/kern_descrip.c line
249,
318
- in /usr/src/sys/sys/kern_exec.c line
479
- in /usr/src/sys/sys/sys_generic.c line
571-573(3)
- in /usr/src/sys/sys/sys_inode.c line
42,
332,
371,
487,
532,
606,
729
- in /usr/src/sys/sys/sys_pipe.c line
83(2),
108,
163,
226,
276
- in /usr/src/sys/sys/ufs_syscalls.c line
171,
753,
1359
- in /usr/src/sys/sys/ufs_syscalls2.c line
232
- in /usr/src/sys/sys/uipc_syscalls.c line
551
- in /usr/src/sys/sys/vfs_vnops.c line
211,
218
- in /usr/src/ucb/netstat/unix.c line
76-78(2),
85
- in /usr/src/usr.bin/fstat/fstat.c line
613
- in /usr/src/usr.sbin/pstat/pstat.c line
746
f_socket
defined in line
39; used 20 times
- in /usr/src/sys/sys/kern_descrip.c line
177,
193,
256
- in /usr/src/sys/sys/sys_generic.c line
535-536(2)
- in /usr/src/sys/sys/uipc_syscalls.c line
68,
98,
114,
150,
169,
211,
263,
269,
429,
591,
624,
653,
693,
729
- in /usr/src/sys/sys/uipc_usrreq.c line
584
Usage of this include