home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / sys / file.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  3.8 KB  |  140 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10.  
  11. #ident    "@(#)//usr/ucbinclude/sys/file.h.sl 1.1 4.0 12/08/90 12175 AT&T-USL"
  12.  
  13. /*******************************************************************
  14.  
  15.         PROPRIETARY NOTICE (Combined)
  16.  
  17. This source code is unpublished proprietary information
  18. constituting, or derived under license from AT&T's UNIX(r) System V.
  19. In addition, portions of such source code were derived from Berkeley
  20. 4.3 BSD under license from the Regents of the University of
  21. California.
  22.  
  23.  
  24.  
  25.         Copyright Notice 
  26.  
  27. Notice of copyright on this source code product does not indicate 
  28. publication.
  29.  
  30.     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  31.     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  32.               All rights reserved.
  33. ********************************************************************/ 
  34.  
  35. #ifndef _SYS_FILE_H
  36. #define _SYS_FILE_H
  37.  
  38. #ifndef _SYS_TYPES_H
  39. #include <sys/types.h>
  40. #endif
  41.  
  42. /*
  43.  * One file structure is allocated for each open/creat/pipe call.
  44.  * Main use is to hold the read/write pointer associated with
  45.  * each open file.
  46.  */
  47.  
  48. typedef struct file
  49. {
  50.     struct file  *f_next;        /* pointer to next entry */
  51.     struct file  *f_prev;        /* pointer to previous entry */
  52.     ushort    f_flag;
  53.     cnt_t    f_count;        /* reference count */
  54.     struct vnode *f_vnode;        /* pointer to vnode structure */
  55.     off_t    f_offset;        /* read/write character pointer */
  56.     struct    cred *f_cred;        /* credentials of user who opened it */
  57.     struct    aioreq *f_aiof;        /* aio file list forward link    */
  58.     struct    aioreq *f_aiob;        /* aio file list backward link    */
  59. /* #ifdef MERGE */
  60.     struct    file *f_slnk;        /* XENIX semaphore queue */
  61. /* #endif MERGE */
  62. } file_t;
  63.  
  64.  
  65. #ifndef _SYS_FCNTL_H
  66. #include <sys/fcntl.h>
  67. #endif
  68.  
  69. /* flags - see also fcntl.h*/
  70.  
  71. #ifndef FOPEN
  72. #define    FOPEN    0xFFFFFFFF
  73. #define    FREAD    0x01
  74. #define    FWRITE    0x02
  75. #define    FNDELAY    0x04
  76. #define    FAPPEND    0x08
  77. #define FSYNC    0x10
  78. #define    FNONBLOCK    0x80    /* Non-blocking flag (POSIX).    */
  79.  
  80. #define    FMASK    0xff        /* should be disjoint from FASYNC */
  81.  
  82. /* open only modes */
  83.  
  84. #define    FCREAT    0x100
  85. #define    FTRUNC    0x200
  86. #define    FEXCL    0x400
  87. #define    FNOCTTY    0x800        /* don't allocate controlling tty (POSIX). */
  88. #define FASYNC    0x1000        /* asyncio is in progress */
  89. #define FPRIV    0x1000        /* open with private access */
  90.  
  91. /* file descriptor flags */
  92. #define FCLOSEXEC    001    /* close on exec */
  93. #endif
  94.  
  95. /* record-locking options. */
  96. #define F_ULOCK         0       /* Unlock a previously locked region */
  97. #define F_LOCK          1       /* Lock a region for exclusive use */
  98. #define F_TLOCK         2       /* Test and lock a region for exclusive use */
  99. #define F_TEST          3       /* Test a region for other processes locks */
  100.  
  101. /*
  102.  * Access call.
  103.  */
  104. #define F_OK            0       /* does file exist */
  105. #define X_OK            1       /* is it executable by caller */
  106. #define W_OK            2       /* writable by caller */
  107. #define R_OK            4       /* readable by caller */
  108.  
  109. /*
  110.  * Lseek call.
  111.  */
  112. #ifndef L_SET
  113. #define L_SET           0       /* absolute offset */
  114. #define L_INCR          1       /* relative to current offset */
  115. #define L_XTND          2       /* relative to end of file */
  116. #endif
  117.  
  118.  
  119. /* miscellaneous defines */
  120.  
  121. #define NULLFP ((struct file *)0)
  122.  
  123. /*
  124.  * Count of number of entries in file list.
  125.  */
  126. extern unsigned int filecnt;
  127.  
  128. /*
  129.  * routines dealing with user per-open file flags and
  130.  * user open files.  getf() is declared in systm.h.  It
  131.  * probably belongs here.
  132.  */
  133. extern void setf(), setpof();
  134. extern char getpof();
  135. extern int fassign();
  136.  
  137. extern off_t lseek();
  138.  
  139. #endif    /* _SYS_FILE_H */
  140.