3 * Copyright (c) 1995-2005 Kungliga Tekniska Högskolan
4 * (Royal Institute of Technology, Stockholm, Sweden).
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the Institute nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 #ifdef HAVE_SYS_PARAM_H
49 #include <sys/param.h>
51 #ifdef HAVE_INTTYPES_H
54 #ifdef HAVE_SYS_TYPES_H
55 #include <sys/types.h>
57 #ifdef HAVE_SYS_BITYPES_H
58 #include <sys/bitypes.h>
60 #ifdef HAVE_BIND_BITYPES_H
61 #include <bind/bitypes.h>
63 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
64 #include <netinet/in6_machtypes.h>
69 #ifdef HAVE_SYS_SOCKET_H
70 #include <sys/socket.h>
78 #ifdef HAVE_SYS_STAT_H
81 #ifdef HAVE_NETINET_IN_H
82 #include <netinet/in.h>
84 #ifdef HAVE_NETINET_IN6_H
85 #include <netinet/in6.h>
87 #ifdef HAVE_NETINET6_IN6_H
88 #include <netinet6/in6.h>
90 #ifdef HAVE_ARPA_INET_H
91 #include <arpa/inet.h>
96 #ifdef HAVE_ARPA_NAMESER_H
97 #include <arpa/nameser.h>
112 #ifdef HAVE_TERMIOS_H
115 #ifdef HAVE_SYS_IOCTL_H
116 #include <sys/ioctl.h>
118 #ifdef TIME_WITH_SYS_TIME
119 #include <sys/time.h>
121 #elif defined(HAVE_SYS_TIME_H)
122 #include <sys/time.h>
127 #ifdef HAVE_WS2TCPIP_H
128 #include <ws2tcpip.h>
139 #include <roken-common.h>
143 #ifdef HAVE_UINTPTR_T
144 #define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x))
146 #define rk_UNCONST(x) ((void *)(unsigned long)(const void *)(x))
149 #if !defined(HAVE_SETSID) && defined(HAVE__SETSID)
150 #define setsid _setsid
154 #define putenv rk_putenv
155 int ROKEN_LIB_FUNCTION
putenv(const char *);
158 #if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO)
160 #define setenv rk_setenv
162 int ROKEN_LIB_FUNCTION
setenv(const char *, const char *, int);
165 #if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO)
166 #ifndef HAVE_UNSETENV
167 #define unsetenv rk_unsetenv
169 void ROKEN_LIB_FUNCTION
unsetenv(const char *);
172 #if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO)
173 #ifndef HAVE_GETUSERSHELL
174 #define getusershell rk_getusershell
175 #define endusershell rk_endusershell
177 char * ROKEN_LIB_FUNCTION
getusershell(void);
178 void ROKEN_LIB_FUNCTION
endusershell(void);
181 #if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO)
182 #ifndef HAVE_SNPRINTF
183 #define snprintf rk_snprintf
185 int ROKEN_LIB_FUNCTION
186 rk_snprintf (char *, size_t, const char *, ...)
187 __attribute__ ((format (printf
, 3, 4)));
190 #if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO)
191 #ifndef HAVE_VSNPRINTF
192 #define vsnprintf rk_vsnprintf
194 int ROKEN_LIB_FUNCTION
195 rk_vsnprintf (char *, size_t, const char *, va_list)
196 __attribute__((format (printf
, 3, 0)));
199 #if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO)
200 #ifndef HAVE_ASPRINTF
201 #define asprintf rk_asprintf
203 int ROKEN_LIB_FUNCTION
204 rk_asprintf (char **, const char *, ...)
205 __attribute__ ((format (printf
, 2, 3)));
208 #if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO)
209 #ifndef HAVE_VASPRINTF
210 #define vasprintf rk_vasprintf
212 int ROKEN_LIB_FUNCTION
213 rk_vasprintf (char **, const char *, va_list)
214 __attribute__((format (printf
, 2, 0)));
217 #if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO)
218 #ifndef HAVE_ASNPRINTF
219 #define asnprintf rk_asnprintf
221 int ROKEN_LIB_FUNCTION
222 rk_asnprintf (char **, size_t, const char *, ...)
223 __attribute__ ((format (printf
, 3, 4)));
226 #if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO)
227 #ifndef HAVE_VASNPRINTF
228 #define vasnprintf rk_vasnprintf
230 int ROKEN_LIB_FUNCTION
231 vasnprintf (char **, size_t, const char *, va_list)
232 __attribute__((format (printf
, 3, 0)));
236 #define strdup rk_strdup
237 char * ROKEN_LIB_FUNCTION
strdup(const char *);
240 #if !defined(HAVE_STRNDUP) || defined(NEED_STRNDUP_PROTO)
242 #define strndup rk_strndup
244 char * ROKEN_LIB_FUNCTION
strndup(const char *, size_t);
248 #define strlwr rk_strlwr
249 char * ROKEN_LIB_FUNCTION
strlwr(char *);
253 #define strnlen rk_strnlen
254 size_t ROKEN_LIB_FUNCTION
strnlen(const char*, size_t);
257 #if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO)
259 #define strsep rk_strsep
261 char * ROKEN_LIB_FUNCTION
strsep(char**, const char*);
264 #if !defined(HAVE_STRSEP_COPY) || defined(NEED_STRSEP_COPY_PROTO)
265 #ifndef HAVE_STRSEP_COPY
266 #define strsep_copy rk_strsep_copy
268 ssize_t ROKEN_LIB_FUNCTION
strsep_copy(const char**, const char*, char*, size_t);
271 #ifndef HAVE_STRCASECMP
272 #define strcasecmp rk_strcasecmp
273 int ROKEN_LIB_FUNCTION
strcasecmp(const char *, const char *);
276 #ifdef NEED_FCLOSE_PROTO
277 int ROKEN_LIB_FUNCTION
fclose(FILE *);
280 #ifdef NEED_STRTOK_R_PROTO
281 char * ROKEN_LIB_FUNCTION
strtok_r(char *, const char *, char **);
285 #define strupr rk_strupr
286 char * ROKEN_LIB_FUNCTION
strupr(char *);
290 #define strlcpy rk_strlcpy
291 size_t ROKEN_LIB_FUNCTION
strlcpy (char *, const char *, size_t);
295 #define strlcat rk_strlcat
296 size_t ROKEN_LIB_FUNCTION
strlcat (char *, const char *, size_t);
299 #ifndef HAVE_GETDTABLESIZE
300 #define getdtablesize rk_getdtablesize
301 int ROKEN_LIB_FUNCTION
getdtablesize(void);
304 #if !defined(HAVE_STRERROR) && !defined(strerror)
305 #define strerror rk_strerror
306 char * ROKEN_LIB_FUNCTION
strerror(int);
309 #if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R))
310 int ROKEN_LIB_FUNCTION
rk_strerror_r(int, char *, size_t);
312 #define rk_strerror_r strerror_r
315 #if !defined(HAVE_HSTRERROR) || defined(NEED_HSTRERROR_PROTO)
316 #ifndef HAVE_HSTRERROR
317 #define hstrerror rk_hstrerror
319 /* This causes a fatal error under Psoriasis */
321 const char * ROKEN_LIB_FUNCTION
hstrerror(int);
325 #if !HAVE_DECL_H_ERRNO
329 #if !defined(HAVE_INET_ATON) || defined(NEED_INET_ATON_PROTO)
330 #ifndef HAVE_INET_ATON
331 #define inet_aton rk_inet_aton
333 int ROKEN_LIB_FUNCTION
inet_aton(const char *, struct in_addr
*);
336 #ifndef HAVE_INET_NTOP
337 #define inet_ntop rk_inet_ntop
338 const char * ROKEN_LIB_FUNCTION
339 inet_ntop(int af
, const void *src
, char *dst
, size_t size
);
342 #ifndef HAVE_INET_PTON
343 #define inet_pton rk_inet_pton
344 int ROKEN_LIB_FUNCTION
345 inet_pton(int, const char *, void *);
349 #define getcwd rk_getcwd
350 char* ROKEN_LIB_FUNCTION
getcwd(char *, size_t);
355 struct passwd
* ROKEN_LIB_FUNCTION
k_getpwnam (const char *);
356 struct passwd
* ROKEN_LIB_FUNCTION
k_getpwuid (uid_t
);
359 const char * ROKEN_LIB_FUNCTION
get_default_username (void);
362 #define seteuid rk_seteuid
363 int ROKEN_LIB_FUNCTION
seteuid(uid_t
);
367 #define setegid rk_setegid
368 int ROKEN_LIB_FUNCTION
setegid(gid_t
);
372 #define lstat rk_lstat
373 int ROKEN_LIB_FUNCTION
lstat(const char *, struct stat
*);
376 #if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO)
378 #define mkstemp rk_mkstemp
380 int ROKEN_LIB_FUNCTION
mkstemp(char *);
384 #define cgetent rk_cgetent
385 #define cgetstr rk_cgetstr
386 int ROKEN_LIB_FUNCTION
cgetent(char **, char **, const char *);
387 int ROKEN_LIB_FUNCTION
cgetstr(char *, const char *, char **);
390 #ifndef HAVE_INITGROUPS
391 #define initgroups rk_initgroups
392 int ROKEN_LIB_FUNCTION
initgroups(const char *, gid_t
);
396 #define fchown rk_fchown
397 int ROKEN_LIB_FUNCTION
fchown(int, uid_t
, gid_t
);
400 #if !defined(HAVE_DAEMON) || defined(NEED_DAEMON_PROTO)
402 #define daemon rk_daemon
404 int ROKEN_LIB_FUNCTION
daemon(int, int);
408 #define chown rk_chown
409 int ROKEN_LIB_FUNCTION
chown(const char *, uid_t
, gid_t
);
414 int ROKEN_LIB_FUNCTION
415 rcmd(char **, unsigned short, const char *,
416 const char *, const char *, int *);
419 #if !defined(HAVE_INNETGR) || defined(NEED_INNETGR_PROTO)
421 #define innetgr rk_innetgr
423 int ROKEN_LIB_FUNCTION
innetgr(const char*, const char*,
424 const char*, const char*);
427 #ifndef HAVE_IRUSEROK
428 #define iruserok rk_iruserok
429 int ROKEN_LIB_FUNCTION
iruserok(unsigned, int,
430 const char *, const char *);
433 #if !defined(HAVE_GETHOSTNAME) || defined(NEED_GETHOSTNAME_PROTO)
434 #ifndef HAVE_GETHOSTNAME
435 #define gethostname rk_gethostname
437 int ROKEN_LIB_FUNCTION
gethostname(char *, int);
441 #define writev rk_writev
442 ssize_t ROKEN_LIB_FUNCTION
443 writev(int, const struct iovec
*, int);
447 #define readv rk_readv
448 ssize_t ROKEN_LIB_FUNCTION
449 readv(int, const struct iovec
*, int);
453 #define pidfile rk_pidfile
454 void ROKEN_LIB_FUNCTION
pidfile (const char*);
458 #define bswap32 rk_bswap32
459 unsigned int ROKEN_LIB_FUNCTION
bswap32(unsigned int);
463 #define bswap16 rk_bswap16
464 unsigned short ROKEN_LIB_FUNCTION
bswap16(unsigned short);
469 #define LOCK_SH 1 /* Shared lock */
472 #define LOCK_EX 2 /* Exclusive lock */
475 #define LOCK_NB 4 /* Don't block when locking */
478 #define LOCK_UN 8 /* Unlock */
481 #define flock(_x,_y) rk_flock(_x,_y)
482 int rk_flock(int fd
, int operation
);
483 #endif /* HAVE_FLOCK */
486 #ifdef HAVE_DIR_DD_FD
487 #define dirfd(x) ((x)->dd_fd)
489 #ifndef _WIN32 /* Windows code never calls dirfd */
490 #error Missing dirfd() and ->dd_fd
495 time_t ROKEN_LIB_FUNCTION
tm2time (struct tm
, int);
497 int ROKEN_LIB_FUNCTION
unix_verify_user(char *, char *);
499 int ROKEN_LIB_FUNCTION
roken_concat (char *, size_t, ...);
501 size_t ROKEN_LIB_FUNCTION
roken_mconcat (char **, size_t, ...);
503 int ROKEN_LIB_FUNCTION
roken_vconcat (char *, size_t, va_list);
505 size_t ROKEN_LIB_FUNCTION
506 roken_vmconcat (char **, size_t, va_list);
508 ssize_t ROKEN_LIB_FUNCTION
net_write (int, const void *, size_t);
510 ssize_t ROKEN_LIB_FUNCTION
net_read (int, void *, size_t);
512 int ROKEN_LIB_FUNCTION
issuid(void);
514 #ifndef HAVE_STRUCT_WINSIZE
516 unsigned short ws_row
, ws_col
;
517 unsigned short ws_xpixel
, ws_ypixel
;
521 int ROKEN_LIB_FUNCTION
get_window_size(int fd
, struct winsize
*);
524 #define vsyslog rk_vsyslog
525 void ROKEN_LIB_FUNCTION
vsyslog(int, const char *, va_list);
528 #if !HAVE_DECL_OPTARG
531 #if !HAVE_DECL_OPTIND
534 #if !HAVE_DECL_OPTERR
538 #ifndef HAVE_GETIPNODEBYNAME
539 #define getipnodebyname rk_getipnodebyname
540 struct hostent
* ROKEN_LIB_FUNCTION
541 getipnodebyname (const char *, int, int, int *);
544 #ifndef HAVE_GETIPNODEBYADDR
545 #define getipnodebyaddr rk_getipnodebyaddr
546 struct hostent
* ROKEN_LIB_FUNCTION
547 getipnodebyaddr (const void *, size_t, int, int *);
550 #ifndef HAVE_FREEHOSTENT
551 #define freehostent rk_freehostent
552 void ROKEN_LIB_FUNCTION
553 freehostent (struct hostent
*);
556 #ifndef HAVE_COPYHOSTENT
557 #define copyhostent rk_copyhostent
558 struct hostent
* ROKEN_LIB_FUNCTION
559 copyhostent (const struct hostent
*);
562 #ifndef HAVE_SOCKLEN_T
563 typedef int socklen_t
;
566 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
568 #ifndef HAVE_SA_FAMILY_T
569 typedef unsigned short sa_family_t
;
573 #define _SS_MAXSIZE sizeof(struct sockaddr_in6)
575 #define _SS_MAXSIZE sizeof(struct sockaddr_in)
578 #define _SS_ALIGNSIZE sizeof(unsigned long)
580 #if HAVE_STRUCT_SOCKADDR_SA_LEN
582 typedef unsigned char roken_sa_family_t
;
584 #define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t) - sizeof(unsigned char)) % _SS_ALIGNSIZE)
585 #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + sizeof(unsigned char) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
587 struct sockaddr_storage
{
588 unsigned char ss_len
;
589 roken_sa_family_t ss_family
;
590 char __ss_pad1
[_SS_PAD1SIZE
];
591 unsigned long __ss_align
[_SS_PAD2SIZE
/ sizeof(unsigned long) + 1];
594 #else /* !HAVE_STRUCT_SOCKADDR_SA_LEN */
596 typedef unsigned short roken_sa_family_t
;
598 #define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t)) % _SS_ALIGNSIZE)
599 #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
601 struct sockaddr_storage
{
602 roken_sa_family_t ss_family
;
603 char __ss_pad1
[_SS_PAD1SIZE
];
604 unsigned long __ss_align
[_SS_PAD2SIZE
/ sizeof(unsigned long) + 1];
607 #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
609 #endif /* HAVE_STRUCT_SOCKADDR_STORAGE */
611 #ifndef HAVE_STRUCT_ADDRINFO
619 struct sockaddr
*ai_addr
;
620 struct addrinfo
*ai_next
;
624 #ifndef HAVE_GETADDRINFO
625 #define getaddrinfo rk_getaddrinfo
626 int ROKEN_LIB_FUNCTION
627 getaddrinfo(const char *,
629 const struct addrinfo
*,
633 #ifndef HAVE_GETNAMEINFO
634 #define getnameinfo rk_getnameinfo
635 int ROKEN_LIB_FUNCTION
636 getnameinfo(const struct sockaddr
*, socklen_t
,
642 #ifndef HAVE_FREEADDRINFO
643 #define freeaddrinfo rk_freeaddrinfo
644 void ROKEN_LIB_FUNCTION
645 freeaddrinfo(struct addrinfo
*);
648 #ifndef HAVE_GAI_STRERROR
649 #define gai_strerror rk_gai_strerror
650 const char * ROKEN_LIB_FUNCTION
654 int ROKEN_LIB_FUNCTION
655 getnameinfo_verified(const struct sockaddr
*, socklen_t
,
660 int ROKEN_LIB_FUNCTION
661 roken_getaddrinfo_hostspec(const char *, int, struct addrinfo
**);
662 int ROKEN_LIB_FUNCTION
663 roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo
**);
665 #ifndef HAVE_STRFTIME
666 #define strftime rk_strftime
667 size_t ROKEN_LIB_FUNCTION
668 strftime (char *, size_t, const char *, const struct tm
*);
671 #ifndef HAVE_STRPTIME
672 #define strptime rk_strptime
673 char * ROKEN_LIB_FUNCTION
674 strptime (const char *, const char *, struct tm
*);
678 #define emalloc rk_emalloc
679 void * ROKEN_LIB_FUNCTION
emalloc (size_t);
682 #define ecalloc rk_ecalloc
683 void * ROKEN_LIB_FUNCTION
ecalloc(size_t, size_t);
685 #ifndef HAVE_EREALLOC
686 #define erealloc rk_erealloc
687 void * ROKEN_LIB_FUNCTION
erealloc (void *, size_t);
690 #define estrdup rk_estrdup
691 char * ROKEN_LIB_FUNCTION
estrdup (const char *);
698 int ROKEN_LIB_FUNCTION
699 roken_gethostby_setup(const char*, const char*);
700 struct hostent
* ROKEN_LIB_FUNCTION
701 roken_gethostbyname(const char*);
702 struct hostent
* ROKEN_LIB_FUNCTION
703 roken_gethostbyaddr(const void*, size_t, int);
705 #ifdef GETSERVBYNAME_PROTO_COMPATIBLE
706 #define roken_getservbyname(x,y) getservbyname(x,y)
708 #define roken_getservbyname(x,y) getservbyname((char *)x, (char *)y)
711 #ifdef OPENLOG_PROTO_COMPATIBLE
712 #define roken_openlog(a,b,c) openlog(a,b,c)
714 #define roken_openlog(a,b,c) openlog((char *)a,b,c)
717 #ifdef GETSOCKNAME_PROTO_COMPATIBLE
718 #define roken_getsockname(a,b,c) getsockname(a,b,c)
720 #define roken_getsockname(a,b,c) getsockname(a, b, (void*)c)
723 #ifndef HAVE_SETPROGNAME
724 #define setprogname rk_setprogname
725 void ROKEN_LIB_FUNCTION
setprogname(const char *);
728 #ifndef HAVE_GETPROGNAME
729 #define getprogname rk_getprogname
730 const char * ROKEN_LIB_FUNCTION
getprogname(void);
733 #if !defined(HAVE_SETPROGNAME) && !defined(HAVE_GETPROGNAME) && !HAVE_DECL___PROGNAME
734 extern const char *__progname
;
737 void ROKEN_LIB_FUNCTION
mini_inetd_addrinfo (struct addrinfo
*);
738 void ROKEN_LIB_FUNCTION
mini_inetd (int);
740 #ifndef HAVE_LOCALTIME_R
741 #define localtime_r rk_localtime_r
742 struct tm
* ROKEN_LIB_FUNCTION
743 localtime_r(const time_t *, struct tm
*);
746 #if !defined(HAVE_STRSVIS) || defined(NEED_STRSVIS_PROTO)
748 #define strsvis rk_strsvis
750 int ROKEN_LIB_FUNCTION
751 strsvis(char *, const char *, int, const char *);
754 #if !defined(HAVE_STRSVISX) || defined(NEED_STRSVISX_PROTO)
755 #ifndef HAVE_STRSVISX
756 #define strsvisx rk_strsvisx
758 int ROKEN_LIB_FUNCTION
759 strsvisx(char *, const char *, size_t, int, const char *);
762 #if !defined(HAVE_STRUNVIS) || defined(NEED_STRUNVIS_PROTO)
763 #ifndef HAVE_STRUNVIS
764 #define strunvis rk_strunvis
766 int ROKEN_LIB_FUNCTION
767 strunvis(char *, const char *);
770 #if !defined(HAVE_STRVIS) || defined(NEED_STRVIS_PROTO)
772 #define strvis rk_strvis
774 int ROKEN_LIB_FUNCTION
775 strvis(char *, const char *, int);
778 #if !defined(HAVE_STRVISX) || defined(NEED_STRVISX_PROTO)
780 #define strvisx rk_strvisx
782 int ROKEN_LIB_FUNCTION
783 strvisx(char *, const char *, size_t, int);
786 #if !defined(HAVE_SVIS) || defined(NEED_SVIS_PROTO)
790 char * ROKEN_LIB_FUNCTION
791 svis(char *, int, int, int, const char *);
794 #if !defined(HAVE_UNVIS) || defined(NEED_UNVIS_PROTO)
796 #define unvis rk_unvis
798 int ROKEN_LIB_FUNCTION
799 unvis(char *, int, int *, int);
802 #if !defined(HAVE_VIS) || defined(NEED_VIS_PROTO)
806 char * ROKEN_LIB_FUNCTION
807 vis(char *, int, int, int);
810 #if !defined(HAVE_CLOSEFROM)
811 #define closefrom rk_closefrom
812 int ROKEN_LIB_FUNCTION
816 #if !defined(HAVE_TIMEGM)
817 #define timegm rk_timegm
818 time_t ROKEN_LIB_FUNCTION
819 rk_timegm(struct tm
*tm
);
823 #define qsort rk_qsort
825 rk_qsort(void *, size_t, size_t, int (*)(const void *, const void *));
828 #if defined(__linux__) && defined(SOCK_CLOEXEC) && !defined(SOCKET_WRAPPER_REPLACE)
830 #define socket(_fam,_type,_prot) rk_socket(_fam,_type,_prot)
831 int ROKEN_LIB_FUNCTION
rk_socket(int, int, int);
834 #ifdef SOCKET_WRAPPER_REPLACE
835 #include <socket_wrapper.h>