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>
51 # if !STDC_HEADERS && HAVE_MEMORY_H
59 #if !defined(HAVE_STPCPY)
60 char * stpcpy(char * dest, const char * src);
63 #if !defined(HAVE_STPNCPY)
64 char * stpncpy(char * dest, const char * src, size_t n);
72 #if HAVE___SECURE_GETENV
73 #define getenv(_s) __secure_getenv(_s)
78 #define getopt system_getopt
81 #else /* not STDC_HEADERS */
82 char *getenv (const char *name);
84 char *realpath(const char *path, char resolved_path []);
86 #endif /* STDC_HEADERS */
88 /* XXX solaris2.5.1 has not */
89 #if !defined(EXIT_FAILURE)
90 #define EXIT_FAILURE 1
99 #if !defined(SEEK_SET)
113 # define NLENGTH(direct) (strlen((direct)->d_name))
114 #else /* not HAVE_DIRENT_H */
115 # define dirent direct
116 # define NLENGTH(direct) ((direct)->d_namlen)
117 # ifdef HAVE_SYS_NDIR_H
118 # include <sys/ndir.h>
119 # endif /* HAVE_SYS_NDIR_H */
120 # ifdef HAVE_SYS_DIR_H
121 # include <sys/dir.h>
122 # endif /* HAVE_SYS_DIR_H */
125 # endif /* HAVE_NDIR_H */
126 #endif /* HAVE_DIRENT_H */
131 #include <sys/mman.h>
135 #include <sys/wait.h>
143 #ifdef _POSIX_PATH_MAX
144 #define PATH_MAX _POSIX_PATH_MAX
145 #elif defined MAXPATHLEN
146 #define PATH_MAX MAXPATHLEN
153 #include <selinux/selinux.h>
155 typedef char * security_context_t;
159 #define getfilecon(_fn, _c) (-1)
160 #define lgetfilecon(_fn, _c) (-1)
161 #define fgetfilecon(_fd, _c) (-1)
163 #define setfilecon(_fn, _c) (-1)
164 #define lsetfilecon(_fn, _c) (-1)
165 #define fsetfilecon(_fd, _c) (-1)
167 #define security_check_context(_c) (0)
169 #define is_selinux_enabled() (0)
171 #define matchpathcon_init(_fn) (-1)
172 #define matchpathcon_fini() (0)
173 #define matchpathcon(_fn, _fm, _c) (-1)
175 #define rpm_execcon(_v, _fn, _av, _envp) (0)
179 #include <sys/capability.h>
181 typedef void * cap_t;
185 #include <acl/libacl.h>
190 #endif /* HAVE_MCHECK_H */
192 #include "rpmio/rpmutil.h"
193 /* compatibility macros to avoid a mass-renaming all over the codebase */
194 #define xmalloc(_size) rmalloc((_size))
195 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
196 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
197 #define xstrdup(_str) rstrdup((_str))
198 #define _free(_ptr) rfree((_ptr))
200 /* Retrofit glibc __progname */
201 #if defined __GLIBC__ && __GLIBC__ >= 2
202 #if __GLIBC_MINOR__ >= 1
203 #define __progname __assert_program_name
205 #define setprogname(pn)
207 #define __progname program_name
208 #define setprogname(pn) \
209 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
210 else __progname = pn; \
213 extern const char *__progname;
219 /* Take care of NLS matters. */
225 # define setlocale(Category, Locale) /* empty */
229 # include <libintl.h>
230 # define _(Text) dgettext (PACKAGE, Text)
232 # undef bindtextdomain
233 # define bindtextdomain(Domain, Directory) /* empty */
235 # define textdomain(Domain) /* empty */
236 # define _(Text) Text
238 # define dgettext(DomainName, Text) Text
241 #define N_(Text) Text
243 /* ============== from misc/miscfn.h */
245 #if !defined(USE_GNU_GLOB)
254 #include "misc/glob.h"
255 #include "misc/fnmatch.h"
259 #define S_IFSOCK (0xc000)
263 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
267 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
275 extern int setenv(const char *name, const char *value, int replace);
276 extern void unsetenv(const char *name);
282 #if HAVE_SYS_SELECT_H
283 #include <sys/select.h>
291 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
292 # define GETMNTENT_ONE 0
293 # define GETMNTENT_TWO 0
294 # if HAVE_SYS_MNTCTL_H
295 # include <sys/mntctl.h>
297 # if HAVE_SYS_VMOUNT_H
298 # include <sys/vmount.h>
300 # if HAVE_SYS_MOUNT_H
301 # include <sys/mount.h>
303 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
307 # define our_mntent struct mntent
308 # define our_mntdir mnt_dir
309 # elif HAVE_STRUCT_MNTTAB
315 struct our_mntent *getmntent(FILE *filep);
316 # define our_mntent struct our_mntent
322 struct our_mntent *getmntent(FILE *filep);
323 # define our_mntent struct our_mntent
325 # define GETMNTENT_ONE 1
326 # define GETMNTENT_TWO 0
327 #elif HAVE_SYS_MNTTAB_H
329 # include <sys/mnttab.h>
330 # define GETMNTENT_ONE 0
331 # define GETMNTENT_TWO 1
332 # define our_mntent struct mnttab
333 # define our_mntdir mnt_mountp
334 #else /* if !HAVE_MNTCTL */
335 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
339 #define MOUNTED "/etc/mnttab"
342 #endif /* H_SYSTEM */