2 |
- |
1 |
#ifndef __STAT_H
|
|
|
2 |
#define __STAT_H
|
|
|
3 |
|
|
|
4 |
#ifndef __TYPES_H
|
|
|
5 |
#include <sys/types.h>
|
|
|
6 |
#endif
|
|
|
7 |
|
|
|
8 |
#pragma lib "/$M/lib/ape/libap.a"
|
|
|
9 |
|
|
|
10 |
/*
|
|
|
11 |
* stat structure, used by stat(2) and fstat(2)
|
|
|
12 |
*/
|
|
|
13 |
struct stat {
|
|
|
14 |
dev_t st_dev;
|
|
|
15 |
ino_t st_ino;
|
|
|
16 |
mode_t st_mode;
|
|
|
17 |
nlink_t st_nlink;
|
|
|
18 |
uid_t st_uid;
|
|
|
19 |
gid_t st_gid;
|
|
|
20 |
off_t st_size;
|
|
|
21 |
time_t st_atime;
|
|
|
22 |
time_t st_mtime;
|
|
|
23 |
time_t st_ctime;
|
|
|
24 |
};
|
|
|
25 |
|
|
|
26 |
#define S__MASK 0170000
|
|
|
27 |
#ifdef _RESEARCH_SOURCE
|
|
|
28 |
#define S_ISLNK(m) (((m)&S__MASK) == 0120000)
|
|
|
29 |
#endif
|
|
|
30 |
#define S_ISREG(m) (((m)&S__MASK) == 0100000)
|
|
|
31 |
#define S_ISDIR(m) (((m)&S__MASK) == 0040000)
|
|
|
32 |
#define S_ISCHR(m) (((m)&S__MASK) == 0020000)
|
|
|
33 |
#define S_ISBLK(m) (((m)&S__MASK) == 0060000)
|
|
|
34 |
#define S_ISFIFO(m) (((m)&S__MASK) == 0010000)
|
|
|
35 |
|
|
|
36 |
#define S_ISUID 04000 /* set user id on execution */
|
|
|
37 |
#define S_ISGID 02000 /* set group id on execution */
|
|
|
38 |
#define S_IRWXU 00700 /* read, write, execute: owner */
|
|
|
39 |
#define S_IRUSR 00400 /* read permission: owner */
|
|
|
40 |
#define S_IWUSR 00200 /* write permission: owner */
|
|
|
41 |
#define S_IXUSR 00100 /* execute permission: owner */
|
|
|
42 |
#define S_IRWXG 00070 /* read, write, execute: group */
|
|
|
43 |
#define S_IRGRP 00040 /* read permission: group */
|
|
|
44 |
#define S_IWGRP 00020 /* write permission: group */
|
|
|
45 |
#define S_IXGRP 00010 /* execute permission: group */
|
|
|
46 |
#define S_IRWXO 00007 /* read, write, execute: other */
|
|
|
47 |
#define S_IROTH 00004 /* read permission: other */
|
|
|
48 |
#define S_IWOTH 00002 /* write permission: other */
|
|
|
49 |
#define S_IXOTH 00001 /* execute permission: other */
|
|
|
50 |
|
|
|
51 |
#ifdef _BSD_EXTENSION
|
|
|
52 |
#define S_IFMT S__MASK
|
|
|
53 |
#define S_IFDIR 0040000
|
|
|
54 |
#define S_IFCHR 0020000
|
|
|
55 |
#define S_IFBLK 0060000
|
|
|
56 |
#define S_IFREG 0100000
|
|
|
57 |
#define S_IFIFO 0010000
|
|
|
58 |
#define S_IFLNK 0120000
|
|
|
59 |
#define S_IFSOCK S_IFIFO
|
|
|
60 |
#endif
|
|
|
61 |
|
|
|
62 |
#ifdef __cplusplus
|
|
|
63 |
extern "C" {
|
|
|
64 |
#endif
|
|
|
65 |
|
|
|
66 |
extern mode_t umask(mode_t);
|
|
|
67 |
extern int mkdir(const char *, mode_t);
|
|
|
68 |
extern int mkfifo(const char *, mode_t);
|
|
|
69 |
extern int stat(const char *, struct stat *);
|
|
|
70 |
extern int fstat(int, struct stat *);
|
|
|
71 |
extern int chmod(const char *, mode_t);
|
|
|
72 |
|
|
|
73 |
#ifdef _BSD_EXTENSION
|
|
|
74 |
#pragma lib "/$M/lib/ape/libbsd.a"
|
|
|
75 |
extern int lstat(char *, struct stat *);
|
|
|
76 |
extern int symlink(char *, char *);
|
|
|
77 |
extern int readlink(char *, char*, int);
|
|
|
78 |
#endif
|
|
|
79 |
|
|
|
80 |
#ifdef __cplusplus
|
|
|
81 |
}
|
|
|
82 |
#endif
|
|
|
83 |
|
|
|
84 |
#endif
|