Fork me on GitHub

root/include/fiwix/stat.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _FIWIX_STAT_H
   2 #define _FIWIX_STAT_H
   3 
   4 #include <fiwix/statbuf.h>
   5 
   6 /* Encoding of the file mode.  These are the standard Unix values,
   7    but POSIX.1 does not specify what values should be used.  */
   8 
   9 #define S_IFMT          0170000         /* Type of file mask */
  10 
  11 /* File types.  */
  12 #define S_IFIFO         0010000         /* Named pipe (fifo) */
  13 #define S_IFCHR         0020000         /* Character special */
  14 #define S_IFDIR         0040000         /* Directory */
  15 #define S_IFBLK         0060000         /* Block special */
  16 #define S_IFREG         0100000         /* Regular */
  17 #define S_IFLNK         0120000         /* Symbolic link */
  18 #define S_IFSOCK        0140000         /* Socket */
  19 
  20 /* Protection bits.  */
  21 #define S_IXUSR         00100           /* USER   --x------ */
  22 #define S_IWUSR         00200           /* USER   -w------- */
  23 #define S_IRUSR         00400           /* USER   r-------- */
  24 #define S_IRWXU         00700           /* USER   rwx------ */
  25 
  26 #define S_IXGRP         00010           /* GROUP  -----x--- */
  27 #define S_IWGRP         00020           /* GROUP  ----w---- */
  28 #define S_IRGRP         00040           /* GROUP  ---r----- */
  29 #define S_IRWXG         00070           /* GROUP  ---rwx--- */
  30 
  31 #define S_IXOTH         00001           /* OTHERS --------x */
  32 #define S_IWOTH         00002           /* OTHERS -------w- */
  33 #define S_IROTH         00004           /* OTHERS ------r-- */
  34 #define S_IRWXO         00007           /* OTHERS ------rwx */
  35 
  36 #define S_ISUID         0004000         /* set user id on execution */
  37 #define S_ISGID         0002000         /* set group id on execution */
  38 #define S_ISVTX         0001000         /* sticky bit */
  39 
  40 #define S_IREAD         S_IRUSR         /* Read by owner.  */
  41 #define S_IWRITE        S_IWUSR         /* Write by owner.  */
  42 #define S_IEXEC         S_IXUSR         /* Execute by owner.  */
  43 
  44 #define S_ISFIFO(m)     (((m) & S_IFMT) == S_IFIFO)
  45 #define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)
  46 #define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
  47 #define S_ISBLK(m)      (((m) & S_IFMT) == S_IFBLK)
  48 #define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
  49 #define S_ISLNK(m)      (((m) & S_IFMT) == S_IFLNK)
  50 #define S_ISSOCK(m)     (((m) & S_IFMT) == S_IFSOCK)
  51 
  52 #define TO_READ         4       /* test for read permission */
  53 #define TO_WRITE        2       /* test for write permission */
  54 #define TO_EXEC         1       /* test for execute permission */
  55 
  56 #endif /* _FIWIX_STAT_H */

/* [previous][next][first][last][top][bottom][index][help] */