Ignore:
File:
1 edited

Legend:

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

    re7f7c93 r53900ab  
    11/*
    22 * Copyright (c) 2011 Jiri Zarevucky
    3  * Copyright (c) 2011 Petr Koupy
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup libposix
    31  * @{
    32  */
    33 /** @file
    34  */
    35 
    3629#ifndef POSIX_SYS_STAT_H_
    3730#define POSIX_SYS_STAT_H_
    3831
    3932#include "../libc/sys/stat.h"
    40 #include "types.h"
    41 #include "../time.h"
    42 #include <ipc/devmap.h>
    43 #include <task.h>
    44 
    45 typedef devmap_handle_t posix_dev_t;
    46 typedef task_id_t posix_pid_t;
     33#include "time.h"
    4734
    4835/* values are the same as on Linux */
    49 
    50 #undef S_IFMT
    51 #undef S_IFSOCK
    52 #undef S_IFLNK
    53 #undef S_IFREG
    54 #undef S_IFBLK
    55 #undef S_IFDIR
    56 #undef S_IFCHR
    57 #undef S_IFIFO
    5836#define S_IFMT     0170000   /* all file types */
    5937#define S_IFSOCK   0140000   /* socket */
     
    6543#define S_IFIFO    0010000   /* FIFO */
    6644
    67 #undef S_ISUID
    68 #undef S_ISGID
    69 #undef S_ISVTX
    7045#define S_ISUID    0004000   /* SUID */
    7146#define S_ISGID    0002000   /* SGID */
    7247#define S_ISVTX    0001000   /* sticky */
    7348
    74 #undef S_IRWXU
    75 #undef S_IRUSR
    76 #undef S_IWUSR
    77 #undef S_IXUSR
    7849#define S_IRWXU    00700     /* owner permissions */
    7950#define S_IRUSR    00400
     
    8152#define S_IXUSR    00100
    8253
    83 #undef S_IRWXG
    84 #undef S_IRGRP
    85 #undef S_IWGRP
    86 #undef S_IXGRP
    8754#define S_IRWXG    00070     /* group permissions */
    8855#define S_IRGRP    00040
     
    9057#define S_IXGRP    00010
    9158
    92 #undef S_IRWXO
    93 #undef S_IROTH
    94 #undef S_IWOTH
    95 #undef S_IXOTH
    9659#define S_IRWXO    00007     /* other permissions */
    9760#define S_IROTH    00004
     
    9962#define S_IXOTH    00001
    10063
    101 #undef S_ISREG
    102 #undef S_ISDIR
    103 #undef S_ISCHR
    104 #undef S_ISBLK
    105 #undef S_ISFIFO
    106 #undef S_ISLNK
    107 #undef S_ISSOCK
    10864#define S_ISREG(m) ((m & S_IFREG) != 0)
    10965#define S_ISDIR(m) ((m & S_IFDIR) != 0)
     
    11167#define S_ISBLK(m) ((m & S_IFBLK) != 0)
    11268#define S_ISFIFO(m) ((m & S_IFIFO) != 0)
    113 #define S_ISLNK(m) ((m & S_IFLNK) != 0) /* symbolic link? (Not in POSIX.1-1996.) */
     69#define S_ISLNK(m) ((m & S_IFLNK) != 0)   /* symbolic link? (Not in POSIX.1-1996.) */
    11470#define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
     71
     72typedef devmap_handle_t dev_t;
     73typedef unsigned int ino_t;
     74typedef unsigned int nlink_t;
     75typedef unsigned int uid_t;
     76typedef unsigned int gid_t;
     77typedef aoff64_t off_t;
     78typedef unsigned int blksize_t;
     79typedef unsigned int blkcnt_t;
    11580
    11681struct posix_stat {
    11782        struct stat sys_stat;
    11883
    119         posix_dev_t     st_dev;     /* ID of device containing file */
    120         posix_ino_t     st_ino;     /* inode number */
    121         mode_t          st_mode;    /* protection */
    122         posix_nlink_t   st_nlink;   /* number of hard links */
    123         posix_uid_t     st_uid;     /* user ID of owner */
    124         posix_gid_t     st_gid;     /* group ID of owner */
    125         posix_dev_t     st_rdev;    /* device ID (if special file) */
    126         posix_off_t     st_size;    /* total size, in bytes */
    127         posix_blksize_t st_blksize; /* blocksize for file system I/O */
    128         posix_blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
    129         time_t          st_atime;   /* time of last access */
    130         time_t          st_mtime;   /* time of last modification */
    131         time_t          st_ctime;   /* time of last status change */
     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 */
    13297};
    13398
    134 extern int posix_fstat(int fd, struct posix_stat *st);
    135 extern int posix_lstat(const char *restrict path, struct posix_stat *restrict st);
    136 extern int posix_stat(const char *restrict path, struct posix_stat *restrict st);
    137 extern int posix_chmod(const char *path, mode_t mode);
    138 extern mode_t posix_umask(mode_t mask);
     99extern int posix_fstat(int, struct posix_stat *);
     100extern int posix_stat(const char *, struct posix_stat *);
    139101
    140102#ifndef LIBPOSIX_INTERNAL
    141         #define dev_t posix_dev_t
    142         #define pid_t posix_pid_t
    143103        #define fstat posix_fstat
    144         #define lstat posix_lstat
    145104        #define stat posix_stat
    146         #define chmod posix_chmod
    147         #define umask posix_umask
    148105#endif
    149106
    150107#endif /* POSIX_SYS_STAT_H */
    151108
    152 /** @}
    153  */
Note: See TracChangeset for help on using the changeset viewer.