Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 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 
36
#include 
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
};
55
 
56
int	chmod(const char *_path, mode_t _mode);
57
int	fstat(int _fildes, struct stat *_buf);
58
int	mkdir(const char *_path, mode_t _mode);
59
int	mkfifo(const char *_path, mode_t _mode);
60
int	stat(const char *_path, struct stat *_buf);
61
mode_t	umask(mode_t _cmask);
62
 
63
#ifndef _POSIX_SOURCE
64
 
65
/* POSIX.1 doesn't mention these at all */
66
 
67
#define S_IFMT		0xf000
68
 
69
#define S_IFREG		0x0000
70
#define S_IFBLK		0x1000
71
#define S_IFCHR		0x2000
72
#define S_IFDIR		0x3000
73
#define S_IFIFO		0x4000
74
#define S_IFFIFO	S_IFIFO
75
 
76
#define S_IFLABEL	0x5000
77
#define S_ISLABEL(m)	(((m) & 0xf000) == 0x5000)
78
 
79
void	        _fixpath(const char *, char *);
80
unsigned short  _get_magic(const char *, int);
81
int             _is_executable(const char *, int, const char *);
82
int		mknod(const char *_path, mode_t _mode, dev_t _dev);
83
char          * _truename(const char *, char *);
84
 
85
/* Bit-mapped variable _djstat_flags describes what expensive
86
   f?stat() features our application needs.  If you don't need a
87
   feature, set its bit in the variable.  By default, all the
88
   bits are cleared (i.e., you get the most expensive code).  */
89
#define _STAT_INODE         1   /* should we bother getting inode numbers? */
90
#define _STAT_EXEC_EXT      2   /* get execute bits from file extension? */
91
#define _STAT_EXEC_MAGIC    4   /* get execute bits from magic signature? */
92
#define _STAT_DIRSIZE       8   /* compute directory size? */
93
#define _STAT_ROOT_TIME  0x10   /* try to get root dir time stamp? */
94
#define _STAT_WRITEBIT   0x20   /* fstat() needs write bit? */
95
 
96
extern unsigned short   _djstat_flags;
97
 
98
/* Bit-mapped variable _djstat_fail_bits describes which individual
99
   undocumented features f?stat() failed to use.  To get a human-
100
   readable description of the bits, call _djstat_describe_lossage(). */
101
#define _STFAIL_SDA         1   /* Get SDA call failed */
102
#define _STFAIL_OSVER       2   /* Unsupported DOS version */
103
#define _STFAIL_BADSDA      4   /* Bad pointer to SDA */
104
#define _STFAIL_TRUENAME    8   /* _truename() failed */
105
#define _STFAIL_HASH     0x10   /* inode defaults to hashing */
106
#define _STFAIL_LABEL    0x20   /* Root dir, but no volume label */
107
#define _STFAIL_DCOUNT   0x40   /* dirent_count ridiculously large */
108
#define _STFAIL_WRITEBIT 0x80   /* fstat() failed to get write access bit */
109
#define _STFAIL_DEVNO   0x100   /* fstat() failed to get device number */
110
#define _STFAIL_BADSFT  0x200   /* SFT entry found, but can't be trusted */
111
#define _STFAIL_SFTIDX  0x400   /* bad SFT index in JFT */
112
#define _STFAIL_SFTNF   0x800   /* file entry not found in SFT array */
113
 
114
extern unsigned short   _djstat_fail_bits;
115
 
116
#endif /* !_POSIX_SOURCE */
117
#endif /* !__STRICT_ANSI__ */
118
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
119
 
120
#ifndef __dj_ENFORCE_FUNCTION_CALLS
121
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
122
 
123
#ifdef __cplusplus
124
}
125
#endif
126
 
127
#endif /* !__dj_include_sys_stat_h_ */