Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  3. #ifndef __dj_include_fcntl_h_
  4. #define __dj_include_fcntl_h_
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. #define FD_CLOEXEC      0x0001
  11.  
  12. #define F_DUPFD         1
  13. #define F_GETFD         2
  14. #define F_GETFL         3
  15. #define F_GETLK         4
  16. #define F_SETFD         5
  17. #define F_SETFL         6
  18. #define F_SETLK         7
  19. #define F_SETLKW        8
  20.  
  21. #define F_UNLCK         0
  22. #define F_RDLCK         1
  23. #define F_WRLCK         2
  24.  
  25. #define O_RDONLY        0x0000
  26. #define O_WRONLY        0x0001
  27. #define O_RDWR          0x0002
  28. #define O_ACCMODE       0x0003
  29.  
  30. #define O_BINARY        0x0004  /* must fit in char, reserved by dos */
  31. #define O_TEXT          0x0008  /* must fit in char, reserved by dos */
  32. #define O_NOINHERIT     0x0080  /* DOS-specific */
  33.  
  34. #define O_CREAT         0x0100  /* second byte, away from DOS bits */
  35. #define O_EXCL          0x0200
  36. #define O_NOCTTY        0x0400
  37. #define O_TRUNC         0x0800
  38. #define O_APPEND        0x1000
  39. #define O_NONBLOCK      0x2000
  40.  
  41. #include <sys/types.h>
  42.  
  43. struct flock {
  44.   off_t l_len;
  45.   pid_t l_pid;
  46.   off_t l_start;
  47.   short l_type;
  48.   short l_whence;
  49. };
  50.  
  51. extern int _fmode; /* O_TEXT or O_BINARY */
  52.  
  53. int     open(const char *_path, int _oflag, ...);
  54. int     creat(const char *_path, mode_t _mode);
  55. int     fcntl(int _fildes, int _cmd, ...);
  56.  
  57. #define SH_COMPAT       0x0000
  58. #define SH_DENYRW       0x0010
  59. #define SH_DENYWR       0x0020
  60. #define SH_DENYRD       0x0030
  61. #define SH_DENYNO       0x0040
  62.  
  63. #define _SH_COMPAT      SH_COMPAT
  64. #define _SH_DENYRW      SH_DENYRW
  65. #define _SH_DENYWR      SH_DENYWR
  66. #define _SH_DENYRD      SH_DENYRD
  67. #define _SH_DENYNO      SH_DENYNO
  68.  
  69. extern int __djgpp_share_flags;
  70.  
  71. #define S_IREAD         S_IRUSR
  72. #define S_IWRITE        S_IWUSR
  73. #define S_IEXEC         S_IXUSR
  74.  
  75. /*
  76.  *  For compatibility with other DOS C compilers.
  77.  */
  78.  
  79. #define _O_RDONLY       O_RDONLY
  80. #define _O_WRONLY       O_WRONLY
  81. #define _O_RDWR         O_RDWR
  82. #define _O_APPEND       O_APPEND
  83. #define _O_CREAT        O_CREAT
  84. #define _O_TRUNC        O_TRUNC
  85. #define _O_EXCL         O_EXCL
  86. #define _O_TEXT         O_TEXT
  87. #define _O_BINARY       O_BINARY
  88. #define _O_NOINHERIT    O_NOINHERIT
  89.  
  90. /*
  91.  * Support for advanced filesystems (Windows 9x VFAT, NTFS, LFN etc.)
  92.  */
  93.  
  94. #define _FILESYS_UNKNOWN        0x80000000U
  95. #define _FILESYS_CASE_SENSITIVE 0x0001
  96. #define _FILESYS_CASE_PRESERVED 0x0002
  97. #define _FILESYS_UNICODE        0x0004
  98. #define _FILESYS_LFN_SUPPORTED  0x4000
  99. #define _FILESYS_VOL_COMPRESSED 0x8000
  100.  
  101. unsigned _get_volume_info (const char *_path, int *_max_file_len, int *_max_path_len, char *_filesystype);
  102. char _use_lfn (const char *_path);
  103. char *_lfn_gen_short_fname (const char *_long_fname, char *_short_fname);
  104.  
  105. #define _LFN_CTIME      1
  106. #define _LFN_ATIME      2
  107.  
  108. unsigned _lfn_get_ftime (int _handle, int _which);
  109.  
  110. char _preserve_fncase (void);
  111.  
  112. #ifndef _USE_LFN
  113. #define _USE_LFN        _use_lfn(0) /* assume it's the same on ALL drives */
  114. #endif
  115.  
  116. #ifdef __cplusplus
  117. }
  118. #endif
  119.  
  120. #endif /* !__dj_include_fcntl_h_ */
  121.