home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / stat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  6.0 KB  |  163 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    stat.h,v $
  29.  * Revision 2.1  92/04/21  17:16:29  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*-
  36.  * Copyright (c) 1982, 1986, 1989 The Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * Redistribution and use in source and binary forms, with or without
  40.  * modification, are permitted provided that the following conditions
  41.  * are met:
  42.  * 1. Redistributions of source code must retain the above copyright
  43.  *    notice, this list of conditions and the following disclaimer.
  44.  * 2. Redistributions in binary form must reproduce the above copyright
  45.  *    notice, this list of conditions and the following disclaimer in the
  46.  *    documentation and/or other materials provided with the distribution.
  47.  * 3. All advertising materials mentioning features or use of this software
  48.  *    must display the following acknowledgement:
  49.  *    This product includes software developed by the University of
  50.  *    California, Berkeley and its contributors.
  51.  * 4. Neither the name of the University nor the names of its contributors
  52.  *    may be used to endorse or promote products derived from this software
  53.  *    without specific prior written permission.
  54.  *
  55.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  56.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  58.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  59.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  61.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  62.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  64.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  65.  * SUCH DAMAGE.
  66.  *
  67.  *    @(#)stat.h    7.11 (Berkeley) 3/3/91
  68.  */
  69.  
  70. struct stat
  71. {
  72.     dev_t    st_dev;            /* inode's device */
  73.     ino_t    st_ino;            /* inode's number */
  74.     mode_t    st_mode;        /* inode protection mode */
  75.     nlink_t    st_nlink;        /* number of hard links */
  76.     uid_t    st_uid;            /* user ID of the file's owner */
  77.     gid_t    st_gid;            /* group ID of the file's group */
  78.     dev_t    st_rdev;        /* device type */
  79.     off_t    st_size;        /* file size, in bytes */
  80.     time_t    st_atime;        /* time of last access */
  81.     long    st_spare1;
  82.     time_t    st_mtime;        /* time of last data modification */
  83.     long    st_spare2;
  84.     time_t    st_ctime;        /* time of last file status change */
  85.     long    st_spare3;
  86.     long    st_blksize;        /* optimal blocksize for I/O */
  87.     long    st_blocks;        /* blocks allocated for file */
  88.     u_long    st_flags;        /* user defined flags for file */
  89.     u_long    st_gen;            /* file generation number */
  90. };
  91.  
  92. #define    S_ISUID    0004000            /* set user id on execution */
  93. #define    S_ISGID    0002000            /* set group id on execution */
  94. #ifndef _POSIX_SOURCE
  95. #define    S_ISTXT    0001000            /* sticky bit */
  96. #endif
  97.  
  98. #define    S_IRWXU    0000700            /* RWX mask for owner */
  99. #define    S_IRUSR    0000400            /* R for owner */
  100. #define    S_IWUSR    0000200            /* W for owner */
  101. #define    S_IXUSR    0000100            /* X for owner */
  102.  
  103. #ifndef _POSIX_SOURCE
  104. #define    S_IREAD        S_IRUSR
  105. #define    S_IWRITE    S_IWUSR
  106. #define    S_IEXEC        S_IXUSR
  107. #endif
  108.  
  109. #define    S_IRWXG    0000070            /* RWX mask for group */
  110. #define    S_IRGRP    0000040            /* R for group */
  111. #define    S_IWGRP    0000020            /* W for group */
  112. #define    S_IXGRP    0000010            /* X for group */
  113.  
  114. #define    S_IRWXO    0000007            /* RWX mask for other */
  115. #define    S_IROTH    0000004            /* R for other */
  116. #define    S_IWOTH    0000002            /* W for other */
  117. #define    S_IXOTH    0000001            /* X for other */
  118.  
  119. #ifndef _POSIX_SOURCE
  120. #define    S_IFMT     0170000        /* type of file */
  121. #define    S_IFIFO     0010000        /* named pipe (fifo) */
  122. #define    S_IFCHR     0020000        /* character special */
  123. #define    S_IFDIR     0040000        /* directory */
  124. #define    S_IFBLK     0060000        /* block special */
  125. #define    S_IFREG     0100000        /* regular */
  126. #define    S_IFLNK     0120000        /* symbolic link */
  127. #define    S_IFSOCK 0140000        /* socket */
  128.  
  129. #define    S_ISVTX     0001000        /* save swapped text even after use */
  130.  
  131. #define S_BLKSIZE    512        /* block size used in the stat struct */
  132.  
  133.                     /* 0666 */
  134. #define    DEFFILEMODE    (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
  135. #endif
  136.  
  137. #define    S_ISDIR(m)    ((m & 0170000) == 0040000)    /* directory */
  138. #define    S_ISCHR(m)    ((m & 0170000) == 0020000)    /* char special */
  139. #define    S_ISBLK(m)    ((m & 0170000) == 0060000)    /* block special */
  140. #define    S_ISREG(m)    ((m & 0170000) == 0100000)    /* regular file */
  141. #define    S_ISFIFO(m)    ((m & 0170000) == 0010000)    /* fifo */
  142. #ifndef _POSIX_SOURCE
  143. #define    S_ISLNK(m)    ((m & 0170000) == 0120000)    /* symbolic link */
  144. #define    S_ISSOCK(m)    ((m & 0170000) == 0140000)    /* socket */
  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.