|
|
|
@ -229,30 +229,63 @@ struct sockaddr_storage {
|
|
|
|
|
struct stat {
|
|
|
|
|
dev_t st_dev;
|
|
|
|
|
ino_t st_ino;
|
|
|
|
|
ulong st_nlink;
|
|
|
|
|
|
|
|
|
|
mode_t st_mode;
|
|
|
|
|
off_t st_size;
|
|
|
|
|
dev_t st_rdev;
|
|
|
|
|
uid_t st_uid;
|
|
|
|
|
gid_t st_gid;
|
|
|
|
|
uint32_t _pad0;
|
|
|
|
|
|
|
|
|
|
dev_t st_rdev;
|
|
|
|
|
off_t st_size;
|
|
|
|
|
ulong st_blksize;
|
|
|
|
|
blkcnt_t st_blocks;
|
|
|
|
|
|
|
|
|
|
time_t st_atime;
|
|
|
|
|
ulong st_atimensec;
|
|
|
|
|
time_t st_mtime;
|
|
|
|
|
ulong st_mtimensec;
|
|
|
|
|
time_t st_ctime;
|
|
|
|
|
ulong st_ctimensec;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define S_IFMT (0xffff0000ul)
|
|
|
|
|
#define S_IFREG (1ul << 16)
|
|
|
|
|
#define S_IFDIR (2ul << 16)
|
|
|
|
|
#define S_IFIFO (3ul << 16)
|
|
|
|
|
#define S_IFLNK (4ul << 16)
|
|
|
|
|
#define S_IFBLK (5ul << 16)
|
|
|
|
|
|
|
|
|
|
// XXX cleanup modes/dev majors
|
|
|
|
|
#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR)
|
|
|
|
|
#define S_ISDEV(mode) (MAJOR(mode) != 0)
|
|
|
|
|
#define S_ISFIFO(mode) ((mode & S_IFMT) == S_IFIFO)
|
|
|
|
|
#define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG)
|
|
|
|
|
#define S_ISSOCK(mode) (MAJOR(mode) == 2)
|
|
|
|
|
#define S_ISLNK(mode) ((mode & S_IFMT) == S_IFLNK)
|
|
|
|
|
#define S_ISBLK(mode) (MAJOR(mode) == S_IFBLK)
|
|
|
|
|
#define S_IFMT 00170000
|
|
|
|
|
#define S_IFSOCK 0140000
|
|
|
|
|
#define S_IFLNK 0120000
|
|
|
|
|
#define S_IFREG 0100000
|
|
|
|
|
#define S_IFBLK 0060000
|
|
|
|
|
#define S_IFDIR 0040000
|
|
|
|
|
#define S_IFCHR 0020000
|
|
|
|
|
#define S_IFIFO 0010000
|
|
|
|
|
|
|
|
|
|
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
|
|
|
|
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
|
|
|
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
|
|
|
|
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
|
|
|
|
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
|
|
|
|
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
|
|
|
|
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
|
|
|
|
|
|
|
|
|
// wrj: S_ISDEV is non-standard. just guess:
|
|
|
|
|
#define S_ISDEV(m) (((m) & S_IFMT) == S_IFBLK \
|
|
|
|
|
|| ((m) & S_IFMT) == S_IFCHR \
|
|
|
|
|
|| ((m) & S_IFMT) == S_IFSOCK)
|
|
|
|
|
|
|
|
|
|
//#define S_IFMT (0xffff0000ul)
|
|
|
|
|
//#define S_IFREG (1ul << 16)
|
|
|
|
|
//#define S_IFDIR (2ul << 16)
|
|
|
|
|
//#define S_IFIFO (3ul << 16)
|
|
|
|
|
//#define S_IFLNK (4ul << 16)
|
|
|
|
|
//#define S_IFBLK (5ul << 16)
|
|
|
|
|
//
|
|
|
|
|
//// XXX cleanup modes/dev majors
|
|
|
|
|
//#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR)
|
|
|
|
|
//#define S_ISDEV(mode) (MAJOR(mode) != 0)
|
|
|
|
|
//#define S_ISFIFO(mode) ((mode & S_IFMT) == S_IFIFO)
|
|
|
|
|
//#define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG)
|
|
|
|
|
//#define S_ISSOCK(mode) (MAJOR(mode) == 2)
|
|
|
|
|
//#define S_ISLNK(mode) ((mode & S_IFMT) == S_IFLNK)
|
|
|
|
|
//#define S_ISBLK(mode) (MAJOR(mode) == S_IFBLK)
|
|
|
|
|
|
|
|
|
|
// please never use these
|
|
|
|
|
#define S_ISUID (04000)
|
|
|
|
|