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-2004 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
45 * Native file system support.
51 * stat struct from asm/stat.h, as returned
52 * by alpha linux kernel
54 struct _sysio_native_stat {
58 unsigned int st_nlink;
63 unsigned long st_atime;
64 unsigned long st_mtime;
65 unsigned long st_ctime;
66 unsigned int st_blksize;
68 unsigned int st_flags;
72 #define SYSIO_COPY_STAT(src, dest) \
74 memset((dest), 0, sizeof((*dest))); \
75 (dest)->st_dev = (src)->st_dev; \
76 (dest)->st_ino = (src)->st_ino; \
77 (dest)->st_mode = (src)->st_mode; \
78 (dest)->st_nlink = (src)->st_nlink; \
79 (dest)->st_uid = (src)->st_uid; \
80 (dest)->st_gid = (src)->st_gid; \
81 (dest)->st_rdev = (src)->st_rdev; \
82 (dest)->st_size = (src)->st_size; \
83 (dest)->st_atime = (src)->st_atime; \
84 (dest)->st_mtime = (src)->st_mtime; \
85 (dest)->st_ctime = (src)->st_ctime; \
86 (dest)->st_blksize = (src)->st_blksize; \
87 (dest)->st_blocks = (src)->st_blocks; \
88 (dest)->st_flags = (src)->st_flags; \
89 (dest)->st_gen = (src)->st_gen; \
93 #define _sysio_native_stat intnl_stat
94 #define SYSIO_COPY_STAT(src, dest) *(dest) = *(src)
100 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_lstat64)
101 #define SYSIO_SYS_stat SYS_lstat64
102 #elif defined(SYS_lstat)
103 #define SYSIO_SYS_stat SYS_lstat
105 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_fstat64)
106 #define SYSIO_SYS_fstat SYS_fstat64
107 #elif defined(SYS_fstat)
108 #define SYSIO_SYS_fstat SYS_fstat
110 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_truncate64)
111 #define SYSIO_SYS_truncate SYS_truncate64
112 #elif defined(SYS_truncate)
113 #define SYSIO_SYS_truncate SYS_truncate
115 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_ftruncate64)
116 #define SYSIO_SYS_ftruncate SYS_ftruncate64
117 #elif defined(SYS_ftruncate)
118 #define SYSIO_SYS_ftruncate SYS_ftruncate
120 #if defined(SYS_open)
121 #define SYSIO_SYS_open SYS_open
123 #if defined(SYS_close)
124 #define SYSIO_SYS_close SYS_close
126 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_lseek64)
127 #define SYSIO_SYS_lseek SYS_lseek64
128 #elif defined(SYS_lseek)
129 #define SYSIO_SYS_lseek SYS_lseek
131 #if defined(SYS__llseek)
132 # if defined (__mips64__)
133 # define SYSIO_SYS__llseek SYS_O32__llseek
135 # define SYSIO_SYS__llseek SYS__llseek
138 #if defined(SYS_read)
139 #define SYSIO_SYS_read SYS_read
141 #if defined(SYS_write)
142 #define SYSIO_SYS_write SYS_write
144 #if defined(SYS_readv)
145 #define SYSIO_SYS_readv SYS_readv
147 #if defined(SYS_writev)
148 #define SYSIO_SYS_writev SYS_writev
150 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_pread64)
151 #define SYSIO_SYS_pread SYS_pread64
152 #elif defined(SYS_pread)
153 #define SYSIO_SYS_pread SYS_pread
155 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_pwrite64)
156 #define SYSIO_SYS_pwrite SYS_pwrite64
157 #elif defined(SYS_pwrite)
158 #define SYSIO_SYS_pwrite SYS_pwrite
160 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_fcntl64)
161 #define SYSIO_SYS_fcntl SYS_fcntl64
162 #elif defined(SYS_fcntl)
163 #define SYSIO_SYS_fcntl SYS_fcntl
165 #if defined(SYS_fsync)
166 #define SYSIO_SYS_fsync SYS_fsync
168 #if defined(ALPHA_LINUX) && defined(SYS_osf_fdatasync)
169 #define SYSIO_SYS_fdatasync SYS_osf_fdatasync
170 #elif defined(SYS_fdatasync)
171 #define SYSIO_SYS_fdatasync SYS_fdatasync
173 #if defined(SYS_chmod)
174 #define SYSIO_SYS_chmod SYS_chmod
176 #if defined(SYS_fchmod)
177 #define SYSIO_SYS_fchmod SYS_fchmod
179 #if defined(SYS_chown)
180 #define SYSIO_SYS_chown SYS_chown
182 #if defined(SYS_fchown)
183 #define SYSIO_SYS_fchown SYS_fchown
185 #if defined(SYS_umask)
186 #define SYSIO_SYS_umask SYS_umask
188 #if defined(SYS_mkdir)
189 #define SYSIO_SYS_mkdir SYS_mkdir
191 #if defined(SYS_rmdir)
192 #define SYSIO_SYS_rmdir SYS_rmdir
194 #if defined(SYS_getdirentries)
195 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_getdirentries64)
196 #define SYSIO_SYS_getdirentries SYS_getdirentries64
197 #elif defined(SYS_getdirentries)
198 #define SYSIO_SYS_getdirentries SYS_getdirentries
201 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_getdents64)
202 # define SYSIO_SYS_getdents64 SYS_getdents64
203 #elif defined(SYS_getdents)
204 # if defined (__mips64__)
205 # define SYSIO_SYS_getdents64 SYS_getdents
207 # define SYSIO_SYS_getdents SYS_getdents
210 #if defined(SYS_link)
211 #define SYSIO_SYS_link SYS_link
213 #if defined(SYS_unlink)
214 #define SYSIO_SYS_unlink SYS_unlink
216 #if defined(SYS_symlink)
217 #define SYSIO_SYS_symlink SYS_symlink
219 #if defined(SYS_rename)
220 #define SYSIO_SYS_rename SYS_rename
222 #if defined(SYS_readlink)
223 #define SYSIO_SYS_readlink SYS_readlink
225 #if defined(SYS_utimes)
226 #define SYSIO_SYS_utimes SYS_utimes
228 #if defined(SYS_utime)
229 #define SYSIO_SYS_utime SYS_utime
231 #if defined(SYS_socketcall)
232 # if defined (__mips64__)
233 # define SYSIO_SYS_socketcall SYS_O32_socketcall
235 # define SYSIO_SYS_socketcall SYS_socketcall
238 #if defined(SYS_socket)
239 #define SYSIO_SYS_socket SYS_socket
241 #if defined(SYS_accept)
242 #define SYSIO_SYS_accept SYS_accept
244 #if defined(SYS_bind)
245 #define SYSIO_SYS_bind SYS_bind
247 #if defined(SYS_listen)
248 #define SYSIO_SYS_listen SYS_listen
250 #if defined(SYS_connect)
251 #define SYSIO_SYS_connect SYS_connect
253 #if defined(SYS_ioctl)
254 #define SYSIO_SYS_ioctl SYS_ioctl