version 1.1.1.1, 2012/02/21 16:23:02
|
version 1.1.1.4, 2013/07/22 10:46:12
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 1996, 1998-2005, 2008, 2009-2010 | * Copyright (c) 1996, 1998-2005, 2008, 2009-2013 |
* 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 29
|
Line 29
|
* Macros and functions that may be missing on some operating systems. |
* Macros and functions that may be missing on some operating systems. |
*/ |
*/ |
|
|
/* Define away __attribute__ for non-gcc or old gcc */ | #ifndef __GNUC_PREREQ__ |
#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 | # ifdef __GNUC__ |
# define __attribute__(x) | # define __GNUC_PREREQ__(ma, mi) \ |
#endif | ((__GNUC__ > (ma)) || (__GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))) |
| |
/* For silencing gcc warnings about rcsids */ | |
#ifndef __unused | |
# if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 7) | |
# define __unused __attribute__((__unused__)) | |
# else |
# else |
# define __unused | # define __GNUC_PREREQ__(ma, mi) 0 |
# endif |
# endif |
#endif |
#endif |
|
|
|
/* Define away __attribute__ for non-gcc or old gcc */ |
|
#if !defined(__attribute__) && !__GNUC_PREREQ__(2, 5) |
|
# define __attribute__(x) |
|
#endif |
|
|
/* For catching format string mismatches */ |
/* For catching format string mismatches */ |
#ifndef __printflike |
#ifndef __printflike |
# if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7) | # if __GNUC_PREREQ__(2, 7) |
# define __printflike(f, v) __attribute__((__format__ (__printf__, f, v))) |
# define __printflike(f, v) __attribute__((__format__ (__printf__, f, v))) |
# else |
# else |
# define __printflike(f, v) |
# define __printflike(f, v) |
# endif |
# endif |
#endif |
#endif |
|
|
|
/* Hint to compiler that returned pointer is unique (malloc but not realloc). */ |
|
#ifndef __malloc_like |
|
# if __GNUC_PREREQ__(2, 96) |
|
# define __malloc_like __attribute__((__malloc__)) |
|
# else |
|
# define __malloc_like |
|
# endif |
|
#endif |
|
|
|
#ifndef __dso_public |
|
# ifdef HAVE_DSO_VISIBILITY |
|
# if defined(__GNUC__) |
|
# define __dso_public __attribute__((__visibility__("default"))) |
|
# define __dso_hidden __attribute__((__visibility__("hidden"))) |
|
# elif defined(__SUNPRO_C) |
|
# define __dso_public __global |
|
# define __dso_hidden __hidden |
|
# else |
|
# define __dso_public __declspec(dllexport) |
|
# define __dso_hidden |
|
# endif |
|
# else |
|
# define __dso_public |
|
# define __dso_hidden |
|
# endif |
|
#endif |
|
|
/* |
/* |
* Some systems lack full limit definitions. |
* Some systems lack full limit definitions. |
*/ |
*/ |
Line 64
|
Line 91
|
#endif |
#endif |
|
|
#ifndef PATH_MAX |
#ifndef PATH_MAX |
# ifdef MAXPATHLEN | # ifdef _POSIX_PATH_MAX |
# define PATH_MAX MAXPATHLEN | # define PATH_MAX _POSIX_PATH_MAX |
# else |
# else |
# ifdef _POSIX_PATH_MAX | # define PATH_MAX 256 |
# define PATH_MAX _POSIX_PATH_MAX | |
# else | |
# define PATH_MAX 1024 | |
# endif | |
# endif |
# endif |
#endif |
#endif |
|
|
#ifndef MAXHOSTNAMELEN | #ifndef HOST_NAME_MAX |
# define MAXHOSTNAMELEN 64 | # ifdef _POSIX_HOST_NAME_MAX |
| # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX |
| # else |
| # define HOST_NAME_MAX 255 |
| # endif |
#endif |
#endif |
|
|
/* |
/* |
Line 122
|
Line 149
|
#endif |
#endif |
|
|
/* |
/* |
* BSD defines these in <sys/param.h> but others may not. | * BSD defines these in <sys/param.h> but we don't include that anymore. |
*/ |
*/ |
#ifndef MIN |
#ifndef MIN |
# define MIN(a,b) (((a)<(b))?(a):(b)) |
# define MIN(a,b) (((a)<(b))?(a):(b)) |
Line 131
|
Line 158
|
# define MAX(a,b) (((a)>(b))?(a):(b)) |
# define MAX(a,b) (((a)>(b))?(a):(b)) |
#endif |
#endif |
|
|
|
/* Macros to set/clear/test flags. */ |
|
#undef SET |
|
#define SET(t, f) ((t) |= (f)) |
|
#undef CLR |
|
#define CLR(t, f) ((t) &= ~(f)) |
|
#undef ISSET |
|
#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 |
|
*/ |
|
#ifndef offsetof |
|
# ifdef __offsetof |
|
# define offsetof(type, field) __offsetof(type, field) |
|
# else |
|
# define offsetof(type, field) ((size_t)(&((type *)0)->field)) |
|
# endif |
|
#endif |
|
|
|
/* |
* Simple isblank() macro and function for systems without it. |
* Simple isblank() macro and function for systems without it. |
*/ |
*/ |
#ifndef HAVE_ISBLANK |
#ifndef HAVE_ISBLANK |
Line 195 typedef struct sigaction sigaction_t;
|
Line 248 typedef struct sigaction sigaction_t;
|
#ifndef HAVE_GETPROGNAME |
#ifndef HAVE_GETPROGNAME |
# ifdef HAVE___PROGNAME |
# ifdef HAVE___PROGNAME |
extern const char *__progname; |
extern const char *__progname; |
# define getprogname() (__progname) | # define getprogname() (__progname) |
# else |
# else |
const char *getprogname(void); |
const char *getprogname(void); |
void setprogname(const char *); |
void setprogname(const char *); |
#endif /* HAVE___PROGNAME */ | # endif /* HAVE___PROGNAME */ |
#endif /* !HAVE_GETPROGNAME */ |
#endif /* !HAVE_GETPROGNAME */ |
|
|
/* |
/* |
Line 255 extern int errno;
|
Line 308 extern int errno;
|
# endif |
# endif |
#endif |
#endif |
|
|
|
/* For sig2str() */ |
|
#ifndef SIG2STR_MAX |
|
# define SIG2STR_MAX 32 |
|
#endif |
|
|
#ifndef WCOREDUMP |
#ifndef WCOREDUMP |
# define WCOREDUMP(x) ((x) & 0x80) |
# define WCOREDUMP(x) ((x) & 0x80) |
#endif |
#endif |
Line 335 int mkstemps(char *, int);
|
Line 393 int mkstemps(char *, int);
|
#ifndef HAVE_NANOSLEEP |
#ifndef HAVE_NANOSLEEP |
int nanosleep(const struct timespec *, struct timespec *); |
int nanosleep(const struct timespec *, struct timespec *); |
#endif |
#endif |
|
#ifndef HAVE_PW_DUP |
|
struct passwd *pw_dup(const struct passwd *); |
|
#endif |
#ifndef HAVE_SETENV |
#ifndef HAVE_SETENV |
int setenv(const char *, const char *, int); |
int setenv(const char *, const char *, int); |
#endif |
#endif |
Line 343 int unsetenv(const char *);
|
Line 404 int unsetenv(const char *);
|
#endif |
#endif |
#ifndef HAVE_STRSIGNAL |
#ifndef HAVE_STRSIGNAL |
char *strsignal(int); |
char *strsignal(int); |
|
#endif |
|
#ifndef HAVE_SIG2STR |
|
int sig2str(int, char *); |
#endif |
#endif |
|
|
#endif /* _SUDO_MISSING_H */ |
#endif /* _SUDO_MISSING_H */ |