rpm 4.10.90

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

system.h
Go to the documentation of this file.

    00001
    00005 #ifndef H_SYSTEM
    00006 #define H_SYSTEM
    00007
    00008 #ifdef HAVE_CONFIG_H
    00009 #include "config.h"
    00010 #endif
    00011
    00012 #ifdef HAVE_SYS_PARAM_H
    00013 #include <sys/param.h>
    00014 #endif
    00015
    00016 /* <unistd.h> should be included before any preprocessor test
    00017    of _POSIX_VERSION.  */
    00018 #ifdef HAVE_UNISTD_H
    00019 #include <unistd.h>
    00020 #if !defined(__GLIBC__)
    00021 #ifdef __APPLE__
    00022 #include <crt_externs.h>
    00023 #define environ (*_NSGetEnviron())
    00024 #else
    00025 extern char ** environ;
    00026 #endif /* __APPLE__ */
    00027 #endif
    00028 #endif
    00029
    00030 #if !defined(HAVE_STPCPY)
    00031 char * stpcpy(char * dest, const char * src);
    00032 #endif
    00033
    00034 #if !defined(HAVE_STPNCPY)
    00035 char * stpncpy(char * dest, const char * src, size_t n);
    00036 #endif
    00037
    00038 #if HAVE___SECURE_GETENV
    00039 #define getenv(_s)      __secure_getenv(_s)
    00040 #endif
    00041
    00042 #ifdef HAVE_FCNTL_H
    00043 #include <fcntl.h>
    00044 #else
    00045 #include <sys/file.h>
    00046 #endif
    00047
    00048 #ifdef HAVE_DIRENT_H
    00049 # include <dirent.h>
    00050 # define NLENGTH(direct) (strlen((direct)->d_name))
    00051 #else /* not HAVE_DIRENT_H */
    00052 # define dirent direct
    00053 # define NLENGTH(direct) ((direct)->d_namlen)
    00054 # ifdef HAVE_SYS_NDIR_H
    00055 #  include <sys/ndir.h>
    00056 # endif /* HAVE_SYS_NDIR_H */
    00057 # ifdef HAVE_SYS_DIR_H
    00058 #  include <sys/dir.h>
    00059 # endif /* HAVE_SYS_DIR_H */
    00060 # ifdef HAVE_NDIR_H
    00061 #  include <ndir.h>
    00062 # endif /* HAVE_NDIR_H */
    00063 #endif /* HAVE_DIRENT_H */
    00064
    00065 #if HAVE_LIMITS_H
    00066 #include <limits.h>
    00067 #endif
    00068
    00069 #ifndef PATH_MAX
    00070 #ifdef _POSIX_PATH_MAX
    00071 #define PATH_MAX _POSIX_PATH_MAX
    00072 #elif defined MAXPATHLEN
    00073 #define PATH_MAX MAXPATHLEN
    00074 #else
    00075 #define PATH_MAX 256
    00076 #endif
    00077 #endif
    00078
    00079 #if WITH_SELINUX
    00080 #include <selinux/selinux.h>
    00081 #include <selinux/label.h>
    00082 #include <selinux/avc.h>
    00083 #else
    00084 typedef char * security_context_t;
    00085
    00086 #define freecon(_c)
    00087
    00088 #define setfilecon(_fn, _c)     (-1)
    00089 #define lsetfilecon(_fn, _c)    (-1)
    00090
    00091 #define is_selinux_enabled()    (0)
    00092
    00093 #define matchpathcon_init(_fn)                  (-1)
    00094 #define matchpathcon_fini()                     (0)
    00095 #define matchpathcon(_fn, _fm, _c)              (-1)
    00096
    00097 #define selabel_lookup_raw(_hnd, _scon, _key,_type)     (-1)
    00098
    00099 #define selinux_file_context_path() (0)
    00100
    00101 #define rpm_execcon(_v, _fn, _av, _envp)        (0)
    00102 #endif
    00103
    00104 #include "rpmio/rpmutil.h"
    00105 /* compatibility macros to avoid a mass-renaming all over the codebase */
    00106 #define xmalloc(_size) rmalloc((_size))
    00107 #define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size))
    00108 #define xrealloc(_ptr, _size) rrealloc((_ptr), (_size))
    00109 #define xstrdup(_str) rstrdup((_str))
    00110 #define _free(_ptr) rfree((_ptr))
    00111
    00112 /* Retrofit glibc __progname */
    00113 #if defined __GLIBC__ && __GLIBC__ >= 2
    00114 #if __GLIBC_MINOR__ >= 1
    00115 #define __progname      __assert_program_name
    00116 #endif
    00117 #define setprogname(pn)
    00118 #else
    00119 #define __progname      program_name
    00120 #define setprogname(pn) \
    00121   { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
    00122     else __progname = pn;               \
    00123   }
    00124 #endif
    00125 extern const char *__progname;
    00126
    00127 /* Take care of NLS matters.  */
    00128 #if ENABLE_NLS
    00129 # include <locale.h>
    00130 # include <libintl.h>
    00131 # define _(Text) dgettext (PACKAGE, Text)
    00132 #else
    00133 # define _(Text) Text
    00134 #endif
    00135
    00136 #define N_(Text) Text
    00137
    00138 /* ============== from misc/miscfn.h */
    00139
    00140 #include "misc/fnmatch.h"
    00141
    00142 #include <dlfcn.h>
    00143
    00144 #endif  /* H_SYSTEM */