12 #include <sys/types.h>
14 #if defined(__LCLINT__)
16 typedef unsigned int u_int32_t;
17 typedef unsigned short u_int16_t;
18 typedef unsigned char u_int8_t;
24 # define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
27 unsigned long int __val[_SIGSET_NWORDS];
36 #ifdef HAVE_SYS_PARAM_H
37 #include <sys/param.h>
44 #if defined(__LCLINT__)
46 extern int chroot (
const char *__path)
51 #if !defined(__GLIBC__) && !defined(__LCLINT__)
53 #include <crt_externs.h>
54 #define environ (*_NSGetEnviron())
56 extern char ** environ;
61 #if TIME_WITH_SYS_TIME
62 # include <sys/time.h>
66 # include <sys/time.h>
73 extern time_t timezone;
78 #include <sys/mkdev.h>
81 #if 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 !STDC_HEADERS && 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 HAVE_ERROR && HAVE_ERROR_H
139 #if 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)
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 HAVE_SYS_MMAN_H && !defined(__LCLINT__)
260 #include <sys/mman.h>
264 #if HAVE_SYS_RESOURCE_H && HAVE_SYS_TIME_H
265 #include <sys/resource.h>
268 #if HAVE_SYS_UTSNAME_H
269 #include <sys/utsname.h>
273 #include <sys/wait.h>
294 #if HAVE_MALLOC_H && !defined(__LCLINT__)
303 #include <selinux/selinux.h>
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)
327 #if defined(WITH_SELINUX) && defined(__LCLINT__)
329 extern void freecon( security_context_t con)
332 extern int getfilecon(
const char *path, security_context_t *con)
334 extern int lgetfilecon(
const char *path, security_context_t *con)
336 extern int fgetfilecon(
int fd, security_context_t *con)
339 extern int setfilecon(
const char *path, security_context_t con)
342 extern int lsetfilecon(
const char *path, security_context_t con)
345 extern int fsetfilecon(
int fd, security_context_t con)
349 extern int getcon( security_context_t *con)
351 extern int getexeccon( security_context_t *con)
353 extern int setexeccon(security_context_t con)
360 extern int security_getenforce(
void)
380 void *
xcalloc (
size_t nmemb,
size_t size)
394 char *
xstrdup (
const char *str)
405 #if defined(__LCLINT__)
410 MCHECK_DISABLED = -1,
418 extern int mcheck (
void (*__abortfunc) (
enum mcheck_status))
421 extern int mcheck_pedantic (
void (*__abortfunc) (
enum mcheck_status))
424 extern void mcheck_check_all (
void)
427 extern enum mcheck_status mprobe (
void *__ptr)
430 extern void mtrace (
void)
433 extern void muntrace (
void)
440 #if defined(__GNUC__)
441 #define xmalloc(_size) (malloc(_size) ? : vmefail(_size))
442 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size))
443 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size))
444 #define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str)))
449 #if defined __GLIBC__ && __GLIBC__ >= 2
450 #if __GLIBC_MINOR__ >= 1
451 #define __progname __assert_program_name
453 #define setprogname(pn)
455 #define __progname program_name
456 #define setprogname(pn) \
457 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
458 else __progname = pn; \
478 # define setlocale(Category, Locale)
481 #if ENABLE_NLS && !defined(__LCLINT__)
482 # include <libintl.h>
483 # define _(Text) dgettext (PACKAGE, Text)
484 # define D_(Text) Text
486 # undef bindtextdomain
487 # define bindtextdomain(Domain, Directory)
489 # define textdomain(Domain)
490 # define _(Text) Text
491 # define D_(Text) Text
493 # define dgettext(DomainName, Text) Text
496 #define N_(Text) Text
500 #if !defined(USE_GNU_GLOB) || defined(__LCLINT__)
507 #if HAVE_GLOB_H || defined(__LCLINT__)
514 #include "misc/glob.h"
515 #include "misc/fnmatch.h"
519 #if defined(__LCLINT__)
529 void (*gl_closedir) (
void *);
531 struct dirent *(*gl_readdir) (
void *);
533 void *(*gl_readdir) (
void *);
535 ptr_t (*gl_opendir) (
const char *);
537 int (*gl_lstat) (
const char *restrict,
struct stat *restrict);
538 int (*gl_stat) (
const char *restrict,
struct stat *restrict);
540 int (*gl_lstat) (
const char *restrict,
void *restrict);
541 int (*gl_stat) (
const char *restrict,
void *restrict);
581 extern int glob (
const char *__pattern,
int __flags,
582 int (*__errfunc) (
const char *,
int),
587 extern void globfree ( glob_t *__pglob)
591 extern int glob_pattern_p (
const char *__pattern,
int __quote)
617 extern int fnmatch (
const char *__pattern,
const char *__name,
int __flags)
623 #define S_IFSOCK (0xc000)
627 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
631 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
639 #define realloc(ptr,size) myrealloc(ptr,size)
640 extern void *myrealloc(
void *,
size_t);
644 extern int setenv(
const char *
name,
const char *value,
int replace);
648 #if HAVE_SYS_SOCKET_H
649 #include <sys/types.h>
650 #include <sys/socket.h>
656 #if HAVE_SYS_SELECT_H && !defined(__LCLINT__)
657 #include <sys/select.h>
662 #if HAVE_GETPASSPHRASE
663 #define getpass getpassphrase
670 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
671 # define GETMNTENT_ONE 0
672 # define GETMNTENT_TWO 0
673 # if HAVE_SYS_MNTCTL_H
674 # include <sys/mntctl.h>
676 # if HAVE_SYS_VMOUNT_H
677 # include <sys/vmount.h>
679 # if HAVE_SYS_MOUNT_H
680 # include <sys/mount.h>
682 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
686 # define our_mntent struct mntent
687 # define our_mntdir mnt_dir
688 # elif HAVE_STRUCT_MNTTAB
695 # define our_mntent struct our_mntent
702 # define our_mntent struct our_mntent
704 # define GETMNTENT_ONE 1
705 # define GETMNTENT_TWO 0
706 #elif HAVE_SYS_MNTTAB_H
708 # include <sys/mnttab.h>
709 # define GETMNTENT_ONE 0
710 # define GETMNTENT_TWO 1
711 # define our_mntent struct mnttab
712 # define our_mntdir mnt_mountp
714 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
718 #define MOUNTED "/etc/mnttab"
721 #if defined(__LCLINT__)
722 #define FILE_RCSID(id)
724 #define FILE_RCSID(id) \
725 static inline const char *rcsid(const char *p) { \
726 return rcsid(p = id); \