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