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

Defined struct's

file defined in line 18; used 234 times

Defined macros

L_SET defined in line 61; used 252 times
_SYS_FILE_H_ defined in line 12; used 1 times
  • in line 11

Usage of this include

file.h used 214 times
Last modified: 1995-01-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 4372
Valid CSS Valid XHTML 1.0 Strict