16 #include <sys/types.h>
18 #if defined(__LCLINT__)
20 typedef unsigned int u_int32_t;
21 typedef unsigned short u_int16_t;
22 typedef unsigned char u_int8_t;
28 # define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
31 unsigned long int __val[_SIGSET_NWORDS];
40 #ifdef HAVE_SYS_PARAM_H
41 #include <sys/param.h>
48 #if defined(__LCLINT__)
50 extern int chroot (
const char *__path)
55 #if !defined(__GLIBC__) && !defined(__LCLINT__)
57 #include <crt_externs.h>
58 #define environ (*_NSGetEnviron())
60 extern char ** environ;
65 #ifdef TIME_WITH_SYS_TIME
66 # include <sys/time.h>
69 # ifdef HAVE_SYS_TIME_H
70 # include <sys/time.h>
77 #if defined(MAJOR_IN_MKDEV)
78 #include <sys/mkdev.h>
81 #if defined(MAJOR_IN_SYSMACROS)
82 #include <sys/sysmacros.h>
90 #define major(dev) (((dev) >> 8) & 0xff)
91 #define minor(dev) ((dev) & 0xff)
92 #define makedev(maj, min) (((maj) << 8) | (min))
101 # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
106 # include <strings.h>
110 #if !defined(HAVE_STPCPY)
111 char *
stpcpy(
char * dest,
const char * src);
114 #if !defined(HAVE_STPNCPY)
115 char *
stpncpy(
char * dest,
const char * src,
size_t n);
125 #if defined(__LCLINT__)
128 extern void error(
int status,
int errnum,
const char *format, ...)
129 __attribute__ ((__format__ (__printf__, 3, 4)))
134 #if defined(HAVE_ERROR) && defined(HAVE_ERROR_H)
139 #if defined(HAVE___SECURE_GETENV) && !defined(__LCLINT__)
140 #define getenv(_s) __secure_getenv(_s)
145 #define getopt system_getopt
151 #if defined(__LCLINT__)
153 extern char *
realpath (
const char * file_name,
char * resolved_name)
161 #if !defined(HAVE_REALPATH)
162 char *
realpath(
const char *path,
char resolved_path []);
167 #if !defined(EXIT_FAILURE)
168 #define EXIT_FAILURE 1
174 #include <sys/file.h>
177 #if !defined(SEEK_SET) && !defined(__LCLINT__)
182 #if !defined(F_OK) && !defined(__LCLINT__)
195 # define NLENGTH(direct) (strlen((direct)->d_name))
197 # define dirent direct
198 # define NLENGTH(direct) ((direct)->d_namlen)
199 # ifdef HAVE_SYS_NDIR_H
200 # include <sys/ndir.h>
202 # ifdef HAVE_SYS_DIR_H
203 # include <sys/dir.h>
210 #if defined(__LCLINT__)
212 void *
alloca (
size_t __size)
220 # define alloca __builtin_alloca
222 # ifdef HAVE_ALLOCA_H
232 #if defined (__GLIBC__) && defined(__LCLINT__)
235 extern __const __int32_t *__ctype_tolower;
237 extern __const __int32_t *__ctype_toupper;
243 #if defined (__GLIBC__) && defined(__LCLINT__)
245 extern int isalnum(
int)
__THROW ;
246 extern
int iscntrl(
int) __THROW ;
247 extern
int isgraph(
int) __THROW ;
248 extern
int islower(
int) __THROW ;
249 extern
int ispunct(
int) __THROW ;
250 extern
int isxdigit(
int) __THROW ;
251 extern
int isascii(
int) __THROW ;
252 extern
int toascii(
int) __THROW ;
253 extern
int _toupper(
int) __THROW ;
254 extern
int _tolower(
int) __THROW ;
259 #if defined(HAVE_SYS_MMAN_H) && !defined(__LCLINT__)
260 #include <sys/mman.h>
263 #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
264 #define MAP_ANONYMOUS MAP_ANON
268 #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H)
269 #include <sys/resource.h>
272 #if defined(HAVE_SYS_UTSNAME_H)
273 #include <sys/utsname.h>
276 #if defined(HAVE_SYS_WAIT_H)
277 #include <sys/wait.h>
280 #if defined(HAVE_GETOPT_H)
286 #if defined(HAVE_GRP_H)
290 #if defined(HAVE_LIMITS_H)
294 #if defined(HAVE_ERR_H)
298 #if defined(HAVE_LIBGEN_H)
302 #if defined(WITH_SELINUX)
303 #include <selinux/selinux.h>
307 #define freecon(_c) do {} while(0)
309 #define getfilecon(_fn, _c) (-1)
310 #define lgetfilecon(_fn, _c) (-1)
311 #define fgetfilecon(_fd, _c) (-1)
313 #define setfilecon(_fn, _c) (-1)
314 #define lsetfilecon(_fn, _c) (-1)
315 #define fsetfilecon(_fd, _c) (-1)
317 #define security_check_context(_c) (0)
319 #define is_selinux_enabled() (-1)
321 #define rpm_execcon(_v, _fn, _av, _envp) (0)
323 #define matchpathcon_init(_fn) (-1)
324 #define matchpathcon(_fn, _fmode, _s) (-1)
325 #define matchpathcon_fini() do {} while(0)
328 #if defined(WITH_SELINUX) && defined(__LCLINT__)
330 extern void freecon( security_context_t con)
333 extern int getfilecon(
const char *path, security_context_t *con)
335 extern int lgetfilecon(
const char *path, security_context_t *con)
337 extern int fgetfilecon(
int fd, security_context_t *con)
340 extern int setfilecon(
const char *path, security_context_t con)
343 extern int lsetfilecon(
const char *path, security_context_t con)
346 extern int fsetfilecon(
int fd, security_context_t con)
350 extern int getcon( security_context_t *con)
352 extern int getexeccon( security_context_t *con)
354 extern int setexeccon(security_context_t con)
361 extern int security_getenforce(
void)
381 void *
xcalloc (
size_t nmemb,
size_t size)
395 char *
xstrdup (
const char *str)
404 #if defined(HAVE_MCHECK_H)
406 #if defined(__LCLINT__)
411 MCHECK_DISABLED = -1,
419 extern int mcheck (
void (*__abortfunc) (
enum mcheck_status))
422 extern int mcheck_pedantic (
void (*__abortfunc) (
enum mcheck_status))
425 extern void mcheck_check_all (
void)
428 extern enum mcheck_status mprobe (
void *__ptr)
431 extern void mtrace (
void)
434 extern void muntrace (
void)
441 #if defined(__GNUC__)
442 #define xmalloc(_size) (malloc(_size) ? : vmefail(_size))
443 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size))
444 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size))
445 #define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str)))
450 #if defined __GLIBC__ && __GLIBC__ >= 2
451 #if __GLIBC_MINOR__ >= 1
452 #define __progname __assert_program_name
454 #define setprogname(pn)
456 #define __progname program_name
457 #define setprogname(pn) \
458 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
459 else __progname = pn; \
465 #if defined(HAVE_NETDB_H)
469 #if defined(HAVE_NETINET_IN_H)
470 #include <netinet/in.h>
472 #if defined(HAVE_ARPA_INET_H)
473 #include <arpa/inet.h>
476 #if defined(HAVE_PWD_H)
482 #if defined(HAVE_LOCALE_H)
485 #if !defined(HAVE_SETLOCALE)
486 # define setlocale(Category, Locale)
489 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
490 # include <libintl.h>
491 # define _(Text) dgettext (PACKAGE, Text)
492 # define D_(Text) Text
494 # undef bindtextdomain
495 # define bindtextdomain(Domain, Directory)
497 # define textdomain(Domain)
498 # define _(Text) Text
499 # define D_(Text) Text
501 # define dgettext(DomainName, Text) Text
504 #define N_(Text) Text
513 #if defined(__LCLINT__)
523 void (*gl_closedir) (
void *);
525 struct dirent *(*gl_readdir) (
void *);
527 void *(*gl_readdir) (
void *);
529 ptr_t (*gl_opendir) (
const char *);
531 int (*gl_lstat) (
const char *restrict,
struct stat *restrict);
532 int (*gl_stat) (
const char *restrict,
struct stat *restrict);
534 int (*gl_lstat) (
const char *restrict,
void *restrict);
535 int (*gl_stat) (
const char *restrict,
void *restrict);
575 extern int glob (
const char *__pattern,
int __flags,
576 int (*__errfunc) (
const char *,
int),
585 extern int glob_pattern_p (
const char *__pattern,
int __quote)
612 extern int fnmatch (
const char *__pattern,
const char *__name,
int __flags)
618 #if !defined(HAVE_S_IFSOCK)
619 #define S_IFSOCK (0xc000)
622 #if !defined(HAVE_S_ISLNK)
623 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
626 #if !defined(HAVE_S_ISSOCK)
627 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
630 #if defined(NEED_STRINGS_H)
634 #if defined(NEED_MYREALLOC)
635 #define realloc(ptr,size) myrealloc(ptr,size)
636 extern void *myrealloc(
void *,
size_t);
639 #if !defined(HAVE_SETENV)
640 extern int setenv(
const char *
name,
const char *value,
int replace);
644 #if defined(HAVE_SYS_SOCKET_H)
645 #include <sys/types.h>
646 #include <sys/socket.h>
649 #if defined(HAVE_POLL_H)
652 #if defined(HAVE_SYS_SELECT_H) && !defined(__LCLINT__)
653 #include <sys/select.h>
658 #if defined(HAVE_GETPASSPHRASE)
659 #define getpass getpassphrase
662 #if !defined(HAVE_LCHOWN)
666 #if defined(HAVE_GETMNTINFO) || defined(HAVE_GETMNTINFO_R) || defined(HAVE_MNTCTL)
667 # define GETMNTENT_ONE 0
668 # define GETMNTENT_TWO 0
669 # if defined(HAVE_SYS_MNTCTL_H)
670 # include <sys/mntctl.h>
672 # if defined(HAVE_SYS_VMOUNT_H)
673 # include <sys/vmount.h>
675 # if defined(HAVE_SYS_MOUNT_H)
676 # include <sys/mount.h>
678 #elif defined(HAVE_MNTENT_H) || !defined(HAVE_GETMNTENT) || defined(HAVE_STRUCT_MNTTAB)
679 # if defined(HAVE_MNTENT_H)
682 # define our_mntent struct mntent
683 # define our_mntdir mnt_dir
684 # elif defined(HAVE_STRUCT_MNTTAB)
691 # define our_mntent struct our_mntent
698 # define our_mntent struct our_mntent
700 # define GETMNTENT_ONE 1
701 # define GETMNTENT_TWO 0
702 #elif defined(HAVE_SYS_MNTTAB_H)
704 # include <sys/mnttab.h>
705 # define GETMNTENT_ONE 0
706 # define GETMNTENT_TWO 1
707 # define our_mntent struct mnttab
708 # define our_mntdir mnt_mountp
710 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
714 #define MOUNTED "/etc/mnttab"
717 #if defined(__LCLINT__)
718 #define FILE_RCSID(id)
720 #define FILE_RCSID(id) \
721 static inline const char *rcsid(const char *p) { \
722 return rcsid(p = id); \
726 #if defined(HAVE_SEARCH_H)
735 #if defined(__QNXNTO__)
736 #include <sys/netmgr.h>
737 #define Makedev(x,y) makedev(ND_LOCAL_NODE,(x),(y))
739 #define Makedev(x,y) makedev((x),(y))
742 #if defined(WITH_PTHREADS)
743 #if defined(HAVE_PTHREAD_H) && !defined(__LCLINT__)
751 #define SUPPORT_INITDB 1
752 #define SUPPORT_VERIFYDB 1
757 #undef SUPPORT_IMPLICIT_TAG_DATA_TYPES
762 #undef SUPPORT_AR_PAYLOADS