source: trunk/src/emx/include/sys/stat.h@ 2442

Last change on this file since 2442 was 2316, checked in by bird, 20 years ago

o Reworked the open backend, adding directory support. Some O_*

flags was changed in the process, breaking the old ABI.
This is not fully tested.

o Added more BSD fields to struct stat, breaking the old ABI.

The mtime field and ctime fields will now keep the same values
and the creation time is to be found in birthtime. This means that
ctime will be updated in a few places where it doesn't on unix - but
this is probably better than previously where it wasn't ever updated
when it should.

  • Property cvs2svn:cvs-rev set to 1.12
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 12.5 KB
RevLine 
[744]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 * 4. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)stat.h 8.12 (Berkeley) 6/16/95
[2060]35 * $FreeBSD: src/sys/sys/stat.h,v 1.40 2004/06/17 17:16:52 phk Exp $
[744]36 */
[18]37
[744]38/** @file
[2060]39 * FreeBSD 5.3
[744]40 * @changed bird: EMX isms and hid the BSD specific structs and related stuff.
[1969]41 * @changed bird: No UF_ and SF_ because we ain't got any st_flags.
[744]42 */
[18]43
[744]44#ifndef _SYS_STAT_H_
45#define _SYS_STAT_H_
46
47#include <sys/cdefs.h>
48#include <sys/_types.h>
49
50/* XXX missing blkcnt_t, blksize_t. */
51
52#ifndef _DEV_T_DECLARED
53typedef __dev_t dev_t;
54#define _DEV_T_DECLARED
[18]55#endif
56
[744]57#ifndef _FFLAGS_T_DECLARED
58typedef __fflags_t fflags_t;
59#define _FFLAGS_T_DECLARED
[18]60#endif
61
[792]62#if !defined(_GID_T_DECLARED) && !defined(_GID_T) /* bird: emx */
[744]63typedef __gid_t gid_t;
64#define _GID_T_DECLARED
[792]65#define _GID_T /* bird: emx */
[744]66#endif
67
68#if !defined(_INO_T_DECLARED) && !defined(_INO_T) /* bird: emx */
69typedef __ino_t ino_t;
70#define _INO_T_DECLARED
71#define _INO_T /* bird: emx */
72#endif
73
74#if !defined(_MODE_T_DECLARED) && !defined(_MODE_T) /* bird: emx */
75typedef __mode_t mode_t;
76#define _MODE_T_DECLARED
77#define _MODE_T /* bird: emx */
78#endif
79
80#ifndef _NLINK_T_DECLARED
81typedef __nlink_t nlink_t;
82#define _NLINK_T_DECLARED
83#endif
84
85#if !defined(_OFF_T_DECLARED) && !defined(_OFF_T) /* bird: emx */
86typedef __off_t off_t;
87#define _OFF_T_DECLARED
88#define _OFF_T /* bird: emx */
89#endif
90
91#if !defined(_TIME_T_DECLARED) && !defined(_TIME_T) /* bird: emx */
92typedef __time_t time_t;
93#define _TIME_T_DECLARED
94#define _TIME_T /* bird: emx */
95#endif
96
97#if !defined(_UID_T_DECLARED) && !defined(_UID_T) /* bird: emx */
98typedef __uid_t uid_t;
99#define _UID_T_DECLARED
100#define _UID_T /* bird: emx */
101#endif
102
103#if !defined(_KERNEL) && __BSD_VISIBLE
104/*
105 * XXX we need this for struct timespec. We get miscellaneous namespace
106 * pollution with it.
107 */
108#include <sys/time.h>
109#endif
110
111#if !__BSD_VISIBLE
112#include <sys/_timespec.h>
113#endif
114
115#if 0 /* bird: emx */
116#if __BSD_VISIBLE
117struct ostat {
118 __uint16_t st_dev; /* inode's device */
119 ino_t st_ino; /* inode's number */
120 mode_t st_mode; /* inode protection mode */
121 nlink_t st_nlink; /* number of hard links */
122 __uint16_t st_uid; /* user ID of the file's owner */
123 __uint16_t st_gid; /* group ID of the file's group */
124 __uint16_t st_rdev; /* device type */
125 __int32_t st_size; /* file size, in bytes */
126 struct timespec st_atimespec; /* time of last access */
127 struct timespec st_mtimespec; /* time of last data modification */
128 struct timespec st_ctimespec; /* time of last file status change */
129 __int32_t st_blksize; /* optimal blocksize for I/O */
130 __int32_t st_blocks; /* blocks allocated for file */
131 fflags_t st_flags; /* user defined flags for file */
132 __uint32_t st_gen; /* file generation number */
[18]133};
[744]134#endif /* __BSD_VISIBLE */
135#endif /* bird: emx */
136
137struct stat {
[2060]138 __dev_t st_dev; /* inode's device */
[2316]139#if 1 /* bird: emx: */
140 __uint32_t st_attr; /* emx: OS/2 & DOS attributes */
141#endif
[744]142 ino_t st_ino; /* inode's number */
143 mode_t st_mode; /* inode protection mode */
144 nlink_t st_nlink; /* number of hard links */
145 uid_t st_uid; /* user ID of the file's owner */
146 gid_t st_gid; /* group ID of the file's group */
[2060]147 __dev_t st_rdev; /* device type */
[2316]148#if 1 /* bird: emx - better alignment of 64-bit types */
149 __int32_t st_lspare;
150#endif /* bird */
[744]151#if __BSD_VISIBLE
152 struct timespec st_atimespec; /* time of last access */
153 struct timespec st_mtimespec; /* time of last data modification */
154 struct timespec st_ctimespec; /* time of last file status change */
155#else
156 time_t st_atime; /* time of last access */
157 long st_atimensec; /* nsec of last access */
158 time_t st_mtime; /* time of last data modification */
159 long st_mtimensec; /* nsec of last data modification */
160 time_t st_ctime; /* time of last file status change */
161 long st_ctimensec; /* nsec of last file status change */
[18]162#endif
[744]163 off_t st_size; /* file size, in bytes */
164 __int64_t st_blocks; /* blocks allocated for file */
165 __uint32_t st_blksize; /* optimal blocksize for I/O */
166 fflags_t st_flags; /* user defined flags for file */
167 __uint32_t st_gen; /* file generation number */
[2316]168#if 0 /* bird: !emx - it's higher up for packing reasons */
[744]169 __int32_t st_lspare;
[2316]170#endif /* bird */
[744]171#if __BSD_VISIBLE
172 struct timespec st_birthtimespec; /* time of file creation */
173 /*
174 * Explicitly pad st_birthtimespec to 16 bytes so that the size of
175 * struct stat is backwards compatible. We use bitfields instead
176 * of an array of chars so that this doesn't require a C99 compiler
177 * to compile if the size of the padding is 0. We use 2 bitfields
178 * to cover up to 64 bits on 32-bit machines. We assume that
179 * CHAR_BIT is 8...