- keep IRIX cc -64 happy
[Samba/gbeck.git] / source / smbwrapper / realcalls.h
blob338e1950874d165fcc6bff0b2e05526d6dc0e7f7
1 /*
2 Unix SMB/Netbios implementation.
3 Version 2.0
4 defintions of syscall entries
5 Copyright (C) Andrew Tridgell 1998
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifdef IRIX
23 /* amazingly, IRIX gets its own syscall numbers wrong! */
24 #ifdef SYSVoffset
25 #if (SYSVoffset == 1)
26 #undef SYSVoffset
27 #define SYSVoffset 1000
28 #endif
29 #endif
30 #endif
32 /* this file is partly derived from zlibc by Alain Knaff */
34 #define real_access(fn, mode) (syscall(SYS_access, (fn), (mode)))
35 #define real_chdir(fn) (syscall(SYS_chdir, (fn)))
36 #define real_chmod(fn, mode) (syscall(SYS_chmod,(fn), (mode)))
37 #define real_chown(fn, owner, group) (syscall(SYS_chown,(fn),(owner),(group)))
39 #define real_getdents(fd, dirp, count) (syscall(SYS_getdents, (fd), (dirp), (count)))
40 #define real_link(fn1, fn2) (syscall(SYS_link, (fn1), (fn2)))
42 #define real_open(fn,flags,mode) (syscall(SYS_open, (fn), (flags), (mode)))
44 #ifdef SYS_open64
45 #define real_open64(fn,flags,mode) (syscall(SYS_open64, (fn), (flags), (mode)))
46 #elif HAVE__OPEN64
47 #define real_open64(fn,flags,mode) (_open64(fn,flags,mode))
48 #define NO_OPEN64_ALIAS
49 #elif HAVE___OPEN64
50 #define real_open64(fn,flags,mode) (__open64(fn,flags,mode))
51 #define NO_OPEN64_ALIAS
52 #endif
54 #ifdef HAVE__OPENDIR
55 #define real_opendir(fn) ((DIR *)_opendir(fn))
56 #elif SYS_opendir
57 #define real_opendir(fn) ((DIR *)syscall(SYS_opendir,(fn)))
58 #elif HAVE___OPENDIR
59 #define real_opendir(fn) ((DIR *)__opendir(fn))
60 #endif
62 #ifdef HAVE__READDIR
63 #define real_readdir(d) ((struct dirent *)_readdir(d))
64 #elif HAVE___READDIR
65 #define real_readdir(d) ((struct dirent *)__readdir(d))
66 #elif SYS_readdir
67 #define real_readdir(d) ((struct dirent *)syscall(SYS_readdir,(d)))
68 #endif
70 #ifdef HAVE__CLOSEDIR
71 #define real_closedir(d) (_closedir(d))
72 #elif SYS_closedir
73 #define real_closedir(d) (syscall(SYS_closedir,(d)))
74 #elif HAVE___CLOSEDIR
75 #define real_closedir(d) (__closedir(d))
76 #endif
78 #ifdef HAVE__SEEKDIR
79 #define real_seekdir(d,l) (_seekdir(d,l))
80 #elif SYS_seekdir
81 #define real_seekdir(d,l) (syscall(SYS_seekdir,(d),(l)))
82 #elif HAVE___SEEKDIR
83 #define real_seekdir(d) (__seekdir(d,l))
84 #else
85 #define NO_SEEKDIR_WRAPPER
86 #endif
88 #ifdef HAVE__TELLDIR
89 #define real_telldir(d) (_telldir(d))
90 #elif SYS_telldir
91 #define real_telldir(d) (syscall(SYS_telldir,(d)))
92 #elif HAVE___TELLDIR
93 #define real_telldir(d) (__telldir(d))
94 #endif
96 #ifdef HAVE__DUP
97 #define real_dup(d) (_dup(d))
98 #elif SYS_dup
99 #define real_dup(d) (syscall(SYS_dup,(d)))
100 #elif HAVE___DUP
101 #define real_dup(d) (__dup(d))
102 #endif
104 #ifdef HAVE__DUP2
105 #define real_dup2(d1,d2) (_dup2(d1,d2))
106 #elif SYS_dup2
107 #define real_dup2(d1,d2) (syscall(SYS_dup2,(d1),(d2)))
108 #elif HAVE___DUP2
109 #define real_dup2(d1,d2) (__dup2(d1,d2))
110 #endif
112 #ifdef HAVE__GETCWD
113 #define real_getcwd(b,s) ((char *)_getcwd(b,s))
114 #elif SYS_getcwd
115 #define real_getcwd(b,s) ((char *)syscall(SYS_getcwd,(b),(s)))
116 #elif HAVE___GETCWD
117 #define real_getcwd(b,s) ((char *)__getcwd(b,s))
118 #endif
120 #ifdef HAVE__STAT
121 #define real_stat(fn,st) (_stat(fn,st))
122 #elif SYS_stat
123 #define real_stat(fn,st) (syscall(SYS_stat,(fn),(st)))
124 #elif HAVE___STAT
125 #define real_stat(fn,st) (__stat(fn,st))
126 #endif
128 #ifdef HAVE__LSTAT
129 #define real_lstat(fn,st) (_lstat(fn,st))
130 #elif SYS_lstat
131 #define real_lstat(fn,st) (syscall(SYS_lstat,(fn),(st)))
132 #elif HAVE___LSTAT
133 #define real_lstat(fn,st) (__lstat(fn,st))
134 #endif
136 #ifdef HAVE__FSTAT
137 #define real_fstat(fd,st) (_fstat(fd,st))
138 #elif SYS_fstat
139 #define real_fstat(fd,st) (syscall(SYS_fstat,(fd),(st)))
140 #elif HAVE___FSTAT
141 #define real_fstat(fd,st) (__fstat(fd,st))
142 #endif
144 #ifdef HAVE__ACL
145 #define real_acl(fn,cmd,n,buf) (_acl(fn,cmd,n,buf))
146 #elif SYS_acl
147 #define real_acl(fn,cmd,n,buf) (syscall(SYS_acl,(fn),(cmd),(n),(buf)))
148 #elif HAVE___ACL
149 #define real_acl(fn,cmd,n,buf) (__acl(fn,cmd,n,buf))
150 #else
151 #define NO_ACL_WRAPPER
152 #endif
154 #ifdef HAVE__FACL
155 #define real_facl(fd,cmd,n,buf) (_facl(fd,cmd,n,buf))
156 #elif SYS_facl
157 #define real_facl(fd,cmd,n,buf) (syscall(SYS_facl,(fd),(cmd),(n),(buf)))
158 #elif HAVE___FACL
159 #define real_facl(fd,cmd,n,buf) (__facl(fd,cmd,n,buf))
160 #else
161 #define NO_FACL_WRAPPER
162 #endif
165 #ifdef HAVE__STAT64
166 #define real_stat64(fn,st) (_stat64(fn,st))
167 #elif HAVE___STAT64
168 #define real_stat64(fn,st) (__stat64(fn,st))
169 #endif
171 #ifdef HAVE__LSTAT64
172 #define real_lstat64(fn,st) (_lstat64(fn,st))
173 #elif HAVE___LSTAT64
174 #define real_lstat64(fn,st) (__lstat64(fn,st))
175 #endif
177 #ifdef HAVE__FSTAT64
178 #define real_fstat64(fd,st) (_fstat64(fd,st))
179 #elif HAVE___FSTAT64
180 #define real_fstat64(fd,st) (__fstat64(fd,st))
181 #endif
183 #ifdef HAVE__READDIR64
184 #define real_readdir64(d) ((struct dirent64 *)_readdir64(d))
185 #elif HAVE___READDIR64
186 #define real_readdir64(d) ((struct dirent64 *)__readdir64(d))
187 #endif
189 #ifdef HAVE__LLSEEK
190 #define real_llseek(fd,ofs,whence) (_llseek(fd,ofs,whence))
191 #elif HAVE___LLSEEK
192 #define real_llseek(fd,ofs,whence) (__llseek(fd,ofs,whence))
193 #endif
196 #ifdef HAVE__PREAD
197 #define real_pread(fd,buf,size,ofs) (_pread(fd,buf,size,ofs))
198 #elif HAVE___PREAD
199 #define real_pread(fd,buf,size,ofs) (__pread(fd,buf,size,ofs))
200 #endif
202 #ifdef HAVE__PREAD64
203 #define real_pread64(fd,buf,size,ofs) (_pread64(fd,buf,size,ofs))
204 #elif HAVE___PREAD64
205 #define real_pread64(fd,buf,size,ofs) (__pread64(fd,buf,size,ofs))
206 #endif
208 #ifdef HAVE__PWRITE
209 #define real_pwrite(fd,buf,size,ofs) (_pwrite(fd,buf,size,ofs))
210 #elif HAVE___PWRITE
211 #define real_pwrite(fd,buf,size,ofs) (__pwrite(fd,buf,size,ofs))
212 #endif
214 #ifdef HAVE__PWRITE64
215 #define real_pwrite64(fd,buf,size,ofs) (_pwrite64(fd,buf,size,ofs))
216 #elif HAVE___PWRITE64
217 #define real_pwrite64(fd,buf,size,ofs) (__pwrite64(fd,buf,size,ofs))
218 #endif
221 #define real_readlink(fn,buf,len) (syscall(SYS_readlink, (fn), (buf), (len)))
222 #define real_rename(fn1, fn2) (syscall(SYS_rename, (fn1), (fn2)))
223 #define real_symlink(fn1, fn2) (syscall(SYS_symlink, (fn1), (fn2)))
224 #define real_read(fd, buf, count ) (syscall(SYS_read, (fd), (buf), (count)))
225 #define real_lseek(fd, offset, whence) (syscall(SYS_lseek, (fd), (offset), (whence)))
226 #define real_write(fd, buf, count ) (syscall(SYS_write, (fd), (buf), (count)))
227 #define real_close(fd) (syscall(SYS_close, (fd)))
228 #define real_fchdir(fd) (syscall(SYS_fchdir, (fd)))
229 #define real_fcntl(fd,cmd,arg) (syscall(SYS_fcntl, (fd), (cmd), (arg)))
230 #define real_symlink(fn1, fn2) (syscall(SYS_symlink, (fn1), (fn2)))
231 #define real_unlink(fn) (syscall(SYS_unlink, (fn)))
232 #define real_rmdir(fn) (syscall(SYS_rmdir, (fn)))
233 #define real_mkdir(fn, mode) (syscall(SYS_mkdir, (fn), (mode)))
235 #ifdef SYS_utime
236 #define real_utime(fn, buf) (syscall(SYS_utime, (fn), (buf)))
237 #else
238 #define REPLACE_UTIME 1
239 #endif
241 #ifdef SYS_utimes
242 #define real_utimes(fn, buf) (syscall(SYS_utimes, (fn), (buf)))
243 #else
244 #define REPLACE_UTIMES 1
245 #endif