summaryrefslogtreecommitdiff
path: root/source3/smbwrapper/realcalls.h
blob: 2267d21a734ad25c7a9d04d739c6d7473c8c0368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* 
   Unix SMB/Netbios implementation.
   Version 2.0
   defintions of syscall entries
   Copyright (C) Andrew Tridgell 1998
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/


/* this file is partly derived from zlibc by Alain Knaff */

#define real_access(fn, mode)		(syscall(SYS_access, (fn), (mode)))
#define real_chdir(fn)		        (syscall(SYS_chdir, (fn)))
#define real_chmod(fn, mode)		(syscall(SYS_chmod,(fn), (mode)))
#define real_chown(fn, owner, group)	(syscall(SYS_chown,(fn),(owner),(group)))

#define real_getdents(fd, dirp, count)	(syscall(SYS_getdents, (fd), (dirp), (count)))
#define real_link(fn1, fn2)		(syscall(SYS_link, (fn1), (fn2)))

#define real_open(fn,flags,mode)	(syscall(SYS_open, (fn), (flags), (mode)))


#ifdef HAVE__OPENDIR
#define real_opendir(fn)            	(_opendir(fn))
#elif SYS_opendir
#define real_opendir(fn)		((DIR *)syscall(SYS_opendir,(fn)))
#elif HAVE___OPENDIR
#define real_opendir(fn)            	(__opendir(fn))
#endif

#ifdef HAVE__READDIR
#define real_readdir(d)            	(_readdir(d))
#elif SYS_readdir
#define real_readdir(d)		(syscall(SYS_readdir,(d)))
#elif HAVE___READDIR
#define real_readdir(d)            	(__readdir(d))
#endif

#ifdef HAVE__CLOSEDIR
#define real_closedir(d)            	(_closedir(d))
#elif SYS_closedir
#define real_closedir(d)		(syscall(SYS_closedir,(d)))
#elif HAVE___CLOSEDIR
#define real_closedir(d)            	(__closedir(d))
#endif

#ifdef HAVE__SEEKDIR
#define real_seekdir(d,l)            	(_seekdir(d,l))
#elif SYS_seekdir
#define real_seekdir(d,l)		(syscall(SYS_seekdir,(d),(l)))
#elif HAVE___SEEKDIR
#define real_seekdir(d)            	(__seekdir(d,l))
#else
#define NO_SEEKDIR_WRAPPER
#endif

#ifdef HAVE__TELLDIR
#define real_telldir(d)            	(_telldir(d))
#elif SYS_telldir
#define real_telldir(d)		(syscall(SYS_telldir,(d)))
#elif HAVE___TELLDIR
#define real_telldir(d)            	(__telldir(d))
#else
#define NO_TELLDIR_WRAPPER
#endif

#ifdef HAVE__DUP
#define real_dup(d)            	(_dup(d))
#elif SYS_dup
#define real_dup(d)		(syscall(SYS_dup,(d)))
#elif HAVE___DUP
#define real_dup(d)            	(__dup(d))
#endif

#ifdef HAVE__DUP2
#define real_dup2(d1,d2)            	(_dup2(d1,d2))
#elif SYS_dup2
#define real_dup2(d1,d2)		(syscall(SYS_dup2,(d1),(d2)))
#elif HAVE___DUP2
#define real_dup2(d1,d2)            	(__dup2(d1,d2))
#endif

#ifdef HAVE__GETCWD
#define real_getcwd(b,s)            	(_getcwd(b,s))
#elif SYS_getcwd
#define real_getcwd(b,s)		(syscall(SYS_getcwd,(b),(s)))
#elif HAVE___GETCWD
#define real_getcwd(b,s)            	(__getcwd(b,s))
#endif

#ifdef HAVE__STAT
#define real_stat(fn,st)            	(_stat(fn,st))
#elif SYS_stat
#define real_stat(fn,st)		(syscall(SYS_stat,(fn),(st)))
#elif HAVE___STAT
#define real_stat(fn,st)            	(__stat(fn,st))
#endif

#ifdef HAVE__LSTAT
#define real_lstat(fn,st)            	(_lstat(fn,st))
#elif SYS_lstat
#define real_lstat(fn,st)		(syscall(SYS_lstat,(fn),(st)))
#elif HAVE___LSTAT
#define real_lstat(fn,st)            	(__lstat(fn,st))
#endif

#ifdef HAVE__FSTAT
#define real_fstat(fd,st)            	(_fstat(fd,st))
#elif SYS_fstat
#define real_fstat(fd,st)		(syscall(SYS_fstat,(fd),(st)))
#elif HAVE___FSTAT
#define real_fstat(fd,st)            	(__fstat(fd,st))
#endif

#ifdef HAVE__ACL
#define real_acl(fn,cmd,n,buf)            	(_acl(fn,cmd,n,buf))
#elif SYS_acl
#define real_acl(fn,cmd,n,buf)		(syscall(SYS_acl,(fn),(cmd),(n),(buf)))
#elif HAVE___ACL
#define real_acl(fn,cmd,n,buf)            	(__acl(fn,cmd,n,buf))
#else
#define NO_ACL_WRAPPER
#endif

#ifdef HAVE__FACL
#define real_facl(fd,cmd,n,buf)            	(_facl(fd,cmd,n,buf))
#elif SYS_facl
#define real_facl(fd,cmd,n,buf)		(syscall(SYS_facl,(fd),(cmd),(n),(buf)))
#elif HAVE___FACL
#define real_facl(fd,cmd,n,buf)            	(__facl(fd,cmd,n,buf))
#else
#define NO_FACL_WRAPPER
#endif


#define real_readlink(fn,buf,len)	(syscall(SYS_readlink, (fn), (buf), (len)))
#define real_rename(fn1, fn2)		(syscall(SYS_rename, (fn1), (fn2)))
#define real_symlink(fn1, fn2)		(syscall(SYS_symlink, (fn1), (fn2)))
#define real_read(fd, buf, count )	(syscall(SYS_read, (fd), (buf), (count)))
#define real_lseek(fd, offset, whence)	(syscall(SYS_lseek, (fd), (offset), (whence)))
#define real_write(fd, buf, count )	(syscall(SYS_write, (fd), (buf), (count)))
#define real_close(fd)	                (syscall(SYS_close, (fd)))
#define real_fchdir(fd)	                (syscall(SYS_fchdir, (fd)))
#define real_fcntl(fd,cmd,arg)	        (syscall(SYS_fcntl, (fd), (cmd), (arg)))
#define real_symlink(fn1, fn2)		(syscall(SYS_symlink, (fn1), (fn2)))
#define real_unlink(fn)			(syscall(SYS_unlink, (fn)))
#define real_rmdir(fn)			(syscall(SYS_rmdir, (fn)))
#define real_mkdir(fn, mode)		(syscall(SYS_mkdir, (fn), (mode)))
#define real_utime(fn, buf)		(syscall(SYS_utime, (fn), (buf)))
#define real_utimes(fn, buf)		(syscall(SYS_utimes, (fn), (buf)))