some types and constants modified for compatibility with Microsoft POSIX

svn path=/trunk/; revision=2761
This commit is contained in:
KJK::Hyperion 2002-03-22 01:26:28 +00:00
parent 4e0441ed70
commit 3b1645e839
7 changed files with 344 additions and 336 deletions

View file

@ -1,4 +1,4 @@
/* $Id: stat.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
/* $Id: stat.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* sys/stat.h
@ -33,20 +33,20 @@
/* TYPES */
struct stat
{
dev_t st_dev; /* ID of device containing file */
ino_t st_ino; /* file serial number */
mode_t st_mode; /* mode of file (see below) */
ino_t st_ino; /* file serial number */
dev_t st_dev; /* ID of device containing file */
nlink_t st_nlink; /* number of links to the file */
uid_t st_uid; /* user ID of file */
gid_t st_gid; /* group ID of file */
dev_t st_rdev; /* device ID (if file is character or block special) */
off_t st_size; /* file size in bytes (if file is a regular file) */
time_t st_atime; /* time of last access */
time_t st_mtime; /* time of last data modification */
time_t st_ctime; /* time of last status change */
dev_t st_rdev; /* device ID (if file is character or block special) */
blksize_t st_blksize; /* a filesystem-specific preferred I/O block size for
this object. In some filesystem types, this may
vary from file to file */
vary from file to file */
blkcnt_t st_blocks; /* number of blocks allocated for this object */
};
@ -54,45 +54,47 @@ struct stat
/*
file type
*/
#define S_IFBLK (1) /* block special */
#define S_IFCHR (2) /* character special */
#define S_IFIFO (3) /* FIFO special */
#define S_IFREG (4) /* regular */
#define S_IFDIR (5) /* directory */
#define S_IFLNK (6) /* symbolic link */
#define S_IFIFO (000010000) /* FIFO special */
#define S_IFCHR (000020000) /* character special */
#define S_IFDIR (000040000) /* directory */
#define S_IFBLK (000060000) /* block special */
#define S_IFREG (000100000) /* regular */
#define S_IFLNK (000200000) /* symbolic link */
#define S_IFSOCK (000400000) /* socket */
/* type of file */
#define S_IFMT (S_IFBLK | S_IFCHR | S_IFIFO | S_IFREG | S_IFDIR | S_IFLNK)
#define S_IFMT (000770000)
/*
file mode bits
*/
#define S_IRUSR (000000400) /* read permission, owner */
#define S_IWUSR (000000200) /* write permission, owner */
#define S_IXUSR (000000100) /* execute/search permission, owner */
#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) /* read, write, execute/search by owner */
#define S_IRUSR (0x00000001) /* read permission, owner */
#define S_IWUSR (0x00000002) /* write permission, owner */
#define S_IXUSR (0x00000004) /* execute/search permission, owner */
#define S_IRGRP (000000040) /* read permission, group */
#define S_IWGRP (000000020) /* write permission, group */
#define S_IXGRP (000000010) /* execute/search permission, group */
#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) /* read, write, execute/search by group */
#define S_IRGRP (0x00000010) /* read permission, group */
#define S_IWGRP (0x00000020) /* write permission, group */
#define S_IXGRP (0x00000040) /* execute/search permission, group */
#define S_IROTH (000000004) /* read permission, others */
#define S_IWOTH (000000002) /* write permission, others */
#define S_IXOTH (000000001) /* execute/search permission, others */
#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) /* read, write, execute/search by others */
#define S_IROTH (0x00000100) /* read permission, others */
#define S_IWOTH (0x00000200) /* write permission, others */
#define S_IXOTH (0x00000400) /* execute/search permission, others */
#define S_ISUID (0x00001000) /* set-user-ID on execution */
#define S_ISGID (0x00002000) /* set-group-ID on execution */
#define S_ISVTX (0x00004000) /* on directories, restricted deletion flag */
#define S_ISUID (000004000) /* set-user-ID on execution */
#define S_ISGID (000002000) /* set-group-ID on execution */
#define S_ISVTX (000010000) /* on directories, restricted deletion flag */
/*
the following macros will test whether a file is of the specified type
*/
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)