#ifndef _LINUX_STAT_H
#define _LINUX_STAT_H

#include <linux/types.h>

#ifdef __cplusplus
extern "C" {
#endif

#define __S_IFMT           0170000 /* type of file */
#define         __S_IFDIR  0040000 /* directory */
#define         __S_IFCHR  0020000 /* character special */
#define         __S_IFBLK  0060000 /* block special */
#define         __S_IFREG  0100000 /* regular */
#define         __S_IFLNK  0120000 /* symbolic link */
#define         __S_IFSOCK 0140000 /* named socket */
#define         __S_IFIFO  0010000 /* fifo */

#define __S_ISLNK(m)  (((m)&__S_IFMT) == __S_IFLNK)
#define __S_ISSOCK(m) (((m)&__S_IFMT) == __S_IFSOCK)

#define __S_ISUID 0004000       /* set user id on execution */
#define __S_ISGID 0002000       /* set group id on execution */
#define __S_ISVTX 0001000       /* save swapped text even after use */

#define __S_IRWXU 0000700 /* rwx for owner */
#define __S_IRUSR 0000400 /* read permission for owner */
#define __S_IWUSR 0000200 /* write permission for owner */
#define __S_IXUSR 0000100 /* execute/search permission for owner */
#define __S_IRWXG 0000070 /* rwx for group */
#define __S_IRGRP 0000040 /* read permission for group */
#define __S_IWGRP 0000020 /* write permission for grougroup */
#define __S_IXGRP 0000010 /* execute/search permission for group */
#define __S_IRWXO 0000007 /* rwx for other */
#define __S_IROTH 0000004 /* read permission for other */
#define __S_IWOTH 0000002 /* write permission for other */
#define __S_IXOTH 0000001 /* execute/search permission for other */

struct stat {
    mode_t  st_mode;            /* ownership/protection */
    ino_t   st_ino;             /* file id */
    dev_t   st_dev;             /* file system id */
    dev_t   st_rdev;
    nlink_t st_nlink;           /* number of links */
    uid_t   st_uid;             /* user id */
    gid_t   st_gid;             /* group id */
    off_t   st_size;            /* file size in # of bytes */
    time_t  st_atime;           /* time file was last accessed */
    time_t  st_mtime;           /* time file was last modified */
    time_t  st_ctime;           /* time file status was last changed */
    u_long  st_blksize;  /* block size */
    u_long  st_blocks;   /* file size in # of blocks */
    u_long  st_attrib;

    u_long  st_fYear;
    u_long  st_fMonth;
    u_long  st_fDay;
    u_long  st_fHour;
    u_long  st_fMinute;
    u_long  st_fSecond;
};

#ifdef __cplusplus
}
#endif

#endif
