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];
35 #if !defined(HAVE_S_ISTXT) && defined(HAVE_S_ISVTX) 36 #define S_ISTXT S_ISVTX 38 #if !defined(HAVE_STRUCT_STAT_ST_BIRTHTIME) 39 #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) && defined(st_birthtime) 42 #define st_birthtime st_ctime 45 #if !defined(HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC) && defined(HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC) 46 #define st_atimespec st_atim 47 #define st_ctimespec st_ctim 48 #define st_mtimespec st_mtim 53 #ifdef HAVE_SYS_PARAM_H 54 #include <sys/param.h> 58 #define MAXPHYS (128 * 1024) 64 #define uuid_t unistd_uuid_t 67 #if defined(__LCLINT__) 69 extern int chroot (
const char *__path)
74 #if !defined(__GLIBC__) && !defined(__LCLINT__) 76 #include <crt_externs.h> 77 #define environ (*_NSGetEnviron()) 84 #ifdef TIME_WITH_SYS_TIME 85 # include <sys/time.h> 88 # ifdef HAVE_SYS_TIME_H 89 # include <sys/time.h> 96 #if !defined(TIMEVAL_TO_TIMESPEC) 97 # define TIMEVAL_TO_TIMESPEC(tv, ts) { \ 98 (ts)->tv_sec = (tv)->tv_sec; \ 99 (ts)->tv_nsec = (tv)->tv_usec * 1000; \ 102 #if !defined(TIMESPEC_TO_TIMEVAL) 103 # define TIMESPEC_TO_TIMEVAL(tv, ts) { \ 104 (tv)->tv_sec = (ts)->tv_sec; \ 105 (tv)->tv_usec = (ts)->tv_nsec / 1000; \ 110 #if defined(MAJOR_IN_MKDEV) 111 #include <sys/mkdev.h> 114 #if defined(MAJOR_IN_SYSMACROS) 115 #include <sys/sysmacros.h> 123 #define major(dev) (((dev) >> 8) & 0xff) 124 #define minor(dev) ((dev) & 0xff) 125 #define makedev(maj, min) (((maj) << 8) | (min)) 134 # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) 139 # include <strings.h> 143 #if !defined(HAVE_STPCPY) 144 char *
stpcpy(
char * dest,
const char * src);
147 #if !defined(HAVE_STPNCPY) 148 char *
stpncpy(
char * dest,
const char * src,
size_t n);
158 #if defined(__LCLINT__) 161 extern void error(
int status,
int errnum,
const char *format, ...)
162 __attribute__ ((__format__ (__printf__, 3, 4)))
167 #if defined(HAVE_ERROR) && defined(HAVE_ERROR_H) 172 #if defined(HAVE___SECURE_GETENV) && !defined(__LCLINT__) 173 #define getenv(_s) __secure_getenv(_s) 178 #define getopt system_getopt 184 #if defined(__LCLINT__) 186 extern char *
realpath (
const char * file_name,
char * resolved_name)
194 #if !defined(HAVE_REALPATH) 195 char *
realpath(
const char *path,
char resolved_path []);
200 #if !defined(EXIT_FAILURE) 201 #define EXIT_FAILURE 1 207 #include <sys/file.h> 210 #if !defined(SEEK_SET) && !defined(__LCLINT__) 215 #if !defined(F_OK) && !defined(__LCLINT__) 228 # define NLENGTH(direct) (strlen((direct)->d_name)) 230 # define dirent direct 231 # define NLENGTH(direct) ((direct)->d_namlen) 232 # ifdef HAVE_SYS_NDIR_H 233 # include <sys/ndir.h> 235 # ifdef HAVE_SYS_DIR_H 236 # include <sys/dir.h> 243 #if defined(__LCLINT__) 245 void *
alloca (
size_t __size)
253 # define alloca __builtin_alloca 255 # ifdef HAVE_ALLOCA_H 265 #if defined (__GLIBC__) && defined(__LCLINT__) 268 extern __const __int32_t *__ctype_tolower;
270 extern __const __int32_t *__ctype_toupper;
276 #if defined (__GLIBC__) && defined(__LCLINT__) 278 extern int isalnum(
int)
__THROW ;
279 extern
int iscntrl(
int) __THROW ;
280 extern
int isgraph(
int) __THROW ;
281 extern
int islower(
int) __THROW ;
282 extern
int ispunct(
int) __THROW ;
283 extern
int isxdigit(
int) __THROW ;
284 extern
int isascii(
int) __THROW ;
285 extern
int toascii(
int) __THROW ;
286 extern
int _toupper(
int) __THROW ;
287 extern
int _tolower(
int) __THROW ;
292 #if defined(HAVE_SYS_MMAN_H) && !defined(__LCLINT__) 293 #include <sys/mman.h> 296 #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) 297 #define MAP_ANONYMOUS MAP_ANON 301 #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H) 302 #include <sys/resource.h> 305 #if defined(HAVE_SYS_UTSNAME_H) 306 #include <sys/utsname.h> 309 #if defined(HAVE_SYS_WAIT_H) 310 #include <sys/wait.h> 313 #if defined(HAVE_GETOPT_H) 319 #if defined(HAVE_GRP_H) 323 #if defined(HAVE_LIMITS_H) 327 #if defined(HAVE_ERR_H) 331 #if defined(HAVE_LIBGEN_H) 349 void *
xcalloc (
size_t nmemb,
size_t size)
363 char *
xstrdup (
const char *str)
376 #if defined(HAVE_MCHECK_H) 378 #if defined(__LCLINT__) 383 MCHECK_DISABLED = -1,
391 extern int mcheck (
void (*__abortfunc) (
enum mcheck_status))
394 extern int mcheck_pedantic (
void (*__abortfunc) (
enum mcheck_status))
397 extern void mcheck_check_all (
void)
400 extern enum mcheck_status mprobe (
void *__ptr)
403 extern void mtrace (
void)
406 extern void muntrace (
void)
413 #if defined(__GNUC__) 414 #define xmalloc(_size) (malloc(_size) ? : vmefail(_size)) 415 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size)) 416 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size)) 417 #define xstrdup(_str) (strcpy((char *)(malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str))) 422 #if defined __GLIBC__ && __GLIBC__ >= 2 423 #if __GLIBC_MINOR__ >= 1 424 #define __progname __assert_program_name 426 #define setprogname(pn) 428 #define __progname program_name 429 #define setprogname(pn) \ 430 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \ 431 else __progname = pn; \ 438 #if !defined(HAVE_SETPROCTITLE) && defined(__linux__) 439 extern int finiproctitle(
void)
442 extern int initproctitle(
int argc,
char *argv[],
char *envp[])
446 extern int setproctitle (
const char *fmt, ...)
447 __attribute__ ((__format__ (__printf__, 1, 2)))
451 #if defined(HAVE_NETDB_H) 455 #if defined(HAVE_NETINET_IN_H) 456 #include <netinet/in.h> 458 #if defined(HAVE_ARPA_INET_H) 459 #include <arpa/inet.h> 462 #if defined(HAVE_PWD_H) 468 #if defined(HAVE_LOCALE_H) 471 #if !defined(HAVE_SETLOCALE) 472 # define setlocale(Category, Locale) 475 #if defined(ENABLE_NLS) && !defined(__LCLINT__) 476 # include <libintl.h> 477 # define _(Text) dgettext (PACKAGE, Text) 478 # define D_(Text) Text 480 # undef bindtextdomain 481 # define bindtextdomain(Domain, Directory) 483 # define textdomain(Domain) 484 # define _(Text) Text 485 # define D_(Text) Text 487 # define dgettext(DomainName, Text) Text 490 #define N_(Text) Text 499 #if defined(__LCLINT__) 509 void (*gl_closedir) (
void *);
511 struct dirent *(*gl_readdir) (
void *);
513 void *(*gl_readdir) (
void *);
515 ptr_t (*gl_opendir) (
const char *);
517 int (*gl_lstat) (
const char *restrict,
struct stat *restrict);
518 int (*gl_stat) (
const char *restrict,
struct stat *restrict);
520 int (*gl_lstat) (
const char *restrict,
void *restrict);
521 int (*gl_stat) (
const char *restrict,
void *restrict);
561 extern int glob (
const char *__pattern,
int __flags,
562 int (*__errfunc) (
const char *,
int),
567 extern void globfree ( glob_t *__pglob)
571 extern int glob_pattern_p (
const char *__pattern,
int __quote)
598 extern int fnmatch (
const char *__pattern,
const char *__name,
int __flags)
604 #if !defined(__cplusplus) 605 #if !defined(HAVE_S_IFSOCK) 606 #define S_IFSOCK (0xc000) 609 #if !defined(HAVE_S_ISLNK) 610 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK) 613 #if !defined(HAVE_S_ISSOCK) 614 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK) 618 #if defined(NEED_STRINGS_H) 622 #if defined(NEED_MYREALLOC) 623 #define realloc(ptr,size) myrealloc(ptr,size) 624 extern void *myrealloc(
void *,
size_t);
627 #if !defined(HAVE_SETENV) 628 extern int setenv(
const char *
name,
const char *value,
int replace);
632 #if defined(HAVE_SYS_SOCKET_H) 633 #include <sys/types.h> 634 #include <sys/socket.h> 637 #if defined(HAVE_POLL_H) 640 #if defined(HAVE_SYS_SELECT_H) && !defined(__LCLINT__) 641 #include <sys/select.h> 646 #if defined(HAVE_GETPASSPHRASE) 647 #define getpass getpassphrase 650 #if !defined(HAVE_LCHOWN) 654 #if defined(HAVE_GETMNTINFO) || defined(HAVE_GETMNTINFO_R) || defined(HAVE_MNTCTL) 655 # define GETMNTENT_ONE 0 656 # define GETMNTENT_TWO 0 657 # if defined(HAVE_SYS_MNTCTL_H) 658 # include <sys/mntctl.h> 660 # if defined(HAVE_SYS_VMOUNT_H) 661 # include <sys/vmount.h> 663 # if defined(HAVE_SYS_MOUNT_H) 664 # include <sys/mount.h> 666 #elif defined(HAVE_MNTENT_H) || !defined(HAVE_GETMNTENT) || defined(HAVE_STRUCT_MNTTAB) 667 # if defined(HAVE_MNTENT_H) 670 # define our_mntent struct mntent 671 # define our_mntdir mnt_dir 672 # elif defined(HAVE_STRUCT_MNTTAB) 679 # define our_mntent struct our_mntent 686 # define our_mntent struct our_mntent 688 # define GETMNTENT_ONE 1 689 # define GETMNTENT_TWO 0 690 #elif defined(HAVE_SYS_MNTTAB_H) 692 # include <sys/mnttab.h> 693 # define GETMNTENT_ONE 0 694 # define GETMNTENT_TWO 1 695 # define our_mntent struct mnttab 696 # define our_mntdir mnt_mountp 698 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system. 702 #define MOUNTED "/etc/mnttab" 705 #if defined(__LCLINT__) 706 #define FILE_RCSID(id) 708 #define FILE_RCSID(id) \ 709 static inline const char *rcsid(const char *p) { \ 710 return rcsid(p = id); \ 714 #if defined(HAVE_SEARCH_H) 723 #if defined(__QNXNTO__) 724 #include <sys/netmgr.h> 725 #define Makedev(x,y) makedev(ND_LOCAL_NODE,(x),(y)) 727 #define Makedev(x,y) makedev((x),(y)) 730 #if defined(WITH_PTHREADS) 731 #if defined(HAVE_PTHREAD_H) && !defined(__LCLINT__) 739 #define SUPPORT_IMPLICIT_TAG_DATA_TYPES 1 744 #define SUPPORT_I18NSTRING_TYPE 0 749 #define SUPPORT_NOSIGNATURES 1 754 #undef SUPPORT_AR_PAYLOADS char * getenv(const char *name)
char * xstrdup(const char *str)
void * xmalloc(size_t size)
void globfree(glob_t *pglob)
int setenv(const char *name, const char *value, int replace)
void * xcalloc(size_t nmemb, size_t size)
struct our_mntent * getmntent(FILE *filep)
char * stpncpy(char *dest, const char *src, size_t n)
void unsetenv(const char *name)
void * vmefail(size_t size)
char * stpcpy(char *dest, const char *src)
int glob(const char *pattern, int flags, int(*errfunc) __P((const char *, int)), glob_t *pglob)
void * xrealloc(void *ptr, size_t size)
char * realpath(const char *path, char resolved_path [])
int fnmatch(char *pattern, const char *string, int flags) const