version 1.1.1.5, 2013/10/14 07:56:34
|
version 1.1.1.6, 2014/06/15 16:12:54
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 1996, 1998-2005, 2008, 2009-2013 | * Copyright (c) 1996, 1998-2005, 2008, 2009-2014 |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 63
|
Line 63
|
# define __printf0like(f, v) |
# define __printf0like(f, v) |
# endif |
# endif |
#endif |
#endif |
|
#ifndef __format_arg |
|
# if __GNUC_PREREQ__(2, 7) |
|
# define __format_arg(f) __attribute__((__format_arg__ (f))) |
|
# else |
|
# define __format_arg(f) |
|
# endif |
|
#endif |
|
|
/* Hint to compiler that returned pointer is unique (malloc but not realloc). */ |
/* Hint to compiler that returned pointer is unique (malloc but not realloc). */ |
#ifndef __malloc_like |
#ifndef __malloc_like |
Line 73
|
Line 80
|
# endif |
# endif |
#endif |
#endif |
|
|
|
/* |
|
* Given the pointer x to the member m of the struct s, return |
|
* a pointer to the containing structure. |
|
*/ |
|
#ifndef __containerof |
|
# define __containerof(x, s, m) ((s *)((char *)(x) - offsetof(s, m))) |
|
#endif |
|
|
#ifndef __dso_public |
#ifndef __dso_public |
# ifdef HAVE_DSO_VISIBILITY |
# ifdef HAVE_DSO_VISIBILITY |
# if defined(__GNUC__) |
# if defined(__GNUC__) |
Line 92
|
Line 107
|
#endif |
#endif |
|
|
/* |
/* |
|
* Pre-C99 compilers may lack a va_copy macro. |
|
*/ |
|
#ifndef va_copy |
|
# ifdef __va_copy |
|
# define va_copy(d, s) __va_copy(d, s) |
|
# else |
|
# define va_copy(d, s) memcpy(&(d), &(s), sizeof(d)); |
|
# endif |
|
#endif |
|
|
|
/* |
* Some systems lack full limit definitions. |
* Some systems lack full limit definitions. |
*/ |
*/ |
#ifndef OPEN_MAX |
#ifndef OPEN_MAX |
# define OPEN_MAX 256 |
# define OPEN_MAX 256 |
#endif |
#endif |
|
|
#ifndef INT_MAX | #ifndef LLONG_MAX |
# define INT_MAX 0x7fffffff | # if defined(QUAD_MAX) |
| # define LLONG_MAX QUAD_MAX |
| # else |
| # define LLONG_MAX 0x7fffffffffffffffLL |
| # endif |
#endif |
#endif |
|
|
|
#ifndef LLONG_MIN |
|
# if defined(QUAD_MIN) |
|
# define LLONG_MIN QUAD_MIN |
|
# else |
|
# define LLONG_MIN (-0x7fffffffffffffffLL-1) |
|
# endif |
|
#endif |
|
|
|
#ifndef ULLONG_MAX |
|
# if defined(UQUAD_MAX) |
|
# define ULLONG_MAX UQUAD_MAX |
|
# else |
|
# define ULLONG_MAX 0xffffffffffffffffULL |
|
# endif |
|
#endif |
|
|
#ifndef PATH_MAX |
#ifndef PATH_MAX |
# ifdef _POSIX_PATH_MAX |
# ifdef _POSIX_PATH_MAX |
# define PATH_MAX _POSIX_PATH_MAX |
# define PATH_MAX _POSIX_PATH_MAX |
Line 179
|
Line 225
|
#define ISSET(t, f) ((t) & (f)) |
#define ISSET(t, f) ((t) & (f)) |
|
|
/* |
/* |
* Some systems define this in <sys/param.h> but we don't include that anymore. |
|
*/ |
|
#ifndef howmany |
|
# define howmany(x, y) (((x) + ((y) - 1)) / (y)) |
|
#endif |
|
|
|
/* |
|
* Older systems may be missing stddef.h and/or offsetof macro |
* Older systems may be missing stddef.h and/or offsetof macro |
*/ |
*/ |
#ifndef offsetof |
#ifndef offsetof |
Line 263 extern const char *__progname;
|
Line 302 extern const char *__progname;
|
# define getprogname() (__progname) |
# define getprogname() (__progname) |
# else |
# else |
const char *getprogname(void); |
const char *getprogname(void); |
void setprogname(const char *); |
|
# endif /* HAVE___PROGNAME */ |
# endif /* HAVE___PROGNAME */ |
#endif /* !HAVE_GETPROGNAME */ |
#endif /* !HAVE_GETPROGNAME */ |
|
|
Line 274 void setprogname(const char *);
|
Line 312 void setprogname(const char *);
|
extern int errno; |
extern int errno; |
#endif /* !HAVE_DECL_ERRNO */ |
#endif /* !HAVE_DECL_ERRNO */ |
|
|
#ifndef timevalclear |
|
# define timevalclear(tv) ((tv)->tv_sec = (tv)->tv_usec = 0) |
|
#endif |
|
#ifndef timevalisset |
|
# define timevalisset(tv) ((tv)->tv_sec || (tv)->tv_usec) |
|
#endif |
|
#ifndef timevalcmp |
|
# define timevalcmp(tv1, tv2, op) \ |
|
(((tv1)->tv_sec == (tv2)->tv_sec) ? \ |
|
((tv1)->tv_usec op (tv2)->tv_usec) : \ |
|
((tv1)->tv_sec op (tv2)->tv_sec)) |
|
#endif |
|
#ifndef timevaladd |
|
# define timevaladd(tv1, tv2) \ |
|
do { \ |
|
(tv1)->tv_sec += (tv2)->tv_sec; \ |
|
(tv1)->tv_usec += (tv2)->tv_usec; \ |
|
if ((tv1)->tv_usec >= 1000000) { \ |
|
(tv1)->tv_sec++; \ |
|
(tv1)->tv_usec -= 1000000; \ |
|
} \ |
|
} while (0) |
|
#endif |
|
#ifndef timevalsub |
|
# define timevalsub(tv1, tv2) \ |
|
do { \ |
|
(tv1)->tv_sec -= (tv2)->tv_sec; \ |
|
(tv1)->tv_usec -= (tv2)->tv_usec; \ |
|
if ((tv1)->tv_usec < 0) { \ |
|
(tv1)->tv_sec--; \ |
|
(tv1)->tv_usec += 1000000; \ |
|
} \ |
|
} while (0) |
|
#endif |
|
|
|
/* Not all systems define NSIG in signal.h */ |
/* Not all systems define NSIG in signal.h */ |
#if !defined(NSIG) |
#if !defined(NSIG) |
# if defined(_NSIG) |
# if defined(_NSIG) |
Line 375 int utimes(const char *, const struct timeval *);
|
Line 378 int utimes(const char *, const struct timeval *);
|
#ifdef HAVE_FUTIME |
#ifdef HAVE_FUTIME |
int futimes(int, const struct timeval *); |
int futimes(int, const struct timeval *); |
#endif |
#endif |
#ifndef HAVE_SNPRINTF | #if !defined(HAVE_SNPRINTF) || defined(PREFER_PORTABLE_SNPRINTF) |
int snprintf(char *, size_t, const char *, ...) __printflike(3, 4); | int rpl_snprintf(char *, size_t, const char *, ...) __printflike(3, 4); |
| # undef snprintf |
| # define snprintf rpl_snprintf |
#endif |
#endif |
#ifndef HAVE_VSNPRINTF | #if !defined(HAVE_VSNPRINTF) || defined(PREFER_PORTABLE_SNPRINTF) |
int vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0); | int rpl_vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0); |
| # undef vsnprintf |
| # define vsnprintf rpl_vsnprintf |
#endif |
#endif |
#ifndef HAVE_ASPRINTF | #if !defined(HAVE_ASPRINTF) || defined(PREFER_PORTABLE_SNPRINTF) |
int asprintf(char **, const char *, ...) __printflike(2, 3); | int rpl_asprintf(char **, const char *, ...) __printflike(2, 3); |
| # undef asprintf |
| # define asprintf rpl_asprintf |
#endif |
#endif |
#ifndef HAVE_VASPRINTF | #if !defined(HAVE_VASPRINTF) || defined(PREFER_PORTABLE_SNPRINTF) |
int vasprintf(char **, const char *, va_list) __printflike(2, 0); | int rpl_vasprintf(char **, const char *, va_list) __printflike(2, 0); |
| # undef vasprintf |
| # define vasprintf rpl_vasprintf |
#endif |
#endif |
#ifndef HAVE_STRLCAT |
#ifndef HAVE_STRLCAT |
size_t strlcat(char *, const char *, size_t); |
size_t strlcat(char *, const char *, size_t); |
Line 405 char *mkdtemp(char *);
|
Line 416 char *mkdtemp(char *);
|
#ifndef HAVE_MKSTEMPS |
#ifndef HAVE_MKSTEMPS |
int mkstemps(char *, int); |
int mkstemps(char *, int); |
#endif |
#endif |
#ifndef HAVE_NANOSLEEP |
|
int nanosleep(const struct timespec *, struct timespec *); |
|
#endif |
|
#ifndef HAVE_PW_DUP |
#ifndef HAVE_PW_DUP |
struct passwd *pw_dup(const struct passwd *); |
struct passwd *pw_dup(const struct passwd *); |
#endif |
#endif |
Line 422 char *strsignal(int);
|
Line 430 char *strsignal(int);
|
#endif |
#endif |
#ifndef HAVE_SIG2STR |
#ifndef HAVE_SIG2STR |
int sig2str(int, char *); |
int sig2str(int, char *); |
|
#endif |
|
#ifndef HAVE_STRTONUM |
|
long long rpl_strtonum(const char *, long long, long long, const char **); |
|
# undef strtonum |
|
# define strtonum rpl_strtonum |
|
#endif |
|
#ifndef HAVE_CLOCK_GETTIME |
|
# define CLOCK_REALTIME 0 |
|
# ifdef __MACH__ |
|
# define CLOCK_MONOTONIC 1 |
|
# endif |
|
int clock_gettime(clockid_t clock_id, struct timespec *tp); |
|
#endif |
|
#ifndef HAVE_INET_PTON |
|
int inet_pton(int af, const char *src, void *dst); |
#endif |
#endif |
|
|
#endif /* _SUDO_MISSING_H */ |
#endif /* _SUDO_MISSING_H */ |