The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/stat.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1982, 1986, 1989, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  * (c) UNIX System Laboratories, Inc.
    5  * All or some portions of this file are derived from material licensed
    6  * to the University of California by American Telephone and Telegraph
    7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
    8  * the permission of UNIX System Laboratories, Inc.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *      This product includes software developed by the University of
   21  *      California, Berkeley and its contributors.
   22  * 4. Neither the name of the University nor the names of its contributors
   23  *    may be used to endorse or promote products derived from this software
   24  *    without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   36  * SUCH DAMAGE.
   37  *
   38  *      @(#)stat.h      8.12 (Berkeley) 6/16/95
   39  * $FreeBSD: stable/3/sys/sys/stat.h 59908 2000-05-02 23:41:38Z archie $
   40  */
   41 
   42 #ifndef _SYS_STAT_H_
   43 #define _SYS_STAT_H_
   44 
   45 #if !defined(KERNEL) && !defined(_POSIX_SOURCE)
   46 /*
   47  * XXX we need this for struct timespec.  We get miscellaneous namespace
   48  * pollution with it.
   49  */
   50 #include <sys/time.h>
   51 #endif
   52 
   53 #ifndef _POSIX_SOURCE
   54 struct ostat {
   55         u_int16_t st_dev;               /* inode's device */
   56         ino_t     st_ino;               /* inode's number */
   57         mode_t    st_mode;              /* inode protection mode */
   58         nlink_t   st_nlink;             /* number of hard links */
   59         u_int16_t st_uid;               /* user ID of the file's owner */
   60         u_int16_t st_gid;               /* group ID of the file's group */
   61         u_int16_t st_rdev;              /* device type */
   62         int32_t   st_size;              /* file size, in bytes */
   63         struct  timespec st_atimespec;  /* time of last access */
   64         struct  timespec st_mtimespec;  /* time of last data modification */
   65         struct  timespec st_ctimespec;  /* time of last file status change */
   66         int32_t   st_blksize;           /* optimal blocksize for I/O */
   67         int32_t   st_blocks;            /* blocks allocated for file */
   68         u_int32_t st_flags;             /* user defined flags for file */
   69         u_int32_t st_gen;               /* file generation number */
   70 };
   71 #endif /* !_POSIX_SOURCE */
   72 
   73 struct stat {
   74         dev_t     st_dev;               /* inode's device */
   75         ino_t     st_ino;               /* inode's number */
   76         mode_t    st_mode;              /* inode protection mode */
   77         nlink_t   st_nlink;             /* number of hard links */
   78         uid_t     st_uid;               /* user ID of the file's owner */
   79         gid_t     st_gid;               /* group ID of the file's group */
   80         dev_t     st_rdev;              /* device type */
   81 #ifndef _POSIX_SOURCE
   82         struct  timespec st_atimespec;  /* time of last access */
   83         struct  timespec st_mtimespec;  /* time of last data modification */
   84         struct  timespec st_ctimespec;  /* time of last file status change */
   85 #else
   86         time_t    st_atime;             /* time of last access */
   87         long      st_atimensec;         /* nsec of last access */
   88         time_t    st_mtime;             /* time of last data modification */
   89         long      st_mtimensec;         /* nsec of last data modification */
   90         time_t    st_ctime;             /* time of last file status change */
   91         long      st_ctimensec;         /* nsec of last file status change */
   92 #endif
   93         off_t     st_size;              /* file size, in bytes */
   94         int64_t   st_blocks;            /* blocks allocated for file */
   95         u_int32_t st_blksize;           /* optimal blocksize for I/O */
   96         u_int32_t st_flags;             /* user defined flags for file */
   97         u_int32_t st_gen;               /* file generation number */
   98         int32_t   st_lspare;
   99         int64_t   st_qspare[2];
  100 };
  101 
  102 #ifndef _POSIX_SOURCE
  103 struct nstat {
  104         dev_t     st_dev;               /* inode's device */
  105         ino_t     st_ino;               /* inode's number */
  106         u_int32_t st_mode;              /* inode protection mode */
  107         u_int32_t st_nlink;             /* number of hard links */
  108         uid_t     st_uid;               /* user ID of the file's owner */
  109         gid_t     st_gid;               /* group ID of the file's group */
  110         dev_t     st_rdev;              /* device type */
  111 #ifndef _POSIX_SOURCE
  112         struct  timespec st_atimespec;  /* time of last access */
  113         struct  timespec st_mtimespec;  /* time of last data modification */
  114         struct  timespec st_ctimespec;  /* time of last file status change */
  115 #else
  116         time_t    st_atime;             /* time of last access */
  117         long      st_atimensec;         /* nsec of last access */
  118         time_t    st_mtime;             /* time of last data modification */
  119         long      st_mtimensec;         /* nsec of last data modification */
  120         time_t    st_ctime;             /* time of last file status change */
  121         long      st_ctimensec;         /* nsec of last file status change */
  122 #endif
  123         off_t     st_size;              /* file size, in bytes */
  124         int64_t   st_blocks;            /* blocks allocated for file */
  125         u_int32_t st_blksize;           /* optimal blocksize for I/O */
  126         u_int32_t st_flags;             /* user defined flags for file */
  127         u_int32_t st_gen;               /* file generation number */
  128         int64_t   st_qspare[2];
  129 };
  130 #endif
  131 
  132 #ifndef _POSIX_SOURCE
  133 #define st_atime st_atimespec.tv_sec
  134 #define st_mtime st_mtimespec.tv_sec
  135 #define st_ctime st_ctimespec.tv_sec
  136 #endif
  137 
  138 #define S_ISUID 0004000                 /* set user id on execution */
  139 #define S_ISGID 0002000                 /* set group id on execution */
  140 #ifndef _POSIX_SOURCE
  141 #define S_ISTXT 0001000                 /* sticky bit */
  142 #endif
  143 
  144 #define S_IRWXU 0000700                 /* RWX mask for owner */
  145 #define S_IRUSR 0000400                 /* R for owner */
  146 #define S_IWUSR 0000200                 /* W for owner */
  147 #define S_IXUSR 0000100                 /* X for owner */
  148 
  149 #ifndef _POSIX_SOURCE
  150 #define S_IREAD         S_IRUSR
  151 #define S_IWRITE        S_IWUSR
  152 #define S_IEXEC         S_IXUSR
  153 #endif
  154 
  155 #define S_IRWXG 0000070                 /* RWX mask for group */
  156 #define S_IRGRP 0000040                 /* R for group */
  157 #define S_IWGRP 0000020                 /* W for group */
  158 #define S_IXGRP 0000010                 /* X for group */
  159 
  160 #define S_IRWXO 0000007                 /* RWX mask for other */
  161 #define S_IROTH 0000004                 /* R for other */
  162 #define S_IWOTH 0000002                 /* W for other */
  163 #define S_IXOTH 0000001                 /* X for other */
  164 
  165 #ifndef _POSIX_SOURCE
  166 #define S_IFMT   0170000                /* type of file mask */
  167 #define S_IFIFO  0010000                /* named pipe (fifo) */
  168 #define S_IFCHR  0020000                /* character special */
  169 #define S_IFDIR  0040000                /* directory */
  170 #define S_IFBLK  0060000                /* block special */
  171 #define S_IFREG  0100000                /* regular */
  172 #define S_IFLNK  0120000                /* symbolic link */
  173 #define S_IFSOCK 0140000                /* socket */
  174 #define S_IFWHT  0160000                /* whiteout */
  175 #define S_ISVTX  0001000                /* save swapped text even after use */
  176 #endif
  177 
  178 #define S_ISDIR(m)      (((m) & 0170000) == 0040000)    /* directory */
  179 #define S_ISCHR(m)      (((m) & 0170000) == 0020000)    /* char special */
  180 #define S_ISBLK(m)      (((m) & 0170000) == 0060000)    /* block special */
  181 #define S_ISREG(m)      (((m) & 0170000) == 0100000)    /* regular file */
  182 #define S_ISFIFO(m)     (((m) & 0170000) == 0010000)    /* fifo or socket */
  183 #ifndef _POSIX_SOURCE
  184 #define S_ISLNK(m)      (((m) & 0170000) == 0120000)    /* symbolic link */
  185 #define S_ISSOCK(m)     (((m) & 0170000) == 0140000)    /* socket */
  186 #define S_ISWHT(m)      (((m) & 0170000) == 0160000)    /* whiteout */
  187 #endif
  188 
  189 #ifndef _POSIX_SOURCE
  190 #define ACCESSPERMS     (S_IRWXU|S_IRWXG|S_IRWXO)       /* 0777 */
  191                                                         /* 7777 */
  192 #define ALLPERMS        (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
  193                                                         /* 0666 */
  194 #define DEFFILEMODE     (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
  195 
  196 #define S_BLKSIZE       512             /* block size used in the stat struct */
  197 
  198 /*
  199  * Definitions of flags stored in file flags word.
  200  *
  201  * Super-user and owner changeable flags.
  202  */
  203 #define UF_SETTABLE     0x0000ffff      /* mask of owner changeable flags */
  204 #define UF_NODUMP       0x00000001      /* do not dump file */
  205 #define UF_IMMUTABLE    0x00000002      /* file may not be changed */
  206 #define UF_APPEND       0x00000004      /* writes to file may only append */
  207 #define UF_OPAQUE       0x00000008      /* directory is opaque wrt. union */
  208 #define UF_NOUNLINK     0x00000010      /* file may not be removed or renamed */
  209 /*
  210  * Super-user changeable flags.
  211  */
  212 #define SF_SETTABLE     0xffff0000      /* mask of superuser changeable flags */
  213 #define SF_ARCHIVED     0x00010000      /* file is archived */
  214 #define SF_IMMUTABLE    0x00020000      /* file may not be changed */
  215 #define SF_APPEND       0x00040000      /* writes to file may only append */
  216 #define SF_NOUNLINK     0x00100000      /* file may not be removed or renamed */
  217 
  218 #ifdef KERNEL
  219 /*
  220  * Shorthand abbreviations of above.
  221  */
  222 #define OPAQUE          (UF_OPAQUE)
  223 #define APPEND          (UF_APPEND | SF_APPEND)
  224 #define IMMUTABLE       (UF_IMMUTABLE | SF_IMMUTABLE)
  225 #define NOUNLINK        (UF_NOUNLINK | SF_NOUNLINK)
  226 #endif
  227 
  228 #endif /* !_POSIX_SOURCE */
  229 
  230 #ifndef KERNEL
  231 #include <sys/cdefs.h>
  232 
  233 __BEGIN_DECLS
  234 int     chmod __P((const char *, mode_t));
  235 int     fstat __P((int, struct stat *));
  236 int     mkdir __P((const char *, mode_t));
  237 int     mkfifo __P((const char *, mode_t));
  238 int     stat __P((const char *, struct stat *));
  239 mode_t  umask __P((mode_t));
  240 
  241 #ifndef _POSIX_SOURCE
  242 int     chflags __P((const char *, u_long));
  243 int     fchflags __P((int, u_long));
  244 int     fchmod __P((int, mode_t));
  245 int     lchmod __P((const char *, mode_t));
  246 int     lstat __P((const char *, struct stat *));
  247 #endif
  248 __END_DECLS
  249 
  250 #endif /* !KERNEL */
  251 
  252 #endif /* !_SYS_STAT_H_ */

Cache object: 2efc6d69fada584ce44b4e057f6d26b1


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.