Version 1.8.0.0
[socat.git] / sycls.h
blob8f8ded5a887eaff9b1e242db797cf9389f4e1403
1 /* source: sycls.h */
2 /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 #ifndef __sycls_h_included
6 #define __sycls_h_included 1
8 #if WITH_SYCLS
9 struct termios; /* prevent gcc from spitting silly warning */
10 struct utsname;
11 struct flock;
12 struct addrinfo;
14 int Posix_memalign(void **memptr, size_t alignment, size_t size);
15 mode_t Umask(mode_t mask);
16 #endif /* WITH_SYCLS */
17 int Open(const char *pathname, int flags, mode_t mode);
18 #if WITH_SYCLS
19 int Creat(const char *pathname, mode_t mode);
20 off_t Lseek(int fildes, off_t offset, int whence);
21 #if HAVE_LSEEK64
22 off64_t Lseek64(int fildes, off64_t offset, int whence);
23 #endif
24 pid_t Getpid(void);
25 pid_t Getppid(void);
26 pid_t Getpgrp(void);
27 int Getpgid(pid_t pid);
28 int Setpgid(pid_t pid, pid_t pgid);
29 int Setpgrp(void);
30 pid_t Tcgetpgrp(int fd);
31 int Tcsetpgrp(int fd, pid_t pgrpid);
32 pid_t Getsid(pid_t pid);
33 pid_t Setsid(void);
34 uid_t Getuid(void);
35 uid_t Geteuid(void);
36 int Setuid(uid_t uid);
37 gid_t Getgid(void);
38 gid_t Getegid(void);
39 int Setgid(gid_t gid);
40 int Initgroups(const char *user, gid_t group);
41 int Getgroups(int size, gid_t list[]);
42 int Setgroups(size_t size, const gid_t *list);
43 int Getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups);
44 int Chdir(const char *path);
45 int Chroot(const char *path);
46 int Gettimeofday(struct timeval *tv, struct timezone *tz);
47 int Mknod(const char *pathname, mode_t mode, dev_t dev);
48 int Mkfifo(const char *pathname, mode_t mode);
49 int Stat(const char *file_name, struct stat *buf);
50 int Fstat(int filedes, struct stat *buf);
51 int Lstat(const char *file_name, struct stat *buf);
52 #if HAVE_STAT64
53 int Stat64(const char *file_name, struct stat64 *buf);
54 int Fstat64(int filedes, struct stat64 *buf);
55 int Lstat64(const char *file_name, struct stat64 *buf);
56 #endif /* HAVE_STAT64 */
57 int Dup(int oldfd);
58 int Dup2(int oldfd, int newfd);
59 int Pipe(int filedes[2]);
60 #endif /* WITH_SYCLS */
61 ssize_t Read(int fd, void *buf, size_t count);
62 ssize_t Write(int fd, const void *buf, size_t count);
63 int Fcntl(int fd, int cmd);
64 int Fcntl_i(int fd, int cmd, int arg);
65 int Fcntl_l(int fd, int cmd, long arg);
66 int Fcntl_lock(int fd, int cmd, struct flock *l);
67 #if WITH_SYCLS
68 int Ftruncate(int fd, off_t length);
69 #if HAVE_FTRUNCATE64
70 int Ftruncate64(int fd, off64_t length);
71 #endif /* HAVE_FTRUNCATE64 */
72 #endif /* WITH_SYCLS */
73 int Flock(int fd, int operation);
74 int Ioctl(int d, int request, void *argp);
75 int Ioctl_int(int d, int request, int arg);
76 #if WITH_SYCLS
77 int Close(int fd);
78 int Fchown(int fd, uid_t owner, gid_t group);
79 int Fchmod(int fd, mode_t mode);
80 int Unlink(const char *pathname);
81 int Symlink(const char *oldpath, const char *newpath);
82 int Readlink(const char *path, char *buf, size_t bufsiz);
83 int Chown(const char *path, uid_t owner, gid_t group);
84 int Chmod(const char *path, mode_t mode);
85 #endif /* WITH_SYCLS */
86 int Poll(struct pollfd *ufds, unsigned int nfds, int timeout);
87 int Select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
88 struct timeval *timeout);
89 int Pselect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
90 const struct timespec *timeout, const sigset_t *sigmask);
91 #if WITH_SYCLS
92 pid_t Fork(void);
93 #endif /* WITH_SYCLS */
94 pid_t Waitpid(pid_t pid, int *status, int options);
95 #if WITH_SYCLS
96 #ifndef HAVE_TYPE_SIGHANDLER
97 typedef RETSIGTYPE (*sighandler_t)(int);
98 #endif
99 sighandler_t Signal(int signum, sighandler_t handler);
100 int Sigaction(int signum, const struct sigaction *act,
101 struct sigaction *oldact);
102 int Sigprocmask(int how, const sigset_t *set, sigset_t *oset);
103 unsigned int Alarm(unsigned int seconds);
104 int Kill(pid_t pid, int sig);
105 int Link(const char *oldpath, const char *newpath);
106 int Execvp(const char *file, char *const argv[]);
107 #endif /* WITH_SYCLS */
108 int System(const char *string);
109 #if WITH_SYCLS
110 int Socketpair(int d, int type, int protocol, int sv[2]);
111 #endif /* WITH_SYCLS */
112 #if _WITH_SOCKET
113 #if WITH_SYCLS
114 int Socket(int domain, int type, int protocol);
115 int Bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen);
116 #endif /* WITH_SYCLS */
117 int Connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen);
118 #if WITH_SYCLS
119 int Listen(int s, int backlog);
120 #endif /* WITH_SYCLS */
121 int Accept(int s, struct sockaddr *addr, socklen_t *addrlen);
122 #if WITH_SYCLS
123 int Getsockname(int s, struct sockaddr *name, socklen_t *namelen);
124 int Getpeername(int s, struct sockaddr *name, socklen_t *namelen);
125 int Getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen);
126 int Setsockopt(int s, int level, int optname, const void *optval, int optlen);
127 #endif /* WITH_SYCLS */
128 int Recv(int s, void *buf, size_t len, int flags);
129 int Recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from,
130 socklen_t *fromlen);
131 int Recvmsg(int s, struct msghdr *msg, int flags);
132 int Send(int s, const void *mesg, size_t len, int flags);
133 int Sendto(int s, const void *msg, size_t len, int flags,
134 const struct sockaddr *to, socklen_t tolen);
135 #if WITH_SYCLS
136 int Shutdown(int fd, int how);
137 #endif /* WITH_SYCLS */
138 #endif /* _WITH_SOCKET */
139 #if WITH_SYCLS
140 unsigned int Sleep(unsigned int seconds);
141 unsigned int Nanosleep(const struct timespec *req, struct timespec *rem);
142 int Pause(void);
143 struct hostent *Gethostbyname(const char *name);
144 int Getaddrinfo(const char *node, const char *service,
145 const struct addrinfo *hints, struct addrinfo **res);
146 struct hostent *Getipnodebyname(const char *name, int af, int flags,
147 int *error_num);
148 void *Malloc(size_t size);
149 void *Calloc(size_t nmemb, size_t size);
150 void *Realloc(void *ptr, size_t size);
151 int Tcgetattr(int fd, struct termios *termios_p);
152 int Tcsetattr(int fd, int optional_actions, struct termios *termios_p);
153 char *Ttyname(int fd);
154 int Isatty(int fd);
155 struct winsize; /* avoid warnings */
156 int Openpty(int *ptyfd, int *ttyfd, char *ptyname, struct termios *termp,
157 struct winsize *winp);
158 char *Ptsname(int fd);
159 int Grantpt(int fd);
160 int Unlockpt(int fd);
161 int Gethostname(char *name, size_t len);
162 int Uname(struct utsname *buf);
163 int Atexit(void (*func)(void));
164 #endif /* WITH_SYCLS */
165 void Exit(int status);
166 #if WITH_SYCLS
167 void Abort(void);
168 int Mkstemp(char *template);
169 int Setenv(const char *name, const char *value, int overwrite);
170 void Unsetenv(const char *name);
171 int Setns(int fd, int nstype);
172 #endif /* WITH_SYCLS */
173 #if WITH_SYCLS
175 char *Readline(const char *prompt);
176 void Using_history(void);
177 int Read_history(const char *filename);
178 int Write_history(const char *filename);
179 int Append_history(int nelements, const char *filename);
180 int Read_history(const char *filename);
181 void Add_history(const char *string);
183 #else /* !WITH_SYCLS */
185 #define Posix_memalign(m,a,s) posix_memalign(m,a,s)
186 #define Umask(m) umask(m)
187 #define Creat(p,m) creat(p,m)
188 #define Lseek(f,o,w) lseek(f,o,w)
189 #define Lseek64(f,o,w) lseek64(f,o,w)
190 #define Getpid() getpid()
191 #define Getppid() getppid()
192 #define Getpgrp() getpgrp()
193 #define Getpgid(p) getpgid(p)
194 #define Setpgid(p,g) setpgid(p,g)
195 #define Setpgrp() setpgrp()
196 #define Tcgetpgrp(f) tcgetpgrp(f)
197 #define Tcsetpgrp(f,p) tcsetpgrp(f,p)
198 #define Getsid(p) getsid(p)
199 #define Setsid() setsid()
200 #define Getuid() getuid()
201 #define Geteuid() geteuid()
202 #define Setuid(u) setuid(u)
203 #define Getgid() getgid()
204 #define Getegid() getegid()
205 #define Setgid(g) setgid(g)
206 #define Initgroups(u,g) initgroups(u,g)
207 #define Getgroups(s,l) getgroups(s,l)
208 #define Setgroups(s,l) setgroups(s,l)
209 #define Getgrouplist(u,g,gs,n) getgrouplist(u,g,gs,n)
210 #define Chdir(p) chdir(p)
211 #define Chroot(p) chroot(p)
212 #define Gettimeofday(tv,tz) gettimeofday(tv,tz)
213 #define Mknod(p,m,d) mknod(p,m,d)
214 #define Mkfifo(p,m) mkfifo(p,m)
215 #define Stat(f,b) stat(f,b)
216 #define Stat64(f,b) stat64(f,b)
217 #define Fstat(f,b) fstat(f,b)
218 #define Fstat64(f,b) fstat64(f,b)
219 #define Lstat(f,b) lstat(f,b)
220 #define Lstat64(f,b) lstat64(f,b)
221 #define Dup(o) dup(o)
222 #define Dup2(o,n) dup2(o,n)
223 #define Pipe(f) pipe(f)
224 #define Ftruncate(f,l) ftruncate(f,l)
225 #define Ftruncate64(f,l) ftruncate64(f,l)
226 #define Close(f) close(f)
227 #define Fchown(f,o,g) fchown(f,o,g)
228 #define Fchmod(f,m) fchmod(f,m)
229 #define Unlink(p) unlink(p)
230 #define Symlink(op,np) symlink(op,np)
231 #define Readlink(p,b,s) readlink(p,b,s)
232 #define Chown(p,o,g) chown(p,o,g)
233 #define Chmod(p,m) chmod(p,m)
234 #define Fork() fork()
235 #define Signal(s,h) signal(s,h)
236 #define Sigaction(s,a,o) sigaction(s,a,o)
237 #define Sigprocmask(h,s,o) sigprocmask(h,s,o)
238 #define Alarm(s) alarm(s)
239 #define Kill(p,s) kill(p,s)
240 #define Link(o,n) link(o,n)
241 #define Execvp(f,a) execvp(f,a)
242 #define Socketpair(d,t,p,s) socketpair(d,t,p,s)
243 #define Socket(d,t,p) socket(d,t,p)
244 #define Bind(s,m,a) bind(s,m,a)
245 #define Listen(s,b) listen(s,b)
246 #define Getsockname(s,n,l) getsockname(s,n,l)
247 #define Getpeername(s,n,l) getpeername(s,n,l)
248 #define Getsockopt(s,d,n,v,l) getsockopt(s,d,n,v,l)
249 #define Setsockopt(s,d,n,v,l) setsockopt(s,d,n,v,l)
250 #define Shutdown(f,h) shutdown(f,h)
251 #define Sleep(s) sleep(s)
252 #define Nanosleep(req,rem) nanosleep(req,rem)
253 #define Pause() pause()
254 #define Gethostbyname(n) gethostbyname(n)
255 #define Getaddrinfo(n,s,h,r) getaddrinfo(n,s,h,r)
256 #define Getipnodebyname(n,a,f,e) getipnodebyname(n,a,f,e)
257 #define Malloc(s) malloc(s)
258 #define Calloc(n,s) calloc(n,s)
259 #define Realloc(p,s) realloc(p,s)
260 #define Tcgetattr(f,t) tcgetattr(f,t)
261 #define Tcsetattr(f,o,t) tcsetattr(f,o,t)
262 #define Ttyname(f) ttyname(f)
263 #define Isatty(f) isatty(f)
264 #define Openpty(p,t,n,i,f) openpty(p,t,n,i,f)
265 #define Ptsname(f) ptsname(f)
266 #define Grantpt(f) grantpt(f)
267 #define Unlockpt(f) unlockpt(f)
268 #define Getpgid(p) getpgid(p)
269 #define Gethostname(n,l) gethostname(n,l)
270 #define Uname(b) uname(b)
271 #define Atexit(f) atexit(f)
272 #define Abort() abort()
273 #define Mkstemp(t) mkstemp(t)
274 #define Setenv(n,v,o) setenv(n,v,o)
275 #define Unsetenv(n) unsetenv(n)
276 #define Setns(f,n) setns(f,n)
278 #define Readline(p) readline(p)
279 #define Using_history() using_history()
280 #define Read_history(f) read_history(f)
281 #define Write_history(f) write_history(f)
282 #define Append_history(n,f) append_history(n,f)
283 #define Read_history(f) read_history(f)
284 #define Add_history(s) add_history(s)
286 #endif /* !WITH_SYCLS */
288 #endif /* !defined(__sycls_h_included) */