home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / file.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  3.0 KB  |  120 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. #ifndef _SYS_FILE_H
  11. #define _SYS_FILE_H
  12.  
  13. #ident    "@(#)/usr/include/sys/file.h.sl 1.1 4.0 12/08/90 14222 AT&T-USL"
  14. /*
  15.  * One file structure is allocated for each open/creat/pipe call.
  16.  * Main use is to hold the read/write pointer associated with
  17.  * each open file.
  18.  */
  19. typedef struct file {
  20.     struct file  *f_next;        /* pointer to next entry */
  21.     struct file  *f_prev;        /* pointer to previous entry */
  22.     ushort    f_flag;
  23.     cnt_t    f_count;        /* reference count */
  24.     struct vnode *f_vnode;        /* pointer to vnode structure */
  25.     off_t    f_offset;        /* read/write character pointer */
  26.     struct    cred *f_cred;        /* credentials of user who opened it */
  27.     struct    aioreq *f_aiof;        /* aio file list forward link    */
  28.     struct    aioreq *f_aiob;        /* aio file list backward link    */
  29.     union {
  30.         off_t f_off;
  31. /* XENIX Support */
  32.         struct    file *f_slnk;    /* XENIX semaphore queue */
  33. /* End XENIX Support */
  34.     } f_un;
  35. } file_t;
  36.  
  37. #define f_offset    f_un.f_off    /* read/write character pointer */
  38.  
  39. /* flags */
  40.  
  41. #define    FOPEN        0xFFFFFFFF
  42. #define    FREAD        0x01
  43. #define    FWRITE        0x02
  44. #define    FNDELAY        0x04
  45. #define    FAPPEND        0x08
  46. #define    FSYNC        0x10
  47.  
  48. /*
  49.  * The new flag is added for raw disk async I/O feature.
  50.  */
  51. #define    FRAIOSIG    0x20    /* cause a signal for a completed RAIO request */ 
  52.  
  53. #define    FNONBLOCK    0x80
  54.  
  55. #define    FMASK        0xFF    /* should be disjoint from FASYNC */
  56.  
  57. /* open-only modes */
  58.  
  59. #define FCREAT      0x0100
  60. #define FTRUNC      0x0200
  61. #define FEXCL       0x0400
  62. #define FNOCTTY     0x0800
  63.  
  64. /* Internal flag used by SVR4 async i/o feature */
  65. #define FASYNC      0x1000
  66.  
  67. /* file descriptor flags */
  68. #define FCLOSEXEC    001    /* close on exec */
  69.  
  70. /* miscellaneous defines */
  71.  
  72. #define NULLFP ((struct file *)0)
  73.  
  74. #ifndef L_SET
  75. #define    L_SET    0    /* for lseek */
  76. #endif /* L_SET */
  77.  
  78. /*
  79.  * Count of number of entries in file list.
  80.  */
  81. extern unsigned int filecnt;
  82.  
  83. /*
  84.  * Routines dealing with user per-open file flags and
  85.  * user open files.  
  86.  */
  87.  
  88. #if defined(__STDC__)
  89. extern int getf(int, file_t **);
  90. extern void closeall(int);
  91. extern int closef(file_t *);
  92. extern int ufalloc(int, int *);
  93. extern int falloc(struct vnode *, int, file_t **, int *);
  94. extern void finit(void);
  95. extern void unfalloc(file_t *);
  96. extern void setf(int, file_t *);
  97. extern char getpof(int);
  98. extern void setpof(int, char);
  99. extern int filesearch(struct vnode *);
  100. extern int fassign(struct vnode **, int, int*);
  101.  
  102. #else
  103.  
  104. extern int getf();
  105. extern void closeall();
  106. extern int closef();
  107. extern int ufalloc();
  108. extern int falloc();
  109. extern void finit();
  110. extern void unfalloc();
  111. extern void setf();
  112. extern char getpof();
  113. extern void setpof();
  114. extern int filesearch();
  115. extern int fassign();
  116.  
  117. #endif    /* __STDC__ */
  118.  
  119. #endif    /* _SYS_FILE_H */
  120.