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