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);
79 #endif /* STDC_HEADERS */
81 /* XXX solaris2.5.1 has not */
82 #if !defined(EXIT_FAILURE)
83 #define EXIT_FAILURE 1
92 #if !defined(SEEK_SET)
106 # define NLENGTH(direct) (strlen((direct)->d_name))
107 #else /* not HAVE_DIRENT_H */
108 # define dirent direct
109 # define NLENGTH(direct) ((direct)->d_namlen)
110 # ifdef HAVE_SYS_NDIR_H
111 # include <sys/ndir.h>
112 # endif /* HAVE_SYS_NDIR_H */
113 # ifdef HAVE_SYS_DIR_H
114 # include <sys/dir.h>
115 # endif /* HAVE_SYS_DIR_H */
118 # endif /* HAVE_NDIR_H */
119 #endif /* HAVE_DIRENT_H */
124 #include <sys/mman.h>
128 #include <sys/wait.h>
136 #ifdef _POSIX_PATH_MAX
137 #define PATH_MAX _POSIX_PATH_MAX
138 #elif defined MAXPATHLEN
139 #define PATH_MAX MAXPATHLEN
146 #include <selinux/selinux.h>
148 typedef char * security_context_t;
152 #define getfilecon(_fn, _c) (-1)
153 #define lgetfilecon(_fn, _c) (-1)
154 #define fgetfilecon(_fd, _c) (-1)
156 #define setfilecon(_fn, _c) (-1)
157 #define lsetfilecon(_fn, _c) (-1)
158 #define fsetfilecon(_fd, _c) (-1)
160 #define security_check_context(_c) (0)
162 #define is_selinux_enabled() (0)
164 #define matchpathcon_init(_fn) (-1)
165 #define matchpathcon_fini() (0)
166 #define matchpathcon(_fn, _fm, _c) (-1)
168 #define rpm_execcon(_v, _fn, _av, _envp) (0)
172 #include <sys/capability.h>
174 typedef void * cap_t;
178 #include <acl/libacl.h>
183 #endif /* HAVE_MCHECK_H */
185 #include "rpmio/rpmutil.h"
186 /* compatibility macros to avoid a mass-renaming all over the codebase */
187 #define xmalloc(_size) rmalloc((_size))
188 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
189 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
190 #define xstrdup(_str) rstrdup((_str))
191 #define _free(_ptr) rfree((_ptr))
193 /* Retrofit glibc __progname */
194 #if defined __GLIBC__ && __GLIBC__ >= 2
195 #if __GLIBC_MINOR__ >= 1
196 #define __progname __assert_program_name
198 #define setprogname(pn)
200 #define __progname program_name
201 #define setprogname(pn) \
202 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
203 else __progname = pn; \
206 extern const char *__progname;
212 /* Take care of NLS matters. */
218 # define setlocale(Category, Locale) /* empty */
222 # include <libintl.h>
223 # define _(Text) dgettext (PACKAGE, Text)
225 # undef bindtextdomain
226 # define bindtextdomain(Domain, Directory) /* empty */
228 # define textdomain(Domain) /* empty */
229 # define _(Text) Text
231 # define dgettext(DomainName, Text) Text
234 #define N_(Text) Text
236 /* ============== from misc/miscfn.h */
238 #if !defined(USE_GNU_GLOB)
247 #include "misc/glob.h"
248 #include "misc/fnmatch.h"
255 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
256 # define GETMNTENT_ONE 0
257 # define GETMNTENT_TWO 0
258 # if HAVE_SYS_MNTCTL_H
259 # include <sys/mntctl.h>
261 # if HAVE_SYS_VMOUNT_H
262 # include <sys/vmount.h>
264 # if HAVE_SYS_MOUNT_H
265 # include <sys/mount.h>
267 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
271 # define our_mntent struct mntent
272 # define our_mntdir mnt_dir
273 # elif HAVE_STRUCT_MNTTAB
279 struct our_mntent *getmntent(FILE *filep);
280 # define our_mntent struct our_mntent
286 struct our_mntent *getmntent(FILE *filep);
287 # define our_mntent struct our_mntent
289 # define GETMNTENT_ONE 1
290 # define GETMNTENT_TWO 0
291 #elif HAVE_SYS_MNTTAB_H
293 # include <sys/mnttab.h>
294 # define GETMNTENT_ONE 0
295 # define GETMNTENT_TWO 1
296 # define our_mntent struct mnttab
297 # define our_mntdir mnt_mountp
298 #else /* if !HAVE_MNTCTL */
299 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
303 #define MOUNTED "/etc/mnttab"
306 #endif /* H_SYSTEM */