|
|
1.1 ! root 1: /* (-lgl ! 2: * COHERENT Version 4.0 ! 3: * Copyright (c) 1982, 1992 by Mark Williams Company. ! 4: * All rights reserved. May not be copied without permission. ! 5: -lgl) */ ! 6: /* ! 7: * /usr/include/sys/fd.h ! 8: * Open file descriptors. ! 9: */ ! 10: ! 11: #ifndef __SYS_FD_H__ ! 12: #define __SYS_FD_H__ ! 13: ! 14: #include <common/feature.h> ! 15: #include <common/ccompat.h> ! 16: #include <sys/types.h> ! 17: #include <sys/inode.h> ! 18: ! 19: #if ! __KERNEL__ ! 20: # error You must be compiling the kernel to use this header ! 21: #endif ! 22: ! 23: /* ! 24: * The FD_CLOEXEC is not actually stored in the structure above, because it ! 25: * is an attribute specific to a single file descriptor rather than global to ! 26: * an open file object (which may have multiple references to it). ! 27: * ! 28: * To capture this information, we note that pointers as returned by an ! 29: * allocator such as kalloc () are all aligned at integer granularity at a ! 30: * minimum, leaving us one or possibly two least-significant bits for pointer- ! 31: * tagging. ! 32: * ! 33: * We create a non-arithmetic pointer type for the purpose of holding tagged ! 34: * pointers. The operations on this type are hidden, however. ! 35: */ ! 36: ! 37: typedef struct __tagged_fd * tagfd_t; ! 38: ! 39: /* ! 40: * We complete this type to work around a Coherent 'cc' bug. ! 41: */ ! 42: struct __tagged_fd { ! 43: char _bogus; ! 44: }; ! 45: ! 46: /* ! 47: * File descriptor structure. ! 48: */ ! 49: ! 50: typedef struct fd { ! 51: short f_flag; /* Flags */ ! 52: short f_refc; /* Reference count */ ! 53: fsize_t f_seek; /* Seek pointer */ ! 54: struct inode *f_ip; /* Pointer to inode */ ! 55: } FD; ! 56: ! 57: typedef unsigned fd_t; ! 58: ! 59: #define ERROR_FD ((fd_t) -1) ! 60: ! 61: __EXTERN_C_BEGIN__ ! 62: ! 63: FD * fdget __PROTO ((fd_t _fd)); ! 64: int fdgetflags __PROTO ((fd_t _fd)); ! 65: int fdsetflags __PROTO ((fd_t _fd, int _flags)); ! 66: ! 67: fd_t fddup __PROTO ((fd_t _old, fd_t _base)); ! 68: fd_t fdalloc __PROTO ((void)); ! 69: int fdinit __PROTO ((fd_t _fd, INODE * _ip, int _mode)); ! 70: fd_t fdfinish __PROTO ((fd_t _fd)); ! 71: fd_t fdopen __PROTO ((INODE * _ip, int _mode)); ! 72: void fdclose __PROTO ((fd_t _fd)); ! 73: ! 74: void fdadupl __PROTO ((void)); ! 75: void fdaclose __PROTO ((void)); ! 76: ! 77: __EXTERN_C_END__ ! 78: ! 79: #endif /* ! defined (__SYS_FD_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.