|
|
1.1 ! root 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
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.