2 Unix SMB/CIFS implementation.
3 defintions of syscall entries
4 Copyright (C) Andrew Tridgell 1998
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #if HAVE_SYS_SYSCALL_H
22 #include <sys/syscall.h>
28 /* amazingly, IRIX gets its own syscall numbers wrong! */
32 #define SYSVoffset 1000
37 /* this file is partly derived from zlibc by Alain Knaff */
39 #define real_access(fn, mode) (syscall(SYS_access, (fn), (mode)))
40 #define real_chdir(fn) (syscall(SYS_chdir, (fn)))
41 #define real_chmod(fn, mode) (syscall(SYS_chmod,(fn), (mode)))
42 #define real_chown(fn, owner, group) (syscall(SYS_chown,(fn),(owner),(group)))
45 #define real_getdents(fd, dirp, count) (syscall(SYS_getdents, (fd), (dirp), (count)))
48 #define real_link(fn1, fn2) (syscall(SYS_link, (fn1), (fn2)))
50 #define real_open(fn,flags,mode) (syscall(SYS_open, (fn), (flags), (mode)))
53 #define real_open64(fn,flags,mode) (syscall(SYS_open64, (fn), (flags), (mode)))
55 #define real_open64(fn,flags,mode) (_open64(fn,flags,mode))
56 #define NO_OPEN64_ALIAS
58 #define real_open64(fn,flags,mode) (__open64(fn,flags,mode))
59 #define NO_OPEN64_ALIAS
63 #define real_fork() (_fork())
65 #define real_fork() (__fork())
67 #define real_fork() (syscall(SYS_fork))
71 #define real_opendir(fn) (_opendir(fn))
73 #define real_opendir(fn) (syscall(SYS_opendir,(fn)))
75 #define real_opendir(fn) (__opendir(fn))
79 #define real_readdir(d) (_readdir(d))
81 #define real_readdir(d) (__readdir(d))
83 #define real_readdir(d) (syscall(SYS_readdir,(d)))
87 #define real_closedir(d) (_closedir(d))
89 #define real_closedir(d) (syscall(SYS_closedir,(d)))
91 #define real_closedir(d) (__closedir(d))
95 #define real_seekdir(d,l) (_seekdir(d,l))
97 #define real_seekdir(d,l) (syscall(SYS_seekdir,(d),(l)))
99 #define real_seekdir(d,l) (__seekdir(d,l))
101 #define NO_SEEKDIR_WRAPPER
105 #define real_telldir(d) (_telldir(d))
107 #define real_telldir(d) (syscall(SYS_telldir,(d)))
109 #define real_telldir(d) (__telldir(d))
113 #define real_dup(d) (_dup(d))
115 #define real_dup(d) (syscall(SYS_dup,(d)))
117 #define real_dup(d) (__dup(d))
121 #define real_dup2(d1,d2) (_dup2(d1,d2))
123 #define real_dup2(d1,d2) (syscall(SYS_dup2,(d1),(d2)))
125 #define real_dup2(d1,d2) (__dup2(d1,d2))
129 #define real_getcwd(b,s) ((char *)_getcwd(b,s))
131 #define real_getcwd(b,s) ((char *)syscall(SYS_getcwd,(b),(s)))
133 #define real_getcwd(b,s) ((char *)__getcwd(b,s))
137 #define real_stat(fn,st) (_stat(fn,st))
139 #define real_stat(fn,st) (syscall(SYS_stat,(fn),(st)))
141 #define real_stat(fn,st) (__stat(fn,st))
145 #define real_lstat(fn,st) (_lstat(fn,st))
147 #define real_lstat(fn,st) (syscall(SYS_lstat,(fn),(st)))
149 #define real_lstat(fn,st) (__lstat(fn,st))
153 #define real_fstat(fd,st) (_fstat(fd,st))
155 #define real_fstat(fd,st) (syscall(SYS_fstat,(fd),(st)))
157 #define real_fstat(fd,st) (__fstat(fd,st))
160 #if defined(HAVE_SYS_ACL_H) && defined(HAVE__ACL)
161 #define real_acl(fn,cmd,n,buf) (_acl(fn,cmd,n,buf))
163 #define real_acl(fn,cmd,n,buf) (syscall(SYS_acl,(fn),(cmd),(n),(buf)))
165 #define real_acl(fn,cmd,n,buf) (__acl(fn,cmd,n,buf))
167 #define NO_ACL_WRAPPER
171 #define real_facl(fd,cmd,n,buf) (_facl(fd,cmd,n,buf))
173 #define real_facl(fd,cmd,n,buf) (syscall(SYS_facl,(fd),(cmd),(n),(buf)))
175 #define real_facl(fd,cmd,n,buf) (__facl(fd,cmd,n,buf))
177 #define NO_FACL_WRAPPER
182 #define real_stat64(fn,st) (_stat64(fn,st))
184 #define real_stat64(fn,st) (__stat64(fn,st))
188 #define real_lstat64(fn,st) (_lstat64(fn,st))
190 #define real_lstat64(fn,st) (__lstat64(fn,st))
194 #define real_fstat64(fd,st) (_fstat64(fd,st))
196 #define real_fstat64(fd,st) (__fstat64(fd,st))
199 #ifdef HAVE__READDIR64
200 #define real_readdir64(d) (_readdir64(d))
201 #elif HAVE___READDIR64
202 #define real_readdir64(d) (__readdir64(d))
206 #define real_llseek(fd,ofs,whence) (_llseek(fd,ofs,whence))
208 #define real_llseek(fd,ofs,whence) (__llseek(fd,ofs,whence))
209 #elif HAVE___SYS_LLSEEK
210 #define real_llseek(fd,ofs,whence) (__sys_llseek(fd,ofs,whence))
215 #define real_pread(fd,buf,size,ofs) (_pread(fd,buf,size,ofs))
217 #define real_pread(fd,buf,size,ofs) (__pread(fd,buf,size,ofs))
221 #define real_pread64(fd,buf,size,ofs) (_pread64(fd,buf,size,ofs))
223 #define real_pread64(fd,buf,size,ofs) (__pread64(fd,buf,size,ofs))
227 #define real_pwrite(fd,buf,size,ofs) (_pwrite(fd,buf,size,ofs))
229 #define real_pwrite(fd,buf,size,ofs) (__pwrite(fd,buf,size,ofs))
232 #ifdef HAVE__PWRITE64
233 #define real_pwrite64(fd,buf,size,ofs) (_pwrite64(fd,buf,size,ofs))
234 #elif HAVE___PWRITE64
235 #define real_pwrite64(fd,buf,size,ofs) (__pwrite64(fd,buf,size,ofs))
239 #define real_readlink(fn,buf,len) (syscall(SYS_readlink, (fn), (buf), (len)))
240 #define real_rename(fn1, fn2) (syscall(SYS_rename, (fn1), (fn2)))
241 #define real_symlink(fn1, fn2) (syscall(SYS_symlink, (fn1), (fn2)))
242 #define real_read(fd, buf, count ) (syscall(SYS_read, (fd), (buf), (count)))
243 #define real_lseek(fd, offset, whence) (syscall(SYS_lseek, (fd), (offset), (whence)))
244 #define real_write(fd, buf, count ) (syscall(SYS_write, (fd), (buf), (count)))
245 #define real_close(fd) (syscall(SYS_close, (fd)))
246 #define real_fchdir(fd) (syscall(SYS_fchdir, (fd)))
247 #define real_fcntl(fd,cmd,arg) (syscall(SYS_fcntl, (fd), (cmd), (arg)))
248 #define real_symlink(fn1, fn2) (syscall(SYS_symlink, (fn1), (fn2)))
249 #define real_unlink(fn) (syscall(SYS_unlink, (fn)))
250 #define real_rmdir(fn) (syscall(SYS_rmdir, (fn)))
251 #define real_mkdir(fn, mode) (syscall(SYS_mkdir, (fn), (mode)))
254 #define real_utime(fn, buf) (syscall(SYS_utime, (fn), (buf)))
256 #define REPLACE_UTIME 1
260 #define real_utimes(fn, buf) (syscall(SYS_utimes, (fn), (buf)))
262 #define REPLACE_UTIMES 1