set the various DsSpooler keys that are linked to PRINTER_INFO_2 fields; CR 985
[Samba.git] / source / smbwrapper / realcalls.h
blob6c230dba05606825482a4ccbf981e611395e8fac
1 /*
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>
23 #elif HAVE_SYSCALL_H
24 #include <syscall.h>
25 #endif
27 #ifdef IRIX
28 /* amazingly, IRIX gets its own syscall numbers wrong! */
29 #ifdef SYSVoffset
30 #if (SYSVoffset == 1)
31 #undef SYSVoffset
32 #define SYSVoffset 1000
33 #endif
34 #endif
35 #endif
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)))
44 #ifdef SYS_getdents
45 #define real_getdents(fd, dirp, count) (syscall(SYS_getdents, (fd), (dirp), (count)))
46 #endif
48 #define real_link(fn1, fn2) (syscall(SYS_link, (fn1), (fn2)))
50 #define real_open(fn,flags,mode) (syscall(SYS_open, (fn), (flags), (mode)))
52 #ifdef SYS_open64
53 #define real_open64(fn,flags,mode) (syscall(SYS_open64, (fn), (flags), (mode)))
54 #elif HAVE__OPEN64
55 #define real_open64(fn,flags,mode) (_open64(fn,flags,mode))
56 #define NO_OPEN64_ALIAS
57 #elif HAVE___OPEN64
58 #define real_open64(fn,flags,mode) (__open64(fn,flags,mode))
59 #define NO_OPEN64_ALIAS
60 #endif
62 #ifdef HAVE__FORK
63 #define real_fork() (_fork())
64 #elif HAVE___FORK
65 #define real_fork() (__fork())
66 #elif SYS_fork
67 #define real_fork() (syscall(SYS_fork))
68 #endif
70 #ifdef HAVE__OPENDIR
71 #define real_opendir(fn) (_opendir(fn))
72 #elif SYS_opendir
73 #define real_opendir(fn) (syscall(SYS_opendir,(fn)))
74 #elif HAVE___OPENDIR
75 #define real_opendir(fn) (__opendir(fn))
76 #endif
78 #ifdef HAVE__READDIR
79 #define real_readdir(d) (_readdir(d))
80 #elif HAVE___READDIR
81 #define real_readdir(d) (__readdir(d))
82 #elif SYS_readdir
83 #define real_readdir(d) (syscall(SYS_readdir,(d)))
84 #endif
86 #ifdef HAVE__CLOSEDIR
87 #define real_closedir(d) (_closedir(d))
88 #elif SYS_closedir
89 #define real_closedir(d) (syscall(SYS_closedir,(d)))
90 #elif HAVE___CLOSEDIR
91 #define real_closedir(d) (__closedir(d))
92 #endif
94 #ifdef HAVE__SEEKDIR
95 #define real_seekdir(d,l) (_seekdir(d,l))
96 #elif SYS_seekdir
97 #define real_seekdir(d,l) (syscall(SYS_seekdir,(d),(l)))
98 #elif HAVE___SEEKDIR
99 #define real_seekdir(d,l) (__seekdir(d,l))
100 #else
101 #define NO_SEEKDIR_WRAPPER
102 #endif
104 #ifdef HAVE__TELLDIR
105 #define real_telldir(d) (_telldir(d))
106 #elif SYS_telldir
107 #define real_telldir(d) (syscall(SYS_telldir,(d)))
108 #elif HAVE___TELLDIR
109 #define real_telldir(d) (__telldir(d))
110 #endif
112 #ifdef HAVE__DUP
113 #define real_dup(d) (_dup(d))
114 #elif SYS_dup
115 #define real_dup(d) (syscall(SYS_dup,(d)))
116 #elif HAVE___DUP
117 #define real_dup(d) (__dup(d))
118 #endif
120 #ifdef HAVE__DUP2
121 #define real_dup2(d1,d2) (_dup2(d1,d2))
122 #elif SYS_dup2
123 #define real_dup2(d1,d2) (syscall(SYS_dup2,(d1),(d2)))
124 #elif HAVE___DUP2
125 #define real_dup2(d1,d2) (__dup2(d1,d2))
126 #endif
128 #ifdef HAVE__GETCWD
129 #define real_getcwd(b,s) ((char *)_getcwd(b,s))
130 #elif SYS_getcwd
131 #define real_getcwd(b,s) ((char *)syscall(SYS_getcwd,(b),(s)))
132 #elif HAVE___GETCWD
133 #define real_getcwd(b,s) ((char *)__getcwd(b,s))
134 #endif
136 #ifdef HAVE__STAT
137 #define real_stat(fn,st) (_stat(fn,st))
138 #elif SYS_stat
139 #define real_stat(fn,st) (syscall(SYS_stat,(fn),(st)))
140 #elif HAVE___STAT
141 #define real_stat(fn,st) (__stat(fn,st))
142 #endif
144 #ifdef HAVE__LSTAT
145 #define real_lstat(fn,st) (_lstat(fn,st))
146 #elif SYS_lstat
147 #define real_lstat(fn,st) (syscall(SYS_lstat,(fn),(st)))
148 #elif HAVE___LSTAT
149 #define real_lstat(fn,st) (__lstat(fn,st))
150 #endif
152 #ifdef HAVE__FSTAT
153 #define real_fstat(fd,st) (_fstat(fd,st))
154 #elif SYS_fstat
155 #define real_fstat(fd,st) (syscall(SYS_fstat,(fd),(st)))
156 #elif HAVE___FSTAT
157 #define real_fstat(fd,st) (__fstat(fd,st))
158 #endif
160 #if defined(HAVE_SYS_ACL_H) && defined(HAVE__ACL)
161 #define real_acl(fn,cmd,n,buf) (_acl(fn,cmd,n,buf))
162 #elif SYS_acl
163 #define real_acl(fn,cmd,n,buf) (syscall(SYS_acl,(fn),(cmd),(n),(buf)))
164 #elif HAVE___ACL
165 #define real_acl(fn,cmd,n,buf) (__acl(fn,cmd,n,buf))
166 #else
167 #define NO_ACL_WRAPPER
168 #endif
170 #ifdef HAVE__FACL
171 #define real_facl(fd,cmd,n,buf) (_facl(fd,cmd,n,buf))
172 #elif SYS_facl
173 #define real_facl(fd,cmd,n,buf) (syscall(SYS_facl,(fd),(cmd),(n),(buf)))
174 #elif HAVE___FACL
175 #define real_facl(fd,cmd,n,buf) (__facl(fd,cmd,n,buf))
176 #else
177 #define NO_FACL_WRAPPER
178 #endif
181 #ifdef HAVE__STAT64
182 #define real_stat64(fn,st) (_stat64(fn,st))
183 #elif HAVE___STAT64
184 #define real_stat64(fn,st) (__stat64(fn,st))
185 #endif
187 #ifdef HAVE__LSTAT64
188 #define real_lstat64(fn,st) (_lstat64(fn,st))
189 #elif HAVE___LSTAT64
190 #define real_lstat64(fn,st) (__lstat64(fn,st))
191 #endif
193 #ifdef HAVE__FSTAT64
194 #define real_fstat64(fd,st) (_fstat64(fd,st))
195 #elif HAVE___FSTAT64
196 #define real_fstat64(fd,st) (__fstat64(fd,st))
197 #endif
199 #ifdef HAVE__READDIR64
200 #define real_readdir64(d) (_readdir64(d))
201 #elif HAVE___READDIR64
202 #define real_readdir64(d) (__readdir64(d))
203 #endif
205 #ifdef HAVE__LLSEEK
206 #define real_llseek(fd,ofs,whence) (_llseek(fd,ofs,whence))
207 #elif HAVE___LLSEEK
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))
211 #endif
214 #ifdef HAVE__PREAD
215 #define real_pread(fd,buf,size,ofs) (_pread(fd,buf,size,ofs))
216 #elif HAVE___PREAD
217 #define real_pread(fd,buf,size,ofs) (__pread(fd,buf,size,ofs))
218 #endif
220 #ifdef HAVE__PREAD64
221 #define real_pread64(fd,buf,size,ofs) (_pread64(fd,buf,size,ofs))
222 #elif HAVE___PREAD64
223 #define real_pread64(fd,buf,size,ofs) (__pread64(fd,buf,size,ofs))
224 #endif
226 #ifdef HAVE__PWRITE
227 #define real_pwrite(fd,buf,size,ofs) (_pwrite(fd,buf,size,ofs))
228 #elif HAVE___PWRITE
229 #define real_pwrite(fd,buf,size,ofs) (__pwrite(fd,buf,size,ofs))
230 #endif
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))
236 #endif
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)))
253 #ifdef SYS_utime
254 #define real_utime(fn, buf) (syscall(SYS_utime, (fn), (buf)))
255 #else
256 #define REPLACE_UTIME 1
257 #endif
259 #ifdef SYS_utimes
260 #define real_utimes(fn, buf) (syscall(SYS_utimes, (fn), (buf)))
261 #else
262 #define REPLACE_UTIMES 1
263 #endif