12 #include <sys/types.h>
17 #ifdef HAVE_SYS_PARAM_H
18 #include <sys/param.h>
21 /* <unistd.h> should be included before any preprocessor test
25 #if !defined(__GLIBC__)
27 #include <crt_externs.h>
28 #define environ (*_NSGetEnviron())
30 extern char ** environ;
31 #endif /* __APPLE__ */
35 #if TIME_WITH_SYS_TIME
36 # include <sys/time.h>
40 # include <sys/time.h>
47 # if !STDC_HEADERS && HAVE_MEMORY_H
55 #if !defined(HAVE_STPCPY)
56 char * stpcpy(char * dest, const char * src);
59 #if !defined(HAVE_STPNCPY)
60 char * stpncpy(char * dest, const char * src, size_t n);
68 #if HAVE___SECURE_GETENV
69 #define getenv(_s) __secure_getenv(_s)
74 #define getopt system_getopt
77 #else /* not STDC_HEADERS */
78 char *getenv (const char *name);
80 char *realpath(const char *path, char resolved_path []);
82 #endif /* STDC_HEADERS */
84 /* XXX solaris2.5.1 has not */
85 #if !defined(EXIT_FAILURE)
86 #define EXIT_FAILURE 1
95 #if !defined(SEEK_SET)
109 # define NLENGTH(direct) (strlen((direct)->d_name))
110 #else /* not HAVE_DIRENT_H */
111 # define dirent direct
112 # define NLENGTH(direct) ((direct)->d_namlen)
113 # ifdef HAVE_SYS_NDIR_H
114 # include <sys/ndir.h>
115 # endif /* HAVE_SYS_NDIR_H */
116 # ifdef HAVE_SYS_DIR_H
117 # include <sys/dir.h>
118 # endif /* HAVE_SYS_DIR_H */
121 # endif /* HAVE_NDIR_H */
122 #endif /* HAVE_DIRENT_H */
127 #include <sys/mman.h>
131 #include <sys/wait.h>
139 #ifdef _POSIX_PATH_MAX
140 #define PATH_MAX _POSIX_PATH_MAX
141 #elif defined MAXPATHLEN
142 #define PATH_MAX MAXPATHLEN
149 #include <selinux/selinux.h>
151 typedef char * security_context_t;
155 #define getfilecon(_fn, _c) (-1)
156 #define lgetfilecon(_fn, _c) (-1)
157 #define fgetfilecon(_fd, _c) (-1)
159 #define setfilecon(_fn, _c) (-1)
160 #define lsetfilecon(_fn, _c) (-1)
161 #define fsetfilecon(_fd, _c) (-1)
163 #define security_check_context(_c) (0)
165 #define is_selinux_enabled() (0)
167 #define matchpathcon_init(_fn) (-1)
168 #define matchpathcon_fini() (0)
169 #define matchpathcon(_fn, _fm, _c) (-1)
171 #define rpm_execcon(_v, _fn, _av, _envp) (0)
175 #include <sys/capability.h>
177 typedef void * cap_t;
181 #include <acl/libacl.h>
186 #endif /* HAVE_MCHECK_H */
188 #include "rpmio/rpmutil.h"
189 /* compatibility macros to avoid a mass-renaming all over the codebase */
190 #define xmalloc(_size) rmalloc((_size))
191 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
192 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
193 #define xstrdup(_str) rstrdup((_str))
194 #define _free(_ptr) rfree((_ptr))
196 /* Retrofit glibc __progname */
197 #if defined __GLIBC__ && __GLIBC__ >= 2
198 #if __GLIBC_MINOR__ >= 1
199 #define __progname __assert_program_name
201 #define setprogname(pn)
203 #define __progname program_name
204 #define setprogname(pn) \
205 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
206 else __progname = pn; \
209 extern const char *__progname;
215 /* Take care of NLS matters. */
221 # define setlocale(Category, Locale) /* empty */
225 # include <libintl.h>
226 # define _(Text) dgettext (PACKAGE, Text)
228 # undef bindtextdomain
229 # define bindtextdomain(Domain, Directory) /* empty */
231 # define textdomain(Domain) /* empty */
232 # define _(Text) Text
234 # define dgettext(DomainName, Text) Text
237 #define N_(Text) Text
239 /* ============== from misc/miscfn.h */
241 #if !defined(USE_GNU_GLOB)
250 #include "misc/glob.h"
251 #include "misc/fnmatch.h"
255 #define S_IFSOCK (0xc000)
259 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
263 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
273 #if HAVE_SYS_SELECT_H
274 #include <sys/select.h>
282 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
283 # define GETMNTENT_ONE 0
284 # define GETMNTENT_TWO 0
285 # if HAVE_SYS_MNTCTL_H
286 # include <sys/mntctl.h>
288 # if HAVE_SYS_VMOUNT_H
289 # include <sys/vmount.h>
291 # if HAVE_SYS_MOUNT_H
292 # include <sys/mount.h>
294 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
298 # define our_mntent struct mntent
299 # define our_mntdir mnt_dir
300 # elif HAVE_STRUCT_MNTTAB
306 struct our_mntent *getmntent(FILE *filep);
307 # define our_mntent struct our_mntent
313 struct our_mntent *getmntent(FILE *filep);
314 # define our_mntent struct our_mntent
316 # define GETMNTENT_ONE 1
317 # define GETMNTENT_TWO 0
318 #elif HAVE_SYS_MNTTAB_H
320 # include <sys/mnttab.h>
321 # define GETMNTENT_ONE 0
322 # define GETMNTENT_TWO 1
323 # define our_mntent struct mnttab
324 # define our_mntdir mnt_mountp
325 #else /* if !HAVE_MNTCTL */
326 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
330 #define MOUNTED "/etc/mnttab"
333 #endif /* H_SYSTEM */