home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / sys / fcntl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  5.5 KB  |  201 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/fcntl.h.sl 1.1 4.0 12/08/90 7882 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_FCNTL_H
  36. #define _SYS_FCNTL_H
  37.  
  38. #ifndef _SYS_TYPES_H
  39. #include <sys/types.h>
  40. #endif
  41.  
  42. /* Flag values accessible to open(2) and fcntl(2) */
  43. /*  (The first three can only be set by open) */
  44. #define    O_RDONLY 0
  45. #define    O_WRONLY 1
  46. #define    O_RDWR     2
  47. #define    O_NDELAY 04    /* Non-blocking I/O */
  48. #define    O_APPEND 010    /* append (writes guaranteed at the end) */
  49. #define O_SYNC     020    /* synchronous write option */
  50. #define O_NONBLOCK 0200 /* Non-blocking I/O (POSIX) */
  51. #define O_PRIV 010000   /* Private access to file */
  52.  
  53. /* Flag values accessible only to open(2) */
  54. #define    O_CREAT    00400    /* open with file create (uses third open arg)*/
  55. #define    O_TRUNC    01000    /* open with truncation */
  56. #define    O_EXCL    02000    /* exclusive open */
  57. #define    O_NOCTTY 04000    /* don't allocate controlling tty (POSIX) */
  58.  
  59. /* fcntl(2) requests */
  60. #define    F_DUPFD        0    /* Duplicate fildes */
  61. #define    F_GETFD        1    /* Get fildes flags */
  62. #define    F_SETFD        2    /* Set fildes flags */
  63. #define    F_GETFL        3    /* Get file flags */
  64. #define    F_SETFL        4    /* Set file flags */
  65. #define    F_SETLK        6    /* Set file lock */
  66. #define    F_SETLKW    7    /* Set file lock and wait */
  67.  
  68. /* Applications that read /dev/mem must be built like the kernel. A new
  69. ** symbol "_KMEMUSER" is defined for this purpose. Applications that read /dev/mem
  70. ** will migrate with the kernel to an "_LTYPES" definition.
  71. */
  72.  
  73. #if defined(_KERNEL) || defined(_KMEMUSER)
  74. #define    F_GETLK        14    /* Get file lock */
  75. #define    F_O_GETLK    5    /* SVR3 Get file lock */
  76.  
  77. #else    /* user definition */
  78.  
  79. #if defined(_LTYPES)    /* EFT definition */
  80. #define    F_GETLK        14    /* Get file lock */
  81. #else
  82. #define    F_GETLK        5    /* Get file lock */
  83. #endif    /* defined(_LTYPES) */
  84.  
  85. #endif    /* defined(_KERNEL) */
  86.  
  87. #define    F_SETLK        6    /* Set file lock */
  88. #define    F_SETLKW    7    /* Set file lock and wait */
  89.  
  90.  
  91. #define    F_CHKFL        8    /* Reserved */
  92. #define    F_ALLOCSP    10    /* Reserved */
  93. #define    F_FREESP    11    /* Free file space */
  94. #define    F_ISSTREAM    13    /* Is the file desc. a stream ? */
  95. #define    F_PRIV        15    /* Turn on private access to file */
  96. #define    F_NPRIV        16    /* Turn off private access to file */
  97. #define F_QUOTACTL    17    /* UFS quota call */
  98. #define F_BLOCKS    18    /* Get number of BLKSIZE blocks allocated */
  99. #define F_BLKSIZE    19    /* Get optimal I/O block size */ 
  100.  
  101. #define F_RSETLK    20    /* Remote SETLK for NFS */
  102. #define F_RGETLK    21    /* Remote GETLK for NFS */
  103. #define F_RSETLKW    22    /* Remote SETLKW for NFS */
  104.  
  105. #define    F_GETOWN    23    /* Get owner */
  106. #define    F_SETOWN    24    /* Set owner */
  107.  
  108. /* flags for F_GETFL, F_SETFL-- copied from <sys/file.h> */
  109. #ifndef FOPEN
  110. #define FOPEN           0xFFFFFFFF
  111. #define FREAD           0x01
  112. #define FWRITE          0x02
  113. #define FNDELAY         0x04
  114. #define FAPPEND         0x08
  115. #define FSYNC           0x10
  116. #define FNONBLOCK       0x80
  117.  
  118. #define FMASK           0xFF    /* should be disjoint from FASYNC */
  119.  
  120. /* open-only modes */
  121.  
  122. #define FCREAT          0x0100
  123. #define FTRUNC          0x0200
  124. #define FEXCL           0x0400
  125. #define FNOCTTY         0x0800
  126. #define FASYNC          0x1000
  127.  
  128. /* file descriptor flags */
  129. #define FCLOSEXEC       001     /* close on exec */
  130. #endif
  131.  
  132. /*
  133.  * File segment locking set data type - information passed to system by user.
  134.  */
  135. #if defined(_KERNEL) || defined(_KMEMUSER)
  136.     /* EFT definition */
  137. typedef struct flock {
  138.     short    l_type;
  139.     short    l_whence;
  140.     off_t    l_start;
  141.     off_t    l_len;        /* len == 0 means until end of file */
  142.         long    l_sysid;
  143.         pid_t    l_pid;
  144.     long    pad[4];        /* reserve area */
  145. } flock_t;
  146.  
  147. typedef struct o_flock {
  148.     short    l_type;
  149.     short    l_whence;
  150.     long    l_start;
  151.     long    l_len;        /* len == 0 means until end of file */
  152.         short   l_sysid;
  153.         o_pid_t l_pid;
  154. } o_flock_t;
  155.  
  156. #else        /* user level definition */
  157.  
  158. #if defined(_STYPES)
  159.     /* SVR3 definition */
  160. typedef struct flock {
  161.     short    l_type;
  162.     short    l_whence;
  163.     off_t    l_start;
  164.     off_t    l_len;        /* len == 0 means until end of file */
  165.     short    l_sysid;
  166.         o-pid_t    l_pid;
  167. } flock_t;
  168.  
  169. #else
  170.  
  171. typedef struct flock {
  172.     short    l_type;
  173.     short    l_whence;
  174.     off_t    l_start;
  175.     off_t    l_len;        /* len == 0 means until end of file */
  176.     long    l_sysid;
  177.         pid_t    l_pid;
  178.     long     pad[4];        /* reserve area */
  179. } flock_t;
  180.  
  181. #endif    /* define(_STYPES) */
  182.  
  183. #endif    /* defined(_KERNEL) */
  184.  
  185. /*
  186.  * File segment locking types.
  187.  */
  188. #define    F_RDLCK    01    /* Read lock */
  189. #define    F_WRLCK    02    /* Write lock */
  190. #define    F_UNLCK    03    /* Remove lock(s) */
  191.  
  192. /*
  193.  * POSIX constants
  194.  */
  195.  
  196. #define O_ACCMODE       3       /* Mask for file access modes */
  197. #define FD_CLOEXEC      1       /* close on exec flag */
  198.  
  199.  
  200. #endif    /* _SYS_FCNTL_H */
  201.