Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #ifndef __dj_include_sys_stat_h_
  3. #define __dj_include_sys_stat_h_
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  10.  
  11. #ifndef __STRICT_ANSI__
  12.  
  13. #define S_ISBLK(m)      (((m) & 0xf000) == 0x1000)
  14. #define S_ISCHR(m)      (((m) & 0xf000) == 0x2000)
  15. #define S_ISDIR(m)      (((m) & 0xf000) == 0x3000)
  16. #define S_ISFIFO(m)     (((m) & 0xf000) == 0x4000)
  17. #define S_ISREG(m)      (((m) & 0xf000) == 0x0000)
  18.  
  19. #define S_ISUID         0x80000000
  20. #define S_ISGID         0x40000000
  21.  
  22. #define S_IRUSR         00400
  23. #define S_IRGRP         00040
  24. #define S_IROTH         00004
  25. #define S_IWUSR         00200
  26. #define S_IWGRP         00020
  27. #define S_IWOTH         00002
  28. #define S_IXUSR         00100
  29. #define S_IXGRP         00010
  30. #define S_IXOTH         00001
  31. #define S_IRWXU         00700
  32. #define S_IRWXG         00070
  33. #define S_IRWXO         00007
  34.  
  35. #include <sys/types.h>
  36. #include <sys/djtypes.h>
  37. __DJ_time_t
  38. #undef __DJ_time_t
  39. #define __DJ_time_t
  40.  
  41. struct stat {
  42.   time_t        st_atime;
  43.   time_t        st_ctime;
  44.   dev_t         st_dev;
  45.   gid_t         st_gid;
  46.   ino_t         st_ino;
  47.   mode_t        st_mode;
  48.   time_t        st_mtime;
  49.   nlink_t       st_nlink;
  50.   off_t         st_size;
  51.   off_t         st_blksize;
  52.   uid_t         st_uid;
  53.   dev_t         st_rdev; /* unused */
  54.   int          st_blocks;
  55. };
  56.  
  57. int     chmod(const char *_path, mode_t _mode);
  58. int     fstat(int _fildes, struct stat *_buf);
  59. int     mkdir(const char *_path, mode_t _mode);
  60. int     mkfifo(const char *_path, mode_t _mode);
  61. int     stat(const char *_path, struct stat *_buf);
  62. mode_t  umask(mode_t _cmask);
  63.  
  64. #ifndef _POSIX_SOURCE
  65.  
  66. /* POSIX.1 doesn't mention these at all */
  67.  
  68. #define S_IFMT          0xf000
  69.  
  70. #define S_IFREG         0x0000
  71. #define S_IFBLK         0x1000
  72. #define S_IFCHR         0x2000
  73. #define S_IFDIR         0x3000
  74. #define S_IFIFO         0x4000
  75. #define S_IFFIFO        S_IFIFO
  76.  
  77. #define S_IFLABEL       0x5000
  78. #define S_ISLABEL(m)    (((m) & 0xf000) == 0x5000)
  79.  
  80. void            _fixpath(const char *, char *);
  81. unsigned short  _get_magic(const char *, int);
  82. int             _is_executable(const char *, int, const char *);
  83. int             mknod(const char *_path, mode_t _mode, dev_t _dev);
  84. char          * _truename(const char *, char *);
  85.  
  86. /* Bit-mapped variable _djstat_flags describes what expensive
  87.    f?stat() features our application needs.  If you don't need a
  88.    feature, set its bit in the variable.  By default, all the
  89.    bits are cleared (i.e., you get the most expensive code).  */
  90. #define _STAT_INODE         1   /* should we bother getting inode numbers? */
  91. #define _STAT_EXEC_EXT      2   /* get execute bits from file extension? */
  92. #define _STAT_EXEC_MAGIC    4   /* get execute bits from magic signature? */
  93. #define _STAT_DIRSIZE       8   /* compute directory size? */
  94. #define _STAT_ROOT_TIME  0x10   /* try to get root dir time stamp? */
  95. #define _STAT_WRITEBIT   0x20   /* fstat() needs write bit? */
  96.  
  97. extern unsigned short   _djstat_flags;
  98.  
  99. /* Bit-mapped variable _djstat_fail_bits describes which individual
  100.    undocumented features f?stat() failed to use.  To get a human-
  101.    readable description of the bits, call _djstat_describe_lossage(). */
  102. #define _STFAIL_SDA         1   /* Get SDA call failed */
  103. #define _STFAIL_OSVER       2   /* Unsupported DOS version */
  104. #define _STFAIL_BADSDA      4   /* Bad pointer to SDA */
  105. #define _STFAIL_TRUENAME    8   /* _truename() failed */
  106. #define _STFAIL_HASH     0x10   /* inode defaults to hashing */
  107. #define _STFAIL_LABEL    0x20   /* Root dir, but no volume label */
  108. #define _STFAIL_DCOUNT   0x40   /* dirent_count ridiculously large */
  109. #define _STFAIL_WRITEBIT 0x80   /* fstat() failed to get write access bit */
  110. #define _STFAIL_DEVNO   0x100   /* fstat() failed to get device number */
  111. #define _STFAIL_BADSFT  0x200   /* SFT entry found, but can't be trusted */
  112. #define _STFAIL_SFTIDX  0x400   /* bad SFT index in JFT */
  113. #define _STFAIL_SFTNF   0x800   /* file entry not found in SFT array */
  114.  
  115. extern unsigned short   _djstat_fail_bits;
  116.  
  117. #endif /* !_POSIX_SOURCE */
  118. #endif /* !__STRICT_ANSI__ */
  119. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  120.  
  121. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  122. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  123.  
  124. #ifdef __cplusplus
  125. }
  126. #endif
  127.  
  128. #endif /* !__dj_include_sys_stat_h_ */
  129.