1: /*
   2:  * Copyright (c) 1982, 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	7.1 (Berkeley) 6/4/86
   7:  */
   8: 
   9: #ifdef KERNEL
  10: /*
  11:  * Descriptor table entry.
  12:  * One for each kernel object.
  13:  */
  14: struct  file {
  15:     int f_flag;     /* see below */
  16:     short   f_type;     /* descriptor type */
  17:     short   f_count;    /* reference count */
  18:     short   f_msgcount; /* references from message queue */
  19:     struct  fileops {
  20:         int (*fo_rw)();
  21:         int (*fo_ioctl)();
  22:         int (*fo_select)();
  23:         int (*fo_close)();
  24:     } *f_ops;
  25:     caddr_t f_data;     /* inode */
  26:     off_t   f_offset;
  27: };
  28: 
  29: struct  file *file, *fileNFILE;
  30: int nfile;
  31: struct  file *getf();
  32: struct  file *falloc();
  33: #endif
  34: 
  35: /*
  36:  * flags- also for fcntl call.
  37:  */
  38: #define FOPEN       (-1)
  39: #define FREAD       00001       /* descriptor read/receive'able */
  40: #define FWRITE      00002       /* descriptor write/send'able */
  41: #ifndef F_DUPFD
  42: #define FNDELAY     00004       /* no delay */
  43: #define FAPPEND     00010       /* append on each write */
  44: #endif
  45: #define FMARK       00020       /* mark during gc() */
  46: #define FDEFER      00040       /* defer for next gc pass */
  47: #ifndef F_DUPFD
  48: #define FASYNC      00100       /* signal pgrp when data ready */
  49: #endif
  50: #define FSHLOCK     00200       /* shared lock present */
  51: #define FEXLOCK     00400       /* exclusive lock present */
  52: 
  53: /* bits to save after open */
  54: #define FMASK       00113
  55: #define FCNTLCANT   (FREAD|FWRITE|FMARK|FDEFER|FSHLOCK|FEXLOCK)
  56: 
  57: /* open only modes */
  58: #define FCREAT      01000       /* create if nonexistant */
  59: #define FTRUNC      02000       /* truncate to zero length */
  60: #define FEXCL       04000       /* error if already created */
  61: 
  62: #ifndef F_DUPFD
  63: /* fcntl(2) requests--from <fcntl.h> */
  64: #define F_DUPFD 0   /* Duplicate fildes */
  65: #define F_GETFD 1   /* Get fildes flags */
  66: #define F_SETFD 2   /* Set fildes flags */
  67: #define F_GETFL 3   /* Get file flags */
  68: #define F_SETFL 4   /* Set file flags */
  69: #define F_GETOWN 5  /* Get owner */
  70: #define F_SETOWN 6  /* Set owner */
  71: #endif
  72: 
  73: /*
  74:  * User definitions.
  75:  */
  76: 
  77: /*
  78:  * Open call.
  79:  */
  80: #define O_RDONLY    000     /* open for reading */
  81: #define O_WRONLY    001     /* open for writing */
  82: #define O_RDWR      002     /* open for read & write */
  83: #define O_NDELAY    FNDELAY     /* non-blocking open */
  84: #define O_APPEND    FAPPEND     /* append on each write */
  85: #define O_CREAT     FCREAT      /* open with file create */
  86: #define O_TRUNC     FTRUNC      /* open with truncation */
  87: #define O_EXCL      FEXCL       /* error on create if file exists */
  88: 
  89: /*
  90:  * Flock call.
  91:  */
  92: #define LOCK_SH     1   /* shared lock */
  93: #define LOCK_EX     2   /* exclusive lock */
  94: #define LOCK_NB     4   /* don't block when locking */
  95: #define LOCK_UN     8   /* unlock */
  96: 
  97: /*
  98:  * Access call.
  99:  */
 100: #define F_OK        0   /* does file exist */
 101: #define X_OK        1   /* is it executable by caller */
 102: #define W_OK        2   /* writable by caller */
 103: #define R_OK        4   /* readable by caller */
 104: 
 105: /*
 106:  * Lseek call.
 107:  */
 108: #define L_SET       0   /* absolute offset */
 109: #define L_INCR      1   /* relative to current offset */
 110: #define L_XTND      2   /* relative to end of file */
 111: 
 112: #ifdef KERNEL
 113: #define GETF(fp, fd) { \
 114:     if ((unsigned)(fd) >= NOFILE || ((fp) = u.u_ofile[fd]) == NULL) { \
 115:         u.u_error = EBADF; \
 116:         return; \
 117:     } \
 118: }
 119: #define DTYPE_INODE 1   /* file */
 120: #define DTYPE_SOCKET    2   /* communications endpoint */
 121: #endif

Defined variables

nfile defined in line 30; used 1 times

Defined struct's

file defined in line 14; used 170 times

Defined macros

FAPPEND defined in line 43; used 2 times
FASYNC defined in line 48; used 3 times
FCNTLCANT defined in line 55; used 2 times
FCREAT defined in line 58; used 5 times
FDEFER defined in line 46; used 5 times
FEXCL defined in line 60; used 3 times
FEXLOCK defined in line 51; used 11 times
FMARK defined in line 45; used 7 times
FMASK defined in line 54; used 1 times
FNDELAY defined in line 42; used 7 times
FOPEN defined in line 38; used 3 times
FSHLOCK defined in line 50; used 11 times
FTRUNC defined in line 59; used 7 times
F_DUPFD defined in line 64; used 3 times
F_GETFD defined in line 65; never used
F_GETFL defined in line 67; never used
F_GETOWN defined in line 69; never used
F_OK defined in line 100; never used
F_SETFD defined in line 66; never used
F_SETFL defined in line 68; never used
F_SETOWN defined in line 70; never used
LOCK_EX defined in line 93; used 6 times
LOCK_NB defined in line 94; used 2 times
LOCK_SH defined in line 92; used 5 times
LOCK_UN defined in line 95; used 1 times
L_INCR defined in line 109; never used
L_SET defined in line 108; never used
L_XTND defined in line 110; never used
O_APPEND defined in line 84; never used
O_CREAT defined in line 85; never used
O_EXCL defined in line 87; never used
O_NDELAY defined in line 83; never used
O_RDONLY defined in line 80; never used
O_RDWR defined in line 82; never used
O_TRUNC defined in line 86; never used
O_WRONLY defined in line 81; never used
R_OK defined in line 103; used 1 times
W_OK defined in line 102; used 1 times
X_OK defined in line 101; used 1 times

Usage of this include

file.h used 45 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 949
Valid CSS Valid XHTML 1.0 Strict