xref: /titanic_44/usr/src/uts/intel/sys/stat_impl.h (revision 62a24de03df1f2399ceda704cb3874dabc98bbbd)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_STAT_IMPL_H
28 #define	_SYS_STAT_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/feature_tests.h>
33 #include <sys/types.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #if !defined(_KERNEL)
40 
41 #if defined(__i386)
42 /*
43  * The implementation specific header for <sys/stat.h>
44  * When compiling outside of the large file environment, the *stat source
45  * symbols must lead to calls to corresponding _x*stat functions that supply
46  * an initial version number argument identifying which binary stat structure
47  * representation to use.  In the large file compilation environment, the
48  * intermediate _x*stat functions and version numbers are unnecessary.
49  * Instead, the source symbols map onto invocations of corresponding *stat64
50  * functions with identical arguments.
51  */
52 
53 #if defined(__STDC__)
54 
55 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
56 	defined(_ATFILE_SOURCE)
57 extern int fstatat(int, const char *, struct stat *, int);
58 #endif /* defined (_ATFILE_SOURCE) */
59 
60 #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint)
61 static int fstat(int, struct stat *);
62 static int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
63 int _fxstat(const int, int, struct stat *);
64 int _xstat(const int, const char *, struct stat *);
65 #else
66 extern int fstat(int, struct stat *);
67 extern int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
68 #endif
69 
70 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
71 #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint)
72 static int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
73 #else
74 extern int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
75 #endif
76 #if !defined(_LP64) && !defined(__lint)
77 static int mknod(const char *, mode_t, dev_t);
78 #else
79 extern int mknod(const char *, mode_t, dev_t);
80 #endif
81 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
82 
83 #if !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
84 	defined(__EXTENSIONS__))
85 #if _FILE_OFFSET_BITS == 32
86 int _lxstat(const int, const char *, struct stat *);
87 #endif
88 int _xmknod(const int, const char *, mode_t, dev_t);
89 #endif /* !defined(_LP64) && (!defined(__XOPEN_OR_POSIX)... */
90 
91 
92 #else	/* !__STDC__ */
93 
94 extern int fstatat();
95 
96 
97 #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint)
98 static int fstat(), stat();
99 int _fxstat(), _xstat();
100 #else
101 extern int fstat(), stat();
102 #endif
103 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
104 #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint)
105 static int lstat();
106 #else
107 extern int lstat();
108 #endif
109 #if !defined(_LP64) && !defined(__lint)
110 static int mknod();
111 #else
112 extern int mknod();
113 #endif
114 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */
115 
116 #if !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
117 	defined(__EXTENSIONS__))
118 #if _FILE_OFFSET_BITS == 32
119 int _lxstat();
120 #endif
121 int _xmknod();
122 #endif /* !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) ... */
123 
124 #endif /* defined(__STDC__) */
125 
126 /*
127  * NOTE: Application software should NOT program
128  * to the _xstat interface.
129  */
130 
131 #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint)
132 
133 static int
134 #ifdef __STDC__
135 stat(const char *_RESTRICT_KYWD _path, struct stat *_RESTRICT_KYWD _buf)
136 #else
137 stat(_path, _buf)
138 char *_path;
139 struct stat *_buf;
140 #endif
141 {
142 	return (_xstat(_STAT_VER, _path, _buf));
143 }
144 
145 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
146 static int
147 #ifdef __STDC__
148 lstat(const char *_RESTRICT_KYWD _path, struct stat *_RESTRICT_KYWD _buf)
149 #else
150 lstat(_path, _buf)
151 char *_path;
152 struct stat *_buf;
153 #endif
154 {
155 	return (_lxstat(_STAT_VER, _path, _buf));
156 }
157 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
158 
159 static int
160 #ifdef __STDC__
161 fstat(int _fd, struct stat *_buf)
162 #else
163 fstat(_fd, _buf)
164 int _fd;
165 struct stat *_buf;
166 #endif
167 {
168 	return (_fxstat(_STAT_VER, _fd, _buf));
169 }
170 
171 #endif	/* _FILE_OFFSET_BITS == 32 && !defined(_LP64) ... */
172 
173 #if !defined(_LP64) && !defined(__lint) && (!defined(__XOPEN_OR_POSIX) || \
174 	defined(_XPG4_2) || defined(__EXTENSIONS__))
175 static int
176 #ifdef __STDC__
177 mknod(const char *_path, mode_t _mode, dev_t _dev)
178 #else
179 mknod(_path, _mode, _dev)
180 char *_path;
181 mode_t _mode;
182 dev_t _dev;
183 #endif
184 {
185 	return (_xmknod(_MKNOD_VER, _path, _mode, _dev));
186 }
187 #endif /* !defined(_LP64) && !defined(__lint) && ... */
188 
189 #else	/* !__i386 */
190 
191 #if defined(__STDC__)
192 
193 extern int fstat(int, struct stat *);
194 extern int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
195 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
196 	defined(_ATFILE_SOURCE)
197 extern int fstatat(int, const char *, struct stat *, int);
198 #endif /* defined (_ATFILE_SOURCE) */
199 
200 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
201 extern int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
202 extern int mknod(const char *, mode_t, dev_t);
203 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */
204 
205 #else	/* !__STDC__ */
206 
207 extern int fstat(), stat(), fstatat();
208 
209 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
210 extern int lstat(), mknod();
211 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
212 
213 #endif	/* !__STDC__ */
214 
215 #endif	/* !__i386 */
216 
217 #endif /* !defined(_KERNEL) */
218 
219 #ifdef	__cplusplus
220 }
221 #endif
222 
223 #endif	/* _SYS_STAT_IMPL_H */
224