2 Unix SMB/Netbios implementation.
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 #if HAVE_SYS_SYSCALL_H
23 #include <sys/syscall.h>
29 /* amazingly, IRIX gets its own syscall numbers wrong! */
33 #define SYSVoffset 1000
38 /* this file is partly derived from zlibc by Alain Knaff */
40 #define real_access(fn, mode) (syscall(SYS_access, (fn), (mode)))
41 #define real_chdir(fn) (syscall(SYS_chdir, (fn)))
42 #define real_chmod(fn, mode) (syscall(SYS_chmod,(fn), (mode)))
43 #define real_chown(fn, owner, group) (syscall(SYS_chown,(fn),(owner),(group)))
46 #define real_getdents(fd, dirp, count) (syscall(SYS_getdents, (fd), (dirp), (count)))
49 #define real_link(fn1, fn2) (syscall(SYS_link, (fn1), (fn2)))
51 #define real_open(fn,flags,mode) (syscall(SYS_open, (fn), (flags), (mode)))
54 #define real_open64(fn,flags,mode) (syscall(SYS_open64, (fn), (flags), (mode)))
56 #define real_open64(fn,flags,mode) (_open64(fn,flags,mode))
57 #define NO_OPEN64_ALIAS
59 #define real_open64(fn,flags,mode) (__open64(fn,flags,mode))
60 #define NO_OPEN64_ALIAS
64 #define real_fork() (_fork())
66 #define real_fork() (__fork())
68 #define real_fork() (syscall(SYS_fork))
72 #define real_opendir(fn) (_opendir(fn))
74 #define real_opendir(fn) (syscall(SYS_opendir,(fn)))
76 #define real_opendir(fn) (__opendir(fn))
80 #define real_readdir(d) (_readdir(d))
82 #define real_readdir(d) (__readdir(d))
84 #define real_readdir(d) (syscall(SYS_readdir,(d)))
88 #define real_closedir(d) (_closedir(d))
90 #define real_closedir(d) (syscall(SYS_closedir,(d)))
92 #define real_closedir(d) (__closedir(d))
96 #define real_seekdir(d,l) (_seekdir(d,l))
98 #define real_seekdir(d,l) (syscall(SYS_seekdir,(d),(l)))
100 #define real_seekdir(d,l) (__seekdir(d,l))
102 #define NO_SEEKDIR_WRAPPER
106 #define real_telldir(d) (_telldir(d))
108 #define real_telldir(d) (syscall(SYS_telldir,(d)))
110 #define real_telldir(d) (__telldir(d))
114 #define real_dup(d) (_dup(d))
116 #define real_dup(d) (syscall(SYS_dup,(d)))
118 #define real_dup(d) (__dup(d))
122 #define real_dup2(d1,d2) (_dup2(d1,d2))
124 #define real_dup2(d1,d2) (syscall(SYS_dup2,(d1),(d2)))
126 #define real_dup2(d1,d2) (__dup2(d1,d2))
130 #define real_getcwd(b,s) ((char *)_getcwd(b,s))
132 #define real_getcwd(b,s) ((char *)syscall(SYS_getcwd,(b),(s)))
134 #define real_getcwd(b,s) ((char *)__getcwd(b,s))
138 #define real_stat(fn,st) (_stat(fn,st))
140 #define real_stat(fn,st) (syscall(SYS_stat,(fn),(st)))
142 #define real_stat(fn,st) (__stat(fn,st))
146 #define real_lstat(fn,st) (_lstat(fn,st))
148 #define real_lstat(fn,st) (syscall(SYS_lstat,(fn),(st)))
150 #define real_lstat(fn,st) (__lstat(fn,st))
154 #define real_fstat(fd,st) (_fstat(fd,st))
156 #define real_fstat(fd,st) (syscall(SYS_fstat,(fd),(st)))
158 #define real_fstat(fd,st) (__fstat(fd,st))
161 #if defined(HAVE_SYS_ACL_H) && defined(HAVE__ACL)
162 #define real_acl(fn,cmd,n,buf) (_acl(fn,cmd,n,buf))
164 #define real_acl(fn,cmd,n,buf) (syscall(SYS_acl,(fn),(cmd),(n),(buf)))
166 #define real_acl(fn,cmd,n,buf) (__acl(fn,cmd,n,buf))
168 #define NO_ACL_WRAPPER
172 #define real_facl(fd,cmd,n,buf) (_facl(fd,cmd,n,buf))
174 #define real_facl(fd,cmd,n,buf) (syscall(SYS_facl,(fd),(cmd),(n),(buf)))
176 #define real_facl(fd,cmd,n,buf) (__facl(fd,cmd,n,buf))
178 #define NO_FACL_WRAPPER
183 #define real_stat64(fn,st) (_stat64(fn,st))
185 #define real_stat64(fn,st) (__stat64(fn,st))
189 #define real_lstat64(fn,st) (_lstat64(fn,st))
191 #define real_lstat64(fn,st) (__lstat64(fn,st))
195 #define real_fstat64(fd,st) (_fstat64(fd,st))
197 #define real_fstat64(fd,st) (__fstat64(fd,st))
200 #ifdef HAVE__READDIR64
201 #define real_readdir64(d) (_readdir64(d))
202 #elif HAVE___READDIR64
203 #define real_readdir64(d) (__readdir64(d))
207 #define real_llseek(fd,ofs,whence) (_llseek(fd,ofs,whence))
209 #define real_llseek(fd,ofs,whence) (__llseek(fd,ofs,whence))
210 #elif HAVE___SYS_LLSEEK
211 #define real_llseek(fd,ofs,whence) (__sys_llseek(fd,ofs,whence))
216 #define real_pread(fd,buf,size,ofs) (_pread(fd,buf,size,ofs))
218 #define real_pread(fd,buf,size,ofs) (__pread(fd,buf,size,ofs))
222 #define real_pread64(fd,buf,size,ofs) (_pread64(fd,buf,size,ofs))
224 #define real_pread64(fd,buf,size,ofs) (__pread64(fd,buf,size,ofs))
228 #define real_pwrite(fd,buf,size,ofs) (_pwrite(fd,buf,size,ofs))
230 #define real_pwrite(fd,buf,size,ofs) (__pwrite(fd,buf,size,ofs))
233 #ifdef HAVE__PWRITE64
234 #define real_pwrite64(fd,buf,size,ofs) (_pwrite64(fd,buf,size,ofs))
235 #elif HAVE___PWRITE64
236 #define real_pwrite64(fd,buf,size,ofs) (__pwrite64(fd,buf,size,ofs))
240 #define real_readlink(fn,buf,len) (syscall(SYS_readlink, (fn), (buf), (len)))
241 #define real_rename(fn1, fn2) (syscall(SYS_rename, (fn1), (fn2)))
242 #define real_symlink(fn1, fn2) (syscall(SYS_symlink, (fn1), (fn2)))
243 #define real_read(fd, buf, count ) (syscall(SYS_read, (fd), (buf), (count)))
244 #define real_lseek(fd, offset, whence) (syscall(SYS_lseek, (fd), (offset), (whence)))
245 #define real_write(fd, buf, count ) (syscall(SYS_write, (fd), (buf), (count)))
246 #define real_close(fd) (syscall(SYS_close, (fd)))
247 #define real_fchdir(fd) (syscall(SYS_fchdir, (fd)))
248 #define real_fcntl(fd,cmd,arg) (syscall(SYS_fcntl, (fd), (cmd), (arg)))
249 #define real_symlink(fn1, fn2) (syscall(SYS_symlink, (fn1), (fn2)))
250 #define real_unlink(fn) (syscall(SYS_unlink, (fn)))
251 #define real_rmdir(fn) (syscall(SYS_rmdir, (fn)))
252 #define real_mkdir(fn, mode) (syscall(SYS_mkdir, (fn), (mode)))
255 #define real_utime(fn, buf) (syscall(SYS_utime, (fn), (buf)))
257 #define REPLACE_UTIME 1
261 #define real_utimes(fn, buf) (syscall(SYS_utimes, (fn), (buf)))
263 #define REPLACE_UTIMES 1