home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_07 / LATTIC_3.ZIP / HEADERS / FCNTL.H < prev    next >
C/C++ Source or Header  |  1990-08-21  |  3KB  |  106 lines

  1. /*
  2.  * fcntl.h - level 1 I/O interface file
  3.  *
  4.  * Started 28/8/89 Alex G. Kiernan, based on Lattice source
  5.  *
  6.  * Copyright (c) 1989 HiSoft and Lattice, Inc.
  7.  */
  8.  
  9. #ifndef _FCNTL_H
  10. #define _FCNTL_H
  11.  
  12. #ifndef    _SIZE_T
  13. #define    _SIZE_T
  14. typedef unsigned long int size_t;
  15. #endif
  16.  
  17. /*
  18.  *
  19.  * The following symbols are used for the "open" and "creat" functions.
  20.  * They are generally UNIX-compatible, except for O_APPEND under MSDOS,
  21.  * which has been moved in order to accomodate the file sharing flags
  22.  * defined in MSDOS Version 3.
  23.  *
  24.  */
  25. #define O_RDONLY    0    /* Read-only value (right byte of mode word) */
  26. #define O_WRONLY    1    /* Write-only value */
  27. #define O_RDWR        2    /* Read-write value */
  28. #define O_NDELAY    0    /* Non-blocking I/O flag (N/A) */
  29. #define O_APPEND    8    /* Append mode flag */
  30.  
  31. #define O_CREAT    0x0100    /* File creation flag */
  32. #define O_TRUNC    0x0200    /* File truncation flag */
  33. #define O_EXCL    0x0400    /* Exclusive access flag */
  34.  
  35. #define O_RAW    0x8000    /* Raw I/O flag (Lattice feature) */
  36.  
  37. #define O_BINARY O_RAW    /* popular synonym */
  38.  
  39. /*
  40.  *
  41.  * The following flags are used to establish the protection mode.
  42.  *
  43.  */
  44. #define S_IREAD    0000400
  45. #define S_IWRITE    0000200
  46. #define S_IEXEC    0000100
  47.  
  48. /*
  49.  *
  50.  * The following symbols are used for the "fcntl" function.
  51.  *
  52.  */
  53. #define F_DUPFD 0    /* Duplicate file descriptor */
  54. #define F_GETFD 1    /* Get file descriptor flags */
  55. #define F_SETFD 2    /* Set file descriptor flags */
  56. #define F_GETFL 3    /* Get file flags */
  57. #define F_SETFL 4    /* Set file flags */
  58.  
  59. /*
  60.  *
  61.  * External definitions
  62.  *
  63.  */
  64.  
  65. int open(const char *, int, ...);
  66. int opene(const char *, int, int, char *);
  67. long read(int, void *, size_t);
  68. long write(int, const void *, size_t);
  69. int creat(const char *, int);
  70. long lseek(int, long, int);
  71. long tell(int);
  72. int close(int);
  73. int iomode(int, int);
  74.  
  75. int isatty(int);
  76. long filelength(int);
  77.  
  78. #ifndef __NO_FCNTL_DEFINES
  79. #define creat(name, prot)    open(name,O_WRONLY|O_TRUNC|O_CREAT|(prot & O_RAW),(prot & ~O_RAW))
  80. #endif
  81.  
  82. #undef rename
  83. int rename(const char *,const char *);
  84. #ifndef __NO_FCNTL_DEFINES
  85. long _lgscc(int,int,const char *,const char *);
  86. #pragma inline d0=_lgscc((short),(short),,)    {register d2,a2; "4e41";}
  87. #define rename(x,y)    _CXCERR(_lgscc(0x56,0,x,y))
  88. #endif
  89.  
  90. #undef remove
  91. int remove(const char *);
  92. #ifndef __NO_FCNTL_DEFINES
  93. long _lgc(int,const char *);
  94. #pragma inline d0=_lgc((short),)    {register d2,a2; "4e41";}
  95. #define remove(x)    _CXCERR(_lgc(0x41,x))
  96. #endif
  97.  
  98. #undef unlink
  99. int unlink(const char *);
  100. #ifndef __NO_FCNTL_DEFINES
  101. #define unlink remove
  102. #endif
  103.  
  104. #define NULL    ((void *)0)
  105. #endif
  106.