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
80 #if !defined(HAVE_STPCPY)
81 char * stpcpy(char * dest, const char * src);
84 #if !defined(HAVE_STPNCPY)
85 char * stpncpy(char * dest, const char * src, size_t n);
97 #if HAVE___SECURE_GETENV
98 #define getenv(_s) __secure_getenv(_s)
103 #define getopt system_getopt
106 #else /* not STDC_HEADERS */
107 char *getenv (const char *name);
109 char *realpath(const char *path, char resolved_path []);
111 #endif /* STDC_HEADERS */
113 /* XXX solaris2.5.1 has not */
114 #if !defined(EXIT_FAILURE)
115 #define EXIT_FAILURE 1
121 #include <sys/file.h>
124 #if !defined(SEEK_SET)
138 # define NLENGTH(direct) (strlen((direct)->d_name))
139 #else /* not HAVE_DIRENT_H */
140 # define dirent direct
141 # define NLENGTH(direct) ((direct)->d_namlen)
142 # ifdef HAVE_SYS_NDIR_H
143 # include <sys/ndir.h>
144 # endif /* HAVE_SYS_NDIR_H */
145 # ifdef HAVE_SYS_DIR_H
146 # include <sys/dir.h>
147 # endif /* HAVE_SYS_DIR_H */
150 # endif /* HAVE_NDIR_H */
151 #endif /* HAVE_DIRENT_H */
156 #include <sys/mman.h>
159 #if HAVE_SYS_UTSNAME_H
160 #include <sys/utsname.h>
164 #include <sys/wait.h>
180 #ifdef _POSIX_PATH_MAX
181 #define PATH_MAX _POSIX_PATH_MAX
182 #elif defined MAXPATHLEN
183 #define PATH_MAX MAXPATHLEN
198 #include <selinux/selinux.h>
200 typedef char * security_context_t;
204 #define getfilecon(_fn, _c) (-1)
205 #define lgetfilecon(_fn, _c) (-1)
206 #define fgetfilecon(_fd, _c) (-1)
208 #define setfilecon(_fn, _c) (-1)
209 #define lsetfilecon(_fn, _c) (-1)
210 #define fsetfilecon(_fd, _c) (-1)
212 #define security_check_context(_c) (0)
214 #define is_selinux_enabled() (0)
216 #define matchpathcon_init(_fn) (-1)
217 #define matchpathcon_fini() (0)
218 #define matchpathcon(_fn, _fm, _c) (-1)
220 #define rpm_execcon(_v, _fn, _av, _envp) (0)
224 #include <sys/capability.h>
226 typedef void * cap_t;
230 #include <acl/libacl.h>
235 #endif /* HAVE_MCHECK_H */
237 #include "rpmio/rpmutil.h"
238 /* compatibility macros to avoid a mass-renaming all over the codebase */
239 #define xmalloc(_size) rmalloc((_size))
240 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
241 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
242 #define xstrdup(_str) rstrdup((_str))
243 #define _free(_ptr) rfree((_ptr))
245 /* Retrofit glibc __progname */
246 #if defined __GLIBC__ && __GLIBC__ >= 2
247 #if __GLIBC_MINOR__ >= 1
248 #define __progname __assert_program_name
250 #define setprogname(pn)
252 #define __progname program_name
253 #define setprogname(pn) \
254 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
255 else __progname = pn; \
258 extern const char *__progname;
268 /* Take care of NLS matters. */
274 # define setlocale(Category, Locale) /* empty */
278 # include <libintl.h>
279 # define _(Text) dgettext (PACKAGE, Text)
281 # undef bindtextdomain
282 # define bindtextdomain(Domain, Directory) /* empty */
284 # define textdomain(Domain) /* empty */
285 # define _(Text) Text
287 # define dgettext(DomainName, Text) Text
290 #define N_(Text) Text
292 /* ============== from misc/miscfn.h */
294 #if !defined(USE_GNU_GLOB)
303 #include "misc/glob.h"
304 #include "misc/fnmatch.h"
308 #define S_IFSOCK (0xc000)
312 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
316 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
324 #define realloc(ptr,size) myrealloc(ptr,size)
325 extern void *myrealloc(void *, size_t);
329 extern int setenv(const char *name, const char *value, int replace);
330 extern void unsetenv(const char *name);
333 #if HAVE_SYS_SOCKET_H
334 #include <sys/types.h>
335 #include <sys/socket.h>
341 #if HAVE_SYS_SELECT_H
342 #include <sys/select.h>
346 /* Solaris <= 2.6 limits getpass return to only 8 chars */
347 #if HAVE_GETPASSPHRASE
348 #define getpass getpassphrase
355 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
356 # define GETMNTENT_ONE 0
357 # define GETMNTENT_TWO 0
358 # if HAVE_SYS_MNTCTL_H
359 # include <sys/mntctl.h>
361 # if HAVE_SYS_VMOUNT_H
362 # include <sys/vmount.h>
364 # if HAVE_SYS_MOUNT_H
365 # include <sys/mount.h>
367 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
371 # define our_mntent struct mntent
372 # define our_mntdir mnt_dir
373 # elif HAVE_STRUCT_MNTTAB
379 struct our_mntent *getmntent(FILE *filep);
380 # define our_mntent struct our_mntent
386 struct our_mntent *getmntent(FILE *filep);
387 # define our_mntent struct our_mntent
389 # define GETMNTENT_ONE 1
390 # define GETMNTENT_TWO 0
391 #elif HAVE_SYS_MNTTAB_H
393 # include <sys/mnttab.h>
394 # define GETMNTENT_ONE 0
395 # define GETMNTENT_TWO 1
396 # define our_mntent struct mnttab
397 # define our_mntdir mnt_mountp
398 #else /* if !HAVE_MNTCTL */
399 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
403 #define MOUNTED "/etc/mnttab"
406 #endif /* H_SYSTEM */