home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / gnu / ixemul-39.47-env-bin.lha / include / sys / stat.h < prev    next >
C/C++ Source or Header  |  1993-09-05  |  6KB  |  165 lines

  1. /*-
  2.  * Copyright (c) 1982, 1986, 1989 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)stat.h    7.11 (Berkeley) 3/3/91
  34.  */
  35.  
  36. #ifndef _SYS_STAT_H
  37. #define _SYS_STAT_H
  38.  
  39. #if later
  40. struct stat
  41. {
  42.     dev_t    st_dev;            /* inode's device */
  43.     ino_t    st_ino;            /* inode's number */
  44.     mode_t    st_mode;        /* inode protection mode */
  45.     nlink_t    st_nlink;        /* number of hard links */
  46.     uid_t    st_uid;            /* user ID of the file's owner */
  47.     gid_t    st_gid;            /* group ID of the file's group */
  48.     dev_t    st_rdev;        /* device type */
  49.     off_t    st_size;        /* file size, in bytes */
  50.     time_t    st_atime;        /* time of last access */
  51.     long    st_spare1;
  52.     time_t    st_mtime;        /* time of last data modification */
  53.     long    st_spare2;
  54.     time_t    st_ctime;        /* time of last file status change */
  55.     long    st_spare3;
  56.     long    st_blksize;        /* optimal blocksize for I/O */
  57.     long    st_blocks;        /* blocks allocated for file */
  58.     u_long    st_flags;        /* user defined flags for file */
  59.     u_long    st_gen;            /* file generation number */
  60. };
  61. #else
  62. struct    stat
  63. {
  64.     dev_t    st_dev;
  65.     ino_t    st_ino;
  66.     unsigned short st_mode;
  67.     short    st_nlink;
  68.     short    st_uid;
  69.     short    st_gid;
  70.     dev_t    st_rdev;
  71.     off_t    st_size;
  72.     time_t    st_atime;
  73.     int    st_spare1;
  74.     time_t    st_mtime;
  75.     int    st_spare2;
  76.     time_t    st_ctime;
  77.     int    st_spare3;
  78.     long    st_blksize;
  79.     long    st_blocks;
  80.     long    st_spare4[2];
  81. };
  82. #endif
  83.  
  84. #ifdef amigados
  85. #define st_handler st_spare3
  86. #define st_amode   st_spare2
  87. #endif
  88.  
  89. #define    S_ISUID    0004000            /* set user id on execution */
  90. #define    S_ISGID    0002000            /* set group id on execution */
  91. #ifndef _POSIX_SOURCE
  92. #define    S_ISTXT    0001000            /* sticky bit */
  93. #endif
  94.  
  95. #define    S_IRWXU    0000700            /* RWX mask for owner */
  96. #define    S_IRUSR    0000400            /* R for owner */
  97. #define    S_IWUSR    0000200            /* W for owner */
  98. #define    S_IXUSR    0000100            /* X for owner */
  99.  
  100. #ifndef _POSIX_SOURCE
  101. #define    S_IREAD        S_IRUSR
  102. #define    S_IWRITE    S_IWUSR
  103. #define    S_IEXEC        S_IXUSR
  104. #endif
  105.  
  106. #define    S_IRWXG    0000070            /* RWX mask for group */
  107. #define    S_IRGRP    0000040            /* R for group */
  108. #define    S_IWGRP    0000020            /* W for group */
  109. #define    S_IXGRP    0000010            /* X for group */
  110.  
  111. #define    S_IRWXO    0000007            /* RWX mask for other */
  112. #define    S_IROTH    0000004            /* R for other */
  113. #define    S_IWOTH    0000002            /* W for other */
  114. #define    S_IXOTH    0000001            /* X for other */
  115.  
  116. #ifndef _POSIX_SOURCE
  117. #define    S_IFMT     0170000        /* type of file */
  118. #define    S_IFCHR     0020000        /* character special */
  119. #define    S_IFDIR     0040000        /* directory */
  120. #define    S_IFBLK     0060000        /* block special */
  121. #define    S_IFREG     0100000        /* regular */
  122. #define    S_IFLNK     0120000        /* symbolic link */
  123. #ifdef not_yet_implemented
  124. #define    S_IFSOCK 0140000        /* socket */
  125. #define    S_IFIFO     0010000        /* named pipe (fifo) */
  126. #endif
  127. #define    S_ISVTX     0001000        /* save swapped text even after use */
  128.  
  129. #define S_BLKSIZE    512        /* block size used in the stat struct */
  130.  
  131.                     /* 0666 */
  132. #define    DEFFILEMODE    (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
  133. #endif
  134.  
  135. #define    S_ISDIR(m)    ((m & 0170000) == 0040000)    /* directory */
  136. #define    S_ISCHR(m)    ((m & 0170000) == 0020000)    /* char special */
  137. #define    S_ISBLK(m)    ((m & 0170000) == 0060000)    /* block special */
  138. #define    S_ISREG(m)    ((m & 0170000) == 0100000)    /* regular file */
  139. #define    S_ISLNK(m)    ((m & 0170000) == 0120000)    /* symbolic link */
  140. #if notyet
  141. #define    S_ISFIFO(m)    ((m & 0170000) == 0010000)    /* fifo */
  142. #ifndef _POSIX_SOURCE
  143. #define    S_ISSOCK(m)    ((m & 0170000) == 0140000)    /* socket */
  144. #endif
  145. #endif
  146.  
  147. #ifndef KERNEL
  148. #include <sys/cdefs.h>
  149.  
  150. __BEGIN_DECLS
  151. mode_t    umask __P((mode_t));
  152. int    chmod __P((const char *, mode_t));
  153. int    fstat __P((int, struct stat *));
  154. int    mkdir __P((const char *, mode_t));
  155. int    mkfifo __P((const char *, mode_t));
  156. int    stat __P((const char *, struct stat *));
  157. #ifndef _POSIX_SOURCE
  158. int    fchmod __P((int, mode_t));
  159. int    lstat __P((const char *, struct stat *));
  160. #endif /* not POSIX */
  161. __END_DECLS
  162. #endif
  163.  
  164. #endif /* _SYS_STAT_H */
  165.