Changeset 4f4b4e7 in mainline for uspace/lib/posix/sys/stat.h


Ignore:
Timestamp:
2011-06-15T23:38:45Z (14 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b08ef1fd
Parents:
ab547063
Message:

Coding style and file structure unified.
_exit moved to unistd.h.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/sys/stat.h

    rab547063 r4f4b4e7  
    11/*
    22 * Copyright (c) 2011 Jiri Zarevucky
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    2728 */
    2829
     30/** @addtogroup libposix
     31 * @{
     32 */
     33/** @file
     34 */
     35
    2936#ifndef POSIX_SYS_STAT_H_
    3037#define POSIX_SYS_STAT_H_
     
    3441
    3542/* values are the same as on Linux */
     43
     44#undef S_IFMT
     45#undef S_IFSOCK
     46#undef S_IFLNK
     47#undef S_IFREG
     48#undef S_IFBLK
     49#undef S_IFDIR
     50#undef S_IFCHR
     51#undef S_IFIFO
    3652#define S_IFMT     0170000   /* all file types */
    3753#define S_IFSOCK   0140000   /* socket */
     
    4359#define S_IFIFO    0010000   /* FIFO */
    4460
     61#undef S_ISUID
     62#undef S_ISGID
     63#undef S_ISVTX
    4564#define S_ISUID    0004000   /* SUID */
    4665#define S_ISGID    0002000   /* SGID */
    4766#define S_ISVTX    0001000   /* sticky */
    4867
     68#undef S_IRWXU
     69#undef S_IRUSR
     70#undef S_IWUSR
     71#undef S_IXUSR
    4972#define S_IRWXU    00700     /* owner permissions */
    5073#define S_IRUSR    00400
     
    5275#define S_IXUSR    00100
    5376
     77#undef S_IRWXG
     78#undef S_IRGRP
     79#undef S_IWGRP
     80#undef S_IXGRP
    5481#define S_IRWXG    00070     /* group permissions */
    5582#define S_IRGRP    00040
     
    5784#define S_IXGRP    00010
    5885
     86#undef S_IRWXO
     87#undef S_IROTH
     88#undef S_IWOTH
     89#undef S_IXOTH
    5990#define S_IRWXO    00007     /* other permissions */
    6091#define S_IROTH    00004
     
    6293#define S_IXOTH    00001
    6394
     95#undef S_ISREG
     96#undef S_ISDIR
     97#undef S_ISCHR
     98#undef S_ISBLK
     99#undef S_ISFIFO
     100#undef S_ISLNK
     101#undef S_ISSOCK
    64102#define S_ISREG(m) ((m & S_IFREG) != 0)
    65103#define S_ISDIR(m) ((m & S_IFDIR) != 0)
     
    67105#define S_ISBLK(m) ((m & S_IFBLK) != 0)
    68106#define S_ISFIFO(m) ((m & S_IFIFO) != 0)
    69 #define S_ISLNK(m) ((m & S_IFLNK) != 0)   /* symbolic link? (Not in POSIX.1-1996.) */
     107#define S_ISLNK(m) ((m & S_IFLNK) != 0) /* symbolic link? (Not in POSIX.1-1996.) */
    70108#define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
    71109
    72 typedef devmap_handle_t dev_t;
    73 typedef unsigned int ino_t;
    74 typedef unsigned int nlink_t;
    75 typedef unsigned int uid_t;
    76 typedef unsigned int gid_t;
    77 typedef aoff64_t off_t;
    78 typedef unsigned int blksize_t;
    79 typedef unsigned int blkcnt_t;
     110typedef devmap_handle_t posix_dev_t;
     111typedef unsigned int posix_ino_t;
     112typedef unsigned int posix_nlink_t;
     113typedef unsigned int posix_uid_t;
     114typedef unsigned int posix_gid_t;
     115typedef aoff64_t posix_off_t;
     116typedef unsigned int posix_blksize_t;
     117typedef unsigned int posix_blkcnt_t;
    80118
    81119struct posix_stat {
    82120        struct stat sys_stat;
    83121
    84         dev_t     st_dev;     /* ID of device containing file */
    85         ino_t     st_ino;     /* inode number */
    86         mode_t    st_mode;    /* protection */
    87         nlink_t   st_nlink;   /* number of hard links */
    88         uid_t     st_uid;     /* user ID of owner */
    89         gid_t     st_gid;     /* group ID of owner */
    90         dev_t     st_rdev;    /* device ID (if special file) */
    91         off_t     st_size;    /* total size, in bytes */
    92         blksize_t st_blksize; /* blocksize for file system I/O */
    93         blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
    94         time_t    st_atime;   /* time of last access */
    95         time_t    st_mtime;   /* time of last modification */
    96         time_t    st_ctime;   /* time of last status change */
     122        posix_dev_t     st_dev;     /* ID of device containing file */
     123        posix_ino_t     st_ino;     /* inode number */
     124        mode_t          st_mode;    /* protection */
     125        posix_nlink_t   st_nlink;   /* number of hard links */
     126        posix_uid_t     st_uid;     /* user ID of owner */
     127        posix_gid_t     st_gid;     /* group ID of owner */
     128        posix_dev_t     st_rdev;    /* device ID (if special file) */
     129        posix_off_t     st_size;    /* total size, in bytes */
     130        posix_blksize_t st_blksize; /* blocksize for file system I/O */
     131        posix_blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
     132        time_t          st_atime;   /* time of last access */
     133        time_t          st_mtime;   /* time of last modification */
     134        time_t          st_ctime;   /* time of last status change */
    97135};
    98136
    99 extern int posix_fstat(int, struct posix_stat *);
    100 extern int posix_stat(const char *, struct posix_stat *);
     137extern int posix_fstat(int fd, struct posix_stat *st);
     138extern int posix_stat(const char *path, struct posix_stat *st);
    101139
    102140#ifndef LIBPOSIX_INTERNAL
     141        #define dev_t posix_dev_t
     142        #define nlink_t posix_nlink_t
     143        #define uid_t posix_uid_t
     144        #define gid_t posix_gid_t
     145        #define off_t posix_off_t
     146        #define blksize_t posix_blksize_t
     147        #define blkcnt_t posix_blkcnt_t
     148
    103149        #define fstat posix_fstat
    104150        #define stat posix_stat
     
    107153#endif /* POSIX_SYS_STAT_H */
    108154
     155/** @}
     156 */
Note: See TracChangeset for help on using the changeset viewer.