2 * This Cplant(TM) source code is the property of Sandia National
5 * This Cplant(TM) source code is copyrighted by Sandia National
8 * The redistribution of this Cplant(TM) source code is subject to the
9 * terms of the GNU Lesser General Public License
10 * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html)
12 * Cplant(TM) Copyright 1998-2003 Sandia Corporation.
13 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
14 * license for use of this work by or on behalf of the US Government.
15 * Export of this program may require a license from the United States
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
25 * This library is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 * Questions or comments about this library should be sent to:
37 * Sandia National Laboratories, New Mexico
39 * Albuquerque, NM 87185-1110
46 #include <sys/types.h>
49 #include <sys/queue.h>
55 #include "sysio-symbols.h"
67 #if !defined(_STAT_VER)
71 #if _LARGEFILE64_SOURCE
73 convstat(struct stat64 *st64_buf, struct stat *st_buf)
76 st_buf->st_dev = st64_buf->st_dev;
77 st_buf->st_ino = st64_buf->st_ino;
78 st_buf->st_mode = st64_buf->st_mode;
79 st_buf->st_nlink = st64_buf->st_nlink;
80 st_buf->st_uid = st64_buf->st_uid;
81 st_buf->st_gid = st64_buf->st_gid;
82 st_buf->st_rdev = st64_buf->st_rdev;
83 st_buf->st_size = st64_buf->st_size;
84 st_buf->st_blksize = st64_buf->st_blksize;
85 st_buf->st_blocks = st64_buf->st_blocks;
86 st_buf->st_atime = st64_buf->st_atime;
87 st_buf->st_mtime = st64_buf->st_mtime;
88 st_buf->st_ctime = st64_buf->st_ctime;
93 PREPEND(__, SYSIO_INTERFACE_NAME(fxstat))(int __ver,
95 struct stat *__stat_buf)
99 struct intnl_stat *buf;
100 #if _LARGEFILE64_SOURCE
103 SYSIO_INTERFACE_DISPLAY_BLOCK;
105 SYSIO_INTERFACE_ENTER;
106 if (__ver != _STAT_VER) {
112 fil = _sysio_fd_find(__fildes);
117 #if _LARGEFILE64_SOURCE
123 fil->f_ino->i_ops.inop_getattr(NULL, fil->f_ino, buf);
124 #if _LARGEFILE64_SOURCE
126 convstat(buf, __stat_buf);
129 SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
134 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(fxstat)),
135 PREPEND(_, SYSIO_INTERFACE_NAME(fxstat)))
140 PREPEND(__, SYSIO_INTERFACE_NAME(fstat))(int fd, struct stat *buf)
143 return PREPEND(__, SYSIO_INTERFACE_NAME(fxstat))(_STAT_VER,
148 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(fstat)),
149 SYSIO_INTERFACE_NAME(fstat))
153 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(fstat)),
154 PREPEND(_, SYSIO_INTERFACE_NAME(fstat)))
159 PREPEND(__, SYSIO_INTERFACE_NAME(xstat))(int __ver,
160 const char *__filename,
161 struct stat *__stat_buf)
163 struct intent intent;
167 struct intnl_stat *buf;
168 #if _LARGEFILE64_SOURCE
171 SYSIO_INTERFACE_DISPLAY_BLOCK;
173 SYSIO_INTERFACE_ENTER;
174 if (__ver != _STAT_VER) {
179 INTENT_INIT(&intent, INT_GETATTR, NULL, NULL);
180 err = _sysio_namei(_sysio_cwd, __filename, 0, &intent, &pno);
183 ino = pno->p_base->pb_ino;
184 #if _LARGEFILE64_SOURCE
190 ino->i_ops.inop_getattr(pno,
195 #if _LARGEFILE64_SOURCE
197 convstat(buf, __stat_buf);
200 SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
205 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(xstat)),
206 PREPEND(_, SYSIO_INTERFACE_NAME(xstat)))
211 PREPEND(__, SYSIO_INTERFACE_NAME(stat))(const char *filename,
215 return PREPEND(__, SYSIO_INTERFACE_NAME(xstat))(_STAT_VER,
220 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(stat)),
221 SYSIO_INTERFACE_NAME(stat))
225 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(stat)),
226 PREPEND(_, SYSIO_INTERFACE_NAME(stat)))
231 PREPEND(__, SYSIO_INTERFACE_NAME(lxstat))(int __ver,
232 const char *__filename,
233 struct stat *__stat_buf)
235 struct intent intent;
239 struct intnl_stat *buf;
240 #if _LARGEFILE64_SOURCE
243 SYSIO_INTERFACE_DISPLAY_BLOCK;
245 SYSIO_INTERFACE_ENTER;
246 if (__ver != _STAT_VER) {
251 INTENT_INIT(&intent, INT_GETATTR, NULL, NULL);
252 err = _sysio_namei(_sysio_cwd, __filename, ND_NOFOLLOW, &intent, &pno);
255 #if _LARGEFILE64_SOURCE
260 ino = pno->p_base->pb_ino;
262 ino->i_ops.inop_getattr(pno,
267 #if _LARGEFILE64_SOURCE
269 convstat(buf, __stat_buf);
272 SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
277 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(lxstat)),
278 PREPEND(_, SYSIO_INTERFACE_NAME(lxstat)))
283 PREPEND(__, SYSIO_INTERFACE_NAME(lstat))(const char *filename, struct stat *buf)
285 return PREPEND(__, SYSIO_INTERFACE_NAME(lxstat))(_STAT_VER,
290 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(lstat)),
291 SYSIO_INTERFACE_NAME(lstat))
295 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(lstat)),
296 PREPEND(_, SYSIO_INTERFACE_NAME(lstat)))