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
81 #if !defined(SEEK_SET)
95 # define NLENGTH(direct) (strlen((direct)->d_name))
96 #else /* not HAVE_DIRENT_H */
97 # define dirent direct
98 # define NLENGTH(direct) ((direct)->d_namlen)
99 # ifdef HAVE_SYS_NDIR_H
100 # include <sys/ndir.h>
101 # endif /* HAVE_SYS_NDIR_H */
102 # ifdef HAVE_SYS_DIR_H
103 # include <sys/dir.h>
104 # endif /* HAVE_SYS_DIR_H */
107 # endif /* HAVE_NDIR_H */
108 #endif /* HAVE_DIRENT_H */
113 #include <sys/mman.h>
117 #include <sys/wait.h>
125 #ifdef _POSIX_PATH_MAX
126 #define PATH_MAX _POSIX_PATH_MAX
127 #elif defined MAXPATHLEN
128 #define PATH_MAX MAXPATHLEN
135 #include <selinux/selinux.h>
137 typedef char * security_context_t;
141 #define getfilecon(_fn, _c) (-1)
142 #define lgetfilecon(_fn, _c) (-1)
143 #define fgetfilecon(_fd, _c) (-1)
145 #define setfilecon(_fn, _c) (-1)
146 #define lsetfilecon(_fn, _c) (-1)
147 #define fsetfilecon(_fd, _c) (-1)
149 #define security_check_context(_c) (0)
151 #define is_selinux_enabled() (0)
153 #define matchpathcon_init(_fn) (-1)
154 #define matchpathcon_fini() (0)
155 #define matchpathcon(_fn, _fm, _c) (-1)
157 #define rpm_execcon(_v, _fn, _av, _envp) (0)
161 #include <sys/capability.h>
163 typedef void * cap_t;
167 #include <acl/libacl.h>
172 #endif /* HAVE_MCHECK_H */
174 #include "rpmio/rpmutil.h"
175 /* compatibility macros to avoid a mass-renaming all over the codebase */
176 #define xmalloc(_size) rmalloc((_size))
177 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
178 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
179 #define xstrdup(_str) rstrdup((_str))
180 #define _free(_ptr) rfree((_ptr))
182 /* Retrofit glibc __progname */
183 #if defined __GLIBC__ && __GLIBC__ >= 2
184 #if __GLIBC_MINOR__ >= 1
185 #define __progname __assert_program_name
187 #define setprogname(pn)
189 #define __progname program_name
190 #define setprogname(pn) \
191 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
192 else __progname = pn; \
195 extern const char *__progname;
197 /* Take care of NLS matters. */
203 # define setlocale(Category, Locale) /* empty */
207 # include <libintl.h>
208 # define _(Text) dgettext (PACKAGE, Text)
210 # undef bindtextdomain
211 # define bindtextdomain(Domain, Directory) /* empty */
213 # define textdomain(Domain) /* empty */
214 # define _(Text) Text
216 # define dgettext(DomainName, Text) Text
219 #define N_(Text) Text
221 /* ============== from misc/miscfn.h */
223 #if !defined(USE_GNU_GLOB)
232 #include "misc/glob.h"
233 #include "misc/fnmatch.h"
240 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
241 # define GETMNTENT_ONE 0
242 # define GETMNTENT_TWO 0
243 # if HAVE_SYS_MNTCTL_H
244 # include <sys/mntctl.h>
246 # if HAVE_SYS_VMOUNT_H
247 # include <sys/vmount.h>
249 # if HAVE_SYS_MOUNT_H
250 # include <sys/mount.h>
252 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
256 # define our_mntent struct mntent
257 # define our_mntdir mnt_dir
258 # elif HAVE_STRUCT_MNTTAB
264 struct our_mntent *getmntent(FILE *filep);
265 # define our_mntent struct our_mntent
271 struct our_mntent *getmntent(FILE *filep);
272 # define our_mntent struct our_mntent
274 # define GETMNTENT_ONE 1
275 # define GETMNTENT_TWO 0
276 #elif HAVE_SYS_MNTTAB_H
278 # include <sys/mnttab.h>
279 # define GETMNTENT_ONE 0
280 # define GETMNTENT_TWO 1
281 # define our_mntent struct mnttab
282 # define our_mntdir mnt_mountp
283 #else /* if !HAVE_MNTCTL */
284 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
288 #define MOUNTED "/etc/mnttab"
291 #endif /* H_SYSTEM */