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