home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / fcntl < prev    next >
Encoding:
Text File  |  1995-10-11  |  3.3 KB  |  96 lines

  1. /*
  2.  * $Header: /ax/networking:include/sys/fcntl.h:networking  1.2  $
  3.  * $Source: /ax/networking:include/sys/fcntl.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    fcntl.h,v $
  8.  * Revision 1.2  95/09/19  14:12:04  pwain
  9.  * changed #endif __FCNTL_HEADER__ to comment out __FCNTL_HEADER
  10.  * to avoid armcc complaining.
  11.  *
  12.  * Revision 1.1  95/01/11  10:19:14  kwelton
  13.  * Initial revision
  14.  *
  15.  * Revision 1.3  88/06/17  20:19:13  beta
  16.  * Acorn Unix initial beta version
  17.  *
  18.  */
  19. /* @(#)fcntl.h    1.2 87/08/26 3.2/4.3NFSSRC */
  20. /* @(#)fcntl.h    1.2 86/12/15 NFSSRC */
  21. /*    @(#)fcntl.h 1.1 86/09/25 SMI; from UCB 5.1 85/05/30    */
  22. /*
  23.  * Copyright (c) 1983 Regents of the University of California.
  24.  * All rights reserved.  The Berkeley software License Agreement
  25.  * specifies the terms and conditions for redistribution.
  26.  */
  27.  
  28. #ifndef __FCNTL_HEADER__
  29. #define __FCNTL_HEADER__
  30.  
  31. /*
  32.  * Flag values accessible to open(2) and fcntl(2)
  33.  *  (The first three can only be set by open)
  34.  */
  35. #define    O_RDONLY    0
  36. #define    O_WRONLY    1
  37. #define    O_RDWR        2
  38. #define    O_NDELAY    FNDELAY    /* Non-blocking I/O */
  39. #define    O_APPEND    FAPPEND    /* append (writes guaranteed at the end) */
  40. #define    O_CREAT        FCREAT    /* open with file create */
  41. #define    O_TRUNC        FTRUNC    /* open with truncation */
  42. #define    O_EXCL        FEXCL    /* error on create if file exists */
  43.  
  44. /* flags for F_GETFL, F_SETFL-- needed by <sys/file.h> */
  45. #define    FNDELAY        00004        /* non-blocking reads */
  46. #define    FAPPEND        00010        /* append on each write */
  47. #define    FASYNC        00100        /* signal pgrp when data ready */
  48. #define    FCREAT        01000        /* create if nonexistant */
  49. #define    FTRUNC        02000        /* truncate to zero length */
  50. #define    FEXCL        04000        /* error if already created */
  51.  
  52. /* fcntl(2) requests */
  53. #define    F_DUPFD    0    /* Duplicate fildes */
  54. #define    F_GETFD    1    /* Get fildes flags */
  55. #define    F_SETFD    2    /* Set fildes flags */
  56. #define    F_GETFL    3    /* Get file flags */
  57. #define    F_SETFL    4    /* Set file flags */
  58. #define    F_GETOWN 5    /* Get owner */
  59. #define F_SETOWN 6    /* Set owner */
  60. #define F_GETLK  7      /* Get record-locking information */
  61. #define F_SETLK  8      /* Set or Clear a record-lock (Non-Blocking) */
  62. #define F_SETLKW 9      /* Set or Clear a record-lock (Blocking) */
  63.  
  64. /* access(2) requests */
  65. #define    F_OK        0    /* does file exist */
  66. #define    X_OK        1    /* is it executable by caller */
  67. #define    W_OK        2    /* writable by caller */
  68. #define    R_OK        4    /* readable by caller */
  69.  
  70. /* System-V record-locking options */
  71. /* lockf(2) requests */
  72. #define F_ULOCK 0       /* Unlock a previously locked region */
  73. #define F_LOCK  1       /* Lock a region for exclusive use */
  74. #define F_TLOCK 2       /* Test and lock a region for exclusive use */
  75. #define F_TEST  3       /* Test a region for other processes locks */
  76.  
  77. /* fcntl(2) flags (l_type field of flock structure) */
  78. #define F_RDLCK 1       /* read lock */
  79. #define F_WRLCK 2       /* write lock */
  80. #define F_UNLCK 3       /* remove lock(s) */
  81.  
  82.  
  83. /* file segment locking set data type - information passed to system by user */
  84. struct flock {
  85.         short   l_type;        /* F_RDLCK, F_WRLCK, or F_UNLCK */
  86.         short   l_whence;    /* flag to choose starting offset */
  87.         long    l_start;    /* relative offset, in bytes */
  88.         long    l_len;          /* length, in bytes; 0 means lock to EOF */
  89.         short   l_pid;        /* returned with F_GETLK */
  90.         short   l_xxx;        /* reserved for future use */
  91. };
  92.  
  93. #endif /* !__FCNTL_HEADER__ */
  94.  
  95. /* EOF fcntl.h */
  96.