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 * Never use the attributes cached in the inode record. Give the
124 * driver a chance to refresh them.
127 fil->f_ino->i_ops.inop_getattr(NULL, fil->f_ino, buf);
128 #if _LARGEFILE64_SOURCE
130 convstat(buf, __stat_buf);
133 SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
138 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(fxstat)),
139 PREPEND(_, SYSIO_INTERFACE_NAME(fxstat)))
144 PREPEND(__, SYSIO_INTERFACE_NAME(fstat))(int fd, struct stat *buf)
147 return PREPEND(__, SYSIO_INTERFACE_NAME(fxstat))(_STAT_VER,
152 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(fstat)),
153 SYSIO_INTERFACE_NAME(fstat))
157 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(fstat)),
158 PREPEND(_, SYSIO_INTERFACE_NAME(fstat)))
163 PREPEND(__, SYSIO_INTERFACE_NAME(xstat))(int __ver,
164 const char *__filename,
165 struct stat *__stat_buf)
167 struct intent intent;
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);
184 * Leverage the INT_GETATTR intent above. We are counting
185 * on the FS driver to either make sure the attributes cached in
186 * the inode are always correct or refresh them in the lookup, above.
188 ino = pno->p_base->pb_ino;
189 #if _LARGEFILE64_SOURCE
190 convstat(&ino->i_stbuf, __stat_buf);
192 (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat));
196 SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
201 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(xstat)),
202 PREPEND(_, SYSIO_INTERFACE_NAME(xstat)))
207 PREPEND(__, SYSIO_INTERFACE_NAME(stat))(const char *filename,
211 return PREPEND(__, SYSIO_INTERFACE_NAME(xstat))(_STAT_VER,
216 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(stat)),
217 SYSIO_INTERFACE_NAME(stat))
221 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(stat)),
222 PREPEND(_, SYSIO_INTERFACE_NAME(stat)))
227 PREPEND(__, SYSIO_INTERFACE_NAME(lxstat))(int __ver,
228 const char *__filename,
229 struct stat *__stat_buf)
231 struct intent intent;
235 SYSIO_INTERFACE_DISPLAY_BLOCK;
237 SYSIO_INTERFACE_ENTER;
238 if (__ver != _STAT_VER) {
243 INTENT_INIT(&intent, INT_GETATTR, NULL, NULL);
244 err = _sysio_namei(_sysio_cwd, __filename, ND_NOFOLLOW, &intent, &pno);
248 * Leverage the INT_GETATTR intent above. We are counting
249 * on the FS driver to either make sure the attributes cached in
250 * the inode are always correct or refresh them in the lookup, above.
252 ino = pno->p_base->pb_ino;
253 #if _LARGEFILE64_SOURCE
254 convstat(&ino->i_stbuf, __stat_buf);
256 (void )memcpy(__stat_buf, &ino->i_stbuf, sizeof(struct intnl_stat));
260 SYSIO_INTERFACE_RETURN(err ? -1 : 0, err);
265 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(lxstat)),
266 PREPEND(_, SYSIO_INTERFACE_NAME(lxstat)))
271 PREPEND(__, SYSIO_INTERFACE_NAME(lstat))(const char *filename, struct stat *buf)
273 return PREPEND(__, SYSIO_INTERFACE_NAME(lxstat))(_STAT_VER,
278 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(lstat)),
279 SYSIO_INTERFACE_NAME(lstat))
283 sysio_sym_weak_alias(PREPEND(__, SYSIO_INTERFACE_NAME(lstat)),
284 PREPEND(_, SYSIO_INTERFACE_NAME(lstat)))