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>
46 /* Since major is a function on SVR4, we can't use `ifndef major'. */
48 #include <sys/mkdev.h>
51 #if MAJOR_IN_SYSMACROS
52 #include <sys/sysmacros.h>
55 #ifdef major /* Might be defined in sys/types.h. */
60 #define major(dev) (((dev) >> 8) & 0xff)
61 #define minor(dev) ((dev) & 0xff)
62 #define makedev(maj, min) (((maj) << 8) | (min))
71 # if !STDC_HEADERS && HAVE_MEMORY_H
79 #if !defined(HAVE_STPCPY)
80 char * stpcpy(char * dest, const char * src);
83 #if !defined(HAVE_STPNCPY)
84 char * stpncpy(char * dest, const char * src, size_t n);
96 #if HAVE___SECURE_GETENV
97 #define getenv(_s) __secure_getenv(_s)
102 #define getopt system_getopt
105 #else /* not STDC_HEADERS */
106 char *getenv (const char *name);
108 char *realpath(const char *path, char resolved_path []);
110 #endif /* STDC_HEADERS */
112 /* XXX solaris2.5.1 has not */
113 #if !defined(EXIT_FAILURE)
114 #define EXIT_FAILURE 1
120 #include <sys/file.h>
123 #if !defined(SEEK_SET)
137 # define NLENGTH(direct) (strlen((direct)->d_name))
138 #else /* not HAVE_DIRENT_H */
139 # define dirent direct
140 # define NLENGTH(direct) ((direct)->d_namlen)
141 # ifdef HAVE_SYS_NDIR_H
142 # include <sys/ndir.h>
143 # endif /* HAVE_SYS_NDIR_H */
144 # ifdef HAVE_SYS_DIR_H
145 # include <sys/dir.h>
146 # endif /* HAVE_SYS_DIR_H */
149 # endif /* HAVE_NDIR_H */
150 #endif /* HAVE_DIRENT_H */
155 #include <sys/mman.h>
158 #if HAVE_SYS_UTSNAME_H
159 #include <sys/utsname.h>
163 #include <sys/wait.h>
179 #ifdef _POSIX_PATH_MAX
180 #define PATH_MAX _POSIX_PATH_MAX
181 #elif defined MAXPATHLEN
182 #define PATH_MAX MAXPATHLEN
193 #include <selinux/selinux.h>
195 typedef char * security_context_t;
199 #define getfilecon(_fn, _c) (-1)
200 #define lgetfilecon(_fn, _c) (-1)
201 #define fgetfilecon(_fd, _c) (-1)
203 #define setfilecon(_fn, _c) (-1)
204 #define lsetfilecon(_fn, _c) (-1)
205 #define fsetfilecon(_fd, _c) (-1)
207 #define security_check_context(_c) (0)
209 #define is_selinux_enabled() (0)
211 #define matchpathcon_init(_fn) (-1)
212 #define matchpathcon_fini() (0)
213 #define matchpathcon(_fn, _fm, _c) (-1)
215 #define rpm_execcon(_v, _fn, _av, _envp) (0)
219 #include <sys/capability.h>
221 typedef void * cap_t;
225 #include <acl/libacl.h>
230 #endif /* HAVE_MCHECK_H */
232 #include "rpmio/rpmutil.h"
233 /* compatibility macros to avoid a mass-renaming all over the codebase */
234 #define xmalloc(_size) rmalloc((_size))
235 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
236 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
237 #define xstrdup(_str) rstrdup((_str))
238 #define _free(_ptr) rfree((_ptr))
240 /* Retrofit glibc __progname */
241 #if defined __GLIBC__ && __GLIBC__ >= 2
242 #if __GLIBC_MINOR__ >= 1
243 #define __progname __assert_program_name
245 #define setprogname(pn)
247 #define __progname program_name
248 #define setprogname(pn) \
249 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
250 else __progname = pn; \
253 extern const char *__progname;
263 /* Take care of NLS matters. */
269 # define setlocale(Category, Locale) /* empty */
273 # include <libintl.h>
274 # define _(Text) dgettext (PACKAGE, Text)
276 # undef bindtextdomain
277 # define bindtextdomain(Domain, Directory) /* empty */
279 # define textdomain(Domain) /* empty */
280 # define _(Text) Text
282 # define dgettext(DomainName, Text) Text
285 #define N_(Text) Text
287 /* ============== from misc/miscfn.h */
289 #if !defined(USE_GNU_GLOB)
298 #include "misc/glob.h"
299 #include "misc/fnmatch.h"
303 #define S_IFSOCK (0xc000)
307 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
311 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
319 extern int setenv(const char *name, const char *value, int replace);
320 extern void unsetenv(const char *name);
323 #if HAVE_SYS_SOCKET_H
324 #include <sys/types.h>
325 #include <sys/socket.h>
331 #if HAVE_SYS_SELECT_H
332 #include <sys/select.h>
340 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
341 # define GETMNTENT_ONE 0
342 # define GETMNTENT_TWO 0
343 # if HAVE_SYS_MNTCTL_H
344 # include <sys/mntctl.h>
346 # if HAVE_SYS_VMOUNT_H
347 # include <sys/vmount.h>
349 # if HAVE_SYS_MOUNT_H
350 # include <sys/mount.h>
352 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
356 # define our_mntent struct mntent
357 # define our_mntdir mnt_dir
358 # elif HAVE_STRUCT_MNTTAB
364 struct our_mntent *getmntent(FILE *filep);
365 # define our_mntent struct our_mntent
371 struct our_mntent *getmntent(FILE *filep);
372 # define our_mntent struct our_mntent
374 # define GETMNTENT_ONE 1
375 # define GETMNTENT_TWO 0
376 #elif HAVE_SYS_MNTTAB_H
378 # include <sys/mnttab.h>
379 # define GETMNTENT_ONE 0
380 # define GETMNTENT_TWO 1
381 # define our_mntent struct mnttab
382 # define our_mntdir mnt_mountp
383 #else /* if !HAVE_MNTCTL */
384 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
388 #define MOUNTED "/etc/mnttab"
391 #endif /* H_SYSTEM */