home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / fcntl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  2.7 KB  |  81 lines

  1. /*    Copyright (c) 1984, 1986, 1987, 1988 AT&T    */
  2. /*      All Rights Reserved      */
  3.  
  4. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  5. /*    The copyright notice above does not evidence any       */
  6. /*    actual or intended publication of such source code.    */
  7.  
  8. /*    Copyright (c) 1987, 1988 Microsoft Corporation    */
  9. /*      All Rights Reserved    */
  10.  
  11. /*    This Module contains Proprietary Information of Microsoft  */
  12. /*    Corporation and should be treated as Confidential.       */
  13.  
  14. #ident    "@(#)head.sys:fcntl.h    1.3.1.3"
  15.  
  16. /* Flag values accessible to open(2) and fcntl(2) */
  17. /*  (The first three can only be set by open) */
  18. #define    O_RDONLY 0
  19. #define    O_WRONLY 1
  20. #define    O_RDWR     2
  21. #define    O_NDELAY 04    /* Non-blocking I/O */
  22. #define    O_APPEND 010    /* append (writes guaranteed at the end) */
  23. #define O_SYNC     020    /* synchronous write option */
  24.  
  25. /* Flag values accessible only to open(2) */
  26. #define    O_CREAT    00400    /* open with file create (uses third open arg)*/
  27. #define    O_TRUNC    01000    /* open with truncation */
  28. #define    O_EXCL    02000    /* exclusive open */
  29.  
  30. /* fcntl(2) requests */
  31. #define    F_DUPFD        0    /* Duplicate fildes */
  32. #define    F_GETFD        1    /* Get fildes flags */
  33. #define    F_SETFD        2    /* Set fildes flags */
  34. #define    F_GETFL        3    /* Get file flags */
  35. #define    F_SETFL        4    /* Set file flags */
  36. #define    F_GETLK        5    /* Get file lock */
  37. #define    F_SETLK        6    /* Set file lock */
  38. #define    F_SETLKW    7    /* Set file lock and wait */
  39. #define    F_CHKFL        8    /* reserved */
  40. #define    F_ALLOCSP    10    /* reserved */
  41. #define    F_FREESP    11    /* reserved */
  42. #define F_CHSIZE    0x6000     /* XENIX chsize() system call */    
  43. #define F_RDCHK        0x6001    /* XENIX rdchk() system call */
  44.  
  45. /*
  46.  * Fcntl(2) requests made from the XENIX locking(S) system call.  These fcntl() 
  47.  * requests are made only from the kernel.
  48.  *
  49.  * N.B.  The high nibble of the high byte is F_SETLK or F_SETLKW, and the low
  50.  *       nibble of the high byte is F_UNLCK, F_WRLCK, or F_RDLCK.  However,
  51.  *     no code actually relies on this.  
  52.  */ 
  53.  
  54. #define F_LK_UNLCK    0x6300    /* locking() LK_UNLCK request */
  55. #define F_LK_LOCK    0x7200    /* locking() LK_LOCK request */
  56. #define F_LK_NBLCK    0x6200    /* locking() LK_NBLCK request */
  57. #define F_LK_RLCK    0x7100    /* locking() LK_RLCK request */
  58. #define F_LK_NBRLCK    0x6100    /* locking() LK_NBRLCK request */
  59.  
  60. #define LK_CMDTYPE(x)    ((x >> 12) & 0x7) /* get high nibble of high byte */
  61. #define LK_LCKTYPE(x)    ((x >> 8) & 0x7)  /* get low nibble of high byte */
  62.  
  63.  
  64. /* file segment locking set data type - information passed to system by user */
  65. struct flock {
  66.     short    l_type;
  67.     short    l_whence;
  68.     long    l_start;
  69.     long    l_len;        /* len = 0 means until end of file */
  70.         short   l_sysid;
  71.         short   l_pid;
  72. };
  73.  
  74. /* file segment locking types */
  75.     /* Read lock */
  76. #define    F_RDLCK    01
  77.     /* Write lock */
  78. #define    F_WRLCK    02
  79.     /* Remove lock(s) */
  80. #define    F_UNLCK    03
  81.