Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/include/sys/stat.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 2071 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 /*
2 * sys/stat.h
3 */
4
5 #ifndef _SYS_STAT_H
6 #define _SYS_STAT_H
7
8 #include <klibc/extern.h>
9 #include <sys/types.h>
10 #include <sys/time.h> /* For struct timespec */
11 #include <klibc/archstat.h>
12
13 /* 2.6.21 kernels have once again hidden a bunch of stuff... */
14 #ifndef S_IFMT
15
16 #define S_IFMT 00170000
17 #define S_IFSOCK 0140000
18 #define S_IFLNK 0120000
19 #define S_IFREG 0100000
20 #define S_IFBLK 0060000
21 #define S_IFDIR 0040000
22 #define S_IFCHR 0020000
23 #define S_IFIFO 0010000
24 #define S_ISUID 0004000
25 #define S_ISGID 0002000
26 #define S_ISVTX 0001000
27
28 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
29 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
30 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
31 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
32 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
33 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
34 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
35
36 #define S_IRWXU 00700
37 #define S_IRUSR 00400
38 #define S_IWUSR 00200
39 #define S_IXUSR 00100
40
41 #define S_IRWXG 00070
42 #define S_IRGRP 00040
43 #define S_IWGRP 00020
44 #define S_IXGRP 00010
45
46 #define S_IRWXO 00007
47 #define S_IROTH 00004
48 #define S_IWOTH 00002
49 #define S_IXOTH 00001
50
51 #define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
52 #define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
53 #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
54 #define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
55 #define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
56
57 #endif
58
59 #ifdef _STATBUF_ST_NSEC
60 /* struct stat has struct timespec instead of time_t */
61 # define st_atime st_atim.tv_sec
62 # define st_mtime st_mtim.tv_sec
63 # define st_ctime st_ctim.tv_sec
64 #endif
65
66 __extern int stat(const char *, struct stat *);
67 __extern int fstat(int, struct stat *);
68 __extern int fstatat(int, const char *, struct stat *, int);
69 __extern int lstat(const char *, struct stat *);
70 __extern mode_t umask(mode_t);
71 __extern int mknod(const char *, mode_t, dev_t);
72 __extern int mknodat(int, const char *, const char *, mode_t, dev_t);
73 static __inline__ int mkfifo(const char *__p, mode_t __m)
74 {
75 return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t) 0);
76 }
77
78 #endif /* _SYS_STAT_H */