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__ */
36 # if !STDC_HEADERS && HAVE_MEMORY_H
44 #if !defined(HAVE_STPCPY)
45 char * stpcpy(char * dest, const char * src);
48 #if !defined(HAVE_STPNCPY)
49 char * stpncpy(char * dest, const char * src, size_t n);
57 #if HAVE___SECURE_GETENV
58 #define getenv(_s) __secure_getenv(_s)
63 #define getopt system_getopt
66 #else /* not STDC_HEADERS */
67 char *getenv (const char *name);
68 #endif /* STDC_HEADERS */
70 /* XXX solaris2.5.1 has not */
71 #if !defined(EXIT_FAILURE)
72 #define EXIT_FAILURE 1
83 # define NLENGTH(direct) (strlen((direct)->d_name))
84 #else /* not HAVE_DIRENT_H */
85 # define dirent direct
86 # define NLENGTH(direct) ((direct)->d_namlen)
87 # ifdef HAVE_SYS_NDIR_H
88 # include <sys/ndir.h>
89 # endif /* HAVE_SYS_NDIR_H */
90 # ifdef HAVE_SYS_DIR_H
92 # endif /* HAVE_SYS_DIR_H */
95 # endif /* HAVE_NDIR_H */
96 #endif /* HAVE_DIRENT_H */
101 #include <sys/mman.h>
105 #include <sys/wait.h>
113 #ifdef _POSIX_PATH_MAX
114 #define PATH_MAX _POSIX_PATH_MAX
115 #elif defined MAXPATHLEN
116 #define PATH_MAX MAXPATHLEN
123 #include <selinux/selinux.h>
125 typedef char * security_context_t;
129 #define getfilecon(_fn, _c) (-1)
130 #define lgetfilecon(_fn, _c) (-1)
131 #define fgetfilecon(_fd, _c) (-1)
133 #define setfilecon(_fn, _c) (-1)
134 #define lsetfilecon(_fn, _c) (-1)
135 #define fsetfilecon(_fd, _c) (-1)
137 #define security_check_context(_c) (0)
139 #define is_selinux_enabled() (0)
141 #define matchpathcon_init(_fn) (-1)
142 #define matchpathcon_fini() (0)
143 #define matchpathcon(_fn, _fm, _c) (-1)
145 #define rpm_execcon(_v, _fn, _av, _envp) (0)
149 #include <sys/capability.h>
151 typedef void * cap_t;
155 #include <acl/libacl.h>
160 #endif /* HAVE_MCHECK_H */
162 #include "rpmio/rpmutil.h"
163 /* compatibility macros to avoid a mass-renaming all over the codebase */
164 #define xmalloc(_size) rmalloc((_size))
165 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
166 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
167 #define xstrdup(_str) rstrdup((_str))
168 #define _free(_ptr) rfree((_ptr))
170 /* Retrofit glibc __progname */
171 #if defined __GLIBC__ && __GLIBC__ >= 2
172 #if __GLIBC_MINOR__ >= 1
173 #define __progname __assert_program_name
175 #define setprogname(pn)
177 #define __progname program_name
178 #define setprogname(pn) \
179 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
180 else __progname = pn; \
183 extern const char *__progname;
185 /* Take care of NLS matters. */
191 # define setlocale(Category, Locale) /* empty */
195 # include <libintl.h>
196 # define _(Text) dgettext (PACKAGE, Text)
198 # undef bindtextdomain
199 # define bindtextdomain(Domain, Directory) /* empty */
201 # define textdomain(Domain) /* empty */
202 # define _(Text) Text
204 # define dgettext(DomainName, Text) Text
207 #define N_(Text) Text
209 /* ============== from misc/miscfn.h */
211 #if !defined(USE_GNU_GLOB)
220 #include "misc/glob.h"
221 #include "misc/fnmatch.h"
228 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
229 # define GETMNTENT_ONE 0
230 # define GETMNTENT_TWO 0
231 # if HAVE_SYS_MNTCTL_H
232 # include <sys/mntctl.h>
234 # if HAVE_SYS_VMOUNT_H
235 # include <sys/vmount.h>
237 # if HAVE_SYS_MOUNT_H
238 # include <sys/mount.h>
240 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
244 # define our_mntent struct mntent
245 # define our_mntdir mnt_dir
246 # elif HAVE_STRUCT_MNTTAB
252 struct our_mntent *getmntent(FILE *filep);
253 # define our_mntent struct our_mntent
259 struct our_mntent *getmntent(FILE *filep);
260 # define our_mntent struct our_mntent
262 # define GETMNTENT_ONE 1
263 # define GETMNTENT_TWO 0
264 #elif HAVE_SYS_MNTTAB_H
266 # include <sys/mnttab.h>
267 # define GETMNTENT_ONE 0
268 # define GETMNTENT_TWO 1
269 # define our_mntent struct mnttab
270 # define our_mntdir mnt_mountp
271 #else /* if !HAVE_MNTCTL */
272 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
276 #define MOUNTED "/etc/mnttab"
279 #endif /* H_SYSTEM */