⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stat.mh

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 MH
字号:
:segment QNX
:include quantum/stat.mh
:elsesegment
/*
 *  sys/stat.h  Equates and prototype for fstat, stat functions
 *
:include crwat.sp
 */
:segment LINUX
#ifndef _STAT_H_INCLUDED
#define _STAT_H_INCLUDED
:include readonly.sp
:include cpluspro.sp

#ifndef __TYPES_H_INCLUDED
 #include <sys/types.h>
#endif

:include lnxkpack.sp
:include incdir.sp

/* Versions of the `struct stat' data structure.  */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL    1
#define _STAT_VER_SVR4      2
#define _STAT_VER_LINUX     3
#define _STAT_VER           _STAT_VER_LINUX /* The one defined below.  */

#include _ARCH_INCLUDE(sys/stat.h)

/* Tell code we have these members.  */
#define _STATBUF_ST_BLKSIZE
#define _STATBUF_ST_RDEV

/* Encoding of the file mode */

#define _S_IFMT     0xF000              /*  Type of file                    */
#define _S_IFIFO    0x1000              /*  FIFO                            */
#define _S_IFCHR    0x2000              /*  Character special               */
#define _S_IFDIR    0x4000              /*  Directory                       */
#define _S_IFNAM    0x5000              /*  Special named file              */
#define _S_IFBLK    0x6000              /*  Block special                   */
#define _S_IFREG    0x8000              /*  Regular                         */
#define _S_IFLNK    0xA000              /*  Symbolic link                   */
#define _S_IFSOCK   0xC000              /*  Socket                          */

#define S_ISFIFO(m) (((m)&_S_IFMT)==_S_IFIFO) /* Test for FIFO.             */
#define S_ISCHR(m)  (((m)&_S_IFMT)==_S_IFCHR) /* Test for char special file.*/
#define S_ISDIR(m)  (((m)&_S_IFMT)==_S_IFDIR) /* Test for directory file.   */
#define S_ISBLK(m)  (((m)&_S_IFMT)==_S_IFBLK) /* Test for block specl file. */
#define S_ISREG(m)  (((m)&_S_IFMT)==_S_IFREG) /* Test for regular file.     */

#if defined(_POSIX_SOURCE) || !defined(NO_EXT_KEYS)
#define S_ISLNK(m)  (((m)&_S_IFMT)==_S_IFLNK) /* Test for symbolic link.    */
#define S_ISNAM(m)  (((m)&_S_IFMT)==_S_IFNAM) /* Test for special named file*/
#define S_ISSOCK(m) (((m)&_S_IFMT)==_S_IFSOCK)/* Test for socket.           */

/*
 *  Common filetype macros
 */
#define S_IFMT      _S_IFMT             /*  Type of file                    */
#define S_IFIFO     _S_IFIFO            /*  FIFO                            */
#define S_IFCHR     _S_IFCHR            /*  Character special               */
#define S_IFDIR     _S_IFDIR            /*  Directory                       */
#define S_IFNAM     _S_IFNAM            /*  Special named file              */
#define S_IFBLK     _S_IFBLK            /*  Block special                   */
#define S_IFREG     _S_IFREG            /*  Regular                         */
#define S_IFLNK     _S_IFLNK            /*  Symbolic link                   */
#define S_IFSOCK    _S_IFSOCK           /*  Socket                          */
#endif

#define S_ISUID     004000              /* set user id on execution         */
#define S_ISGID     002000              /* set group id on execution        */
#define S_ISVTX     001000              /* sticky bit (does nothing yet)    */
#define S_ENFMT     002000              /* enforcement mode locking         */

/*
 *  Owner permissions
 */
#define S_IRWXU     000700              /*  Read, write, execute/search     */
#define S_IRUSR     000400              /*  Read permission                 */
#define S_IWUSR     000200              /*  Write permission                */
#define S_IXUSR     000100              /*  Execute/search permission       */
#define S_IREAD     S_IRUSR             /*  Read permission                 */
#define S_IWRITE    S_IWUSR             /*  Write permission                */
#define S_IEXEC     S_IXUSR             /*  Execute/search permission       */

/*
 *  Group permissions
 */
#define S_IRWXG     000070              /*  Read, write, execute/search     */
#define S_IRGRP     000040              /*  Read permission                 */
#define S_IWGRP     000020              /*  Write permission                */
#define S_IXGRP     000010              /*  Execute/search permission       */

/*
 *  Other permissions
 */
#define S_IRWXO     000007              /*  Read, write, execute/search     */
#define S_IROTH     000004              /*  Read permission                 */
#define S_IWOTH     000002              /*  Write permission                */
#define S_IXOTH     000001              /*  Execute/search permission       */

/*
 *  POSIX 1003.1 Prototypes.
 */
_WCRTLINK extern int     chmod( const char *__path, mode_t __mode );
_WCRTLINK extern int     stat( const char *__path, struct stat *__buf );
_WCRTLINK extern int     lstat( const char *__path, struct stat *__buf );
_WCRTLINK extern int     fchmod( int __fildes, mode_t __mode );
_WCRTLINK extern int     fstat( int __fildes, struct stat *__buf );
_WCRTLINK extern int     mkdir( const char *__path, mode_t __mode );
_WCRTLINK extern int     mkfifo( const char *__path, mode_t __mode );
_WCRTLINK extern int     mknod( const char *__path, mode_t __mode, int __dev );
_WCRTLINK extern mode_t  umask( mode_t __cmask );
#ifdef __cplusplus
};
#endif

:include poppack.sp
#endif
:elsesegment
#ifndef _STAT_H_INCLUDED
#define _STAT_H_INCLUDED
:include readonly.sp
:include cpluspro.sp

#ifndef _COMDEF_H_INCLUDED
 #include <_comdef.h>
#endif

:segment DOS
#ifndef _MAX_NAME
#define _MAX_NAME 13    /* maximum length of file name (with extension) */
#endif
:endsegment

:include wchar_t.sp

#ifndef __TYPES_H_INCLUDED
 #include <sys/types.h>
#endif

:include pshpackl.sp

struct _stat {
        dev_t   st_dev;         /* disk drive file resides on */
        ino_t   st_ino;         /* this inode's #, not used for DOS */
        unsigned short st_mode; /* file mode */
        short   st_nlink;       /* # of hard links */
:segment DOS
        unsigned long  st_uid;  /* user-id, always 'root' */
:elsesegment
        short   st_uid;         /* user-id, always 'root' */
:endsegment
        short   st_gid;         /* group-id, always 'root' */
        dev_t   st_rdev;        /* should be device type */
                                /* but same as st_dev for the time being */
        off_t   st_size;        /* total file size */
        time_t  st_atime;       /* should be file last access time */
        time_t  st_mtime;       /* file last modify time */
        time_t  st_ctime;       /* should be file last status change time */
:segment DOS
        time_t                  st_btime; /* last archived date and time */
        unsigned long           st_attr;  /* file attributes */
                                               /* next 4 fields Netware only */
        unsigned long           st_archivedID; /* user/object ID that last archived file*/
        unsigned long           st_updatedID;  /* user/object ID that last updated file*/
        unsigned short          st_inheritedRightsMask;
        unsigned char           st_originatingNameSpace;
:endsegment
};

:include ext.sp
/* non-ISO names */
struct stat {
        dev_t   st_dev;         /* disk drive file resides on */
        ino_t   st_ino;         /* this inode's #, not used for DOS */
        unsigned short st_mode; /* file mode */
        short   st_nlink;       /* # of hard links */
:segment DOS
        unsigned long  st_uid;  /* user-id, always 'root' */
:elsesegment
        short   st_uid;         /* user-id, always 'root' */
:endsegment
        short   st_gid;         /* group-id, always 'root' */
        dev_t   st_rdev;        /* should be device type */
                                /* but same as st_dev for the time being */
        off_t   st_size;        /* total file size */
        time_t  st_atime;       /* should be file last access time */
        time_t  st_mtime;       /* file last modify time */
        time_t  st_ctime;       /* should be file last status change time */
:segment DOS
        time_t                  st_btime; /* last archived date and time */
        unsigned long           st_attr;  /* file attributes */
                                               /* next 4 fields Netware only */
        unsigned long           st_archivedID; /* user/object ID that last archived file*/
        unsigned long           st_updatedID;  /* user/object ID that last updated file*/
        unsigned short          st_inheritedRightsMask;
        unsigned char           st_originatingNameSpace;
:endsegment
};
:: end of extensions
#endif

struct _stati64 {
        dev_t   st_dev;         /* disk drive file resides on */
        ino_t   st_ino;         /* this inode's #, not used for DOS */
        unsigned short st_mode; /* file mode */
        short   st_nlink;       /* # of hard links */
:segment DOS
        unsigned long  st_uid;  /* user-id, always 'root' */
:elsesegment
        short   st_uid;         /* user-id, always 'root' */
:endsegment
        short   st_gid;         /* group-id, always 'root' */
        dev_t   st_rdev;        /* should be device type */
                                /* but same as st_dev for the time being */
        __int64 st_size;        /* total file size */
        time_t  st_atime;       /* should be file last access time */
        time_t  st_mtime;       /* file last modify time */
        time_t  st_ctime;       /* should be file last status change time */
:segment DOS
        time_t                  st_btime; /* last archived date and time */
        unsigned long           st_attr;  /* file attributes */
                                               /* next 4 fields Netware only */
        unsigned long           st_archivedID; /* user/object ID that last archived file*/
        unsigned long           st_updatedID;  /* user/object ID that last updated file*/
        unsigned short          st_inheritedRightsMask;
        unsigned char           st_originatingNameSpace;
:endsegment
};

/* File attribute constants for st_mode field */
#define _S_IFMT         0170000 /* type of file */
#define _S_IFDIR        0040000 /* directory */
#define _S_IFCHR        0020000 /* character special file */
#define _S_IFIFO        0010000 /* FIFO */
#define _S_IFREG        0100000 /* regular */
#define _S_IFBLK        0060000 /* block special */
#define _S_IFLNK        0120000 /* symbolic link */
#define _S_IFSOCK       0140000 /* socket */
#define _S_IREAD        0000400
#define _S_IWRITE       0000200
#define _S_IEXEC        0000100
/* Not all of the following are possible on DOSish systems */
#define S_ISBLK( m )    0
#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_ISREG( m )    (((m) & S_IFMT) == S_IFREG)
#define S_ISLNK( m )    0
#define S_ISSOCK( m )   0

/* owner permission */
#define S_IRWXU         0000700
#define S_IRUSR         0000400
#define S_IWUSR         0000200
#define S_IXUSR         0000100

/* group permission.  same as owners on PC */
#define S_IRWXG         0000070
#define S_IRGRP         0000040
#define S_IWGRP         0000020
#define S_IXGRP         0000010

/* other permission.  same as owners on PC */
#define S_IRWXO         0000007
#define S_IROTH         0000004
#define S_IWOTH         0000002
#define S_IXOTH         0000001

/* setuid, setgid, and sticky.  always false on PC */
#define S_ISUID         0004000
#define S_ISGID         0002000
#define S_ISVTX         0001000

_WCRTLINK extern int _fstat( int, struct _stat * );
_WCRTLINK extern int _stat( const char *, struct _stat * );

_WCRTLINK extern int _wstat( const wchar_t *, struct _stat * );
_WCRTLINK extern int _wfstat( int, struct _stat * );

_WCRTLINK extern int _fstati64( int, struct _stati64 * );
_WCRTLINK extern int _wfstati64( int, struct _stati64 * );
_WCRTLINK extern int _stati64( const char *, struct _stati64 * );
_WCRTLINK extern int _wstati64( const wchar_t *, struct _stati64 * );

:include ext.sp
/* non-ISO names */
#define S_IFMT   _S_IFMT
#define S_IFBLK  _S_IFBLK
#define S_IFCHR  _S_IFCHR
#define S_IFIFO  _S_IFIFO
#define S_IFREG  _S_IFREG
#define S_IFDIR  _S_IFDIR
#define S_IFLNK  _S_IFLNK
#define S_IFSOCK _S_IFSOCK
#define S_IREAD  _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IEXEC  _S_IEXEC

_WCRTLINK extern int fstat( int, struct stat * );
_WCRTLINK extern int stat( const char *, struct stat * );
_WCRTLINK extern int lstat( const char *, struct stat * );
:: end of extensions
#endif

:include poppack.sp
:include cplusepi.sp
#endif
:endsegment
:endsegment

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -