X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=system.h;h=f3b1bab329be6ddd4d5600ce35468c80a41f4a43;hb=6b52f62e25ed30e68b4997fac0c52ad1876d4665;hp=b2c9d833a6e5498da7f61b93f9be524439149603;hpb=3b5820c4205e440d9aad5c5d626721ee30b12292;p=platform%2Fupstream%2Frpm.git diff --git a/system.h b/system.h index b2c9d83..f3b1bab 100644 --- a/system.h +++ b/system.h @@ -9,10 +9,6 @@ #include "config.h" #endif -#include -#include -#include - #ifdef HAVE_SYS_PARAM_H #include #endif @@ -21,87 +17,28 @@ of _POSIX_VERSION. */ #ifdef HAVE_UNISTD_H #include -#endif - -#if TIME_WITH_SYS_TIME -# include -# include +#if !defined(__GLIBC__) +#ifdef __APPLE__ +#include +#define environ (*_NSGetEnviron()) #else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#if NEED_TIMEZONE -extern time_t timezone; -#endif - - -/* Since major is a function on SVR4, we can't use `ifndef major'. */ -#if MAJOR_IN_MKDEV -#include -#define HAVE_MAJOR -#endif -#if MAJOR_IN_SYSMACROS -#include -#define HAVE_MAJOR -#endif -#ifdef major /* Might be defined in sys/types.h. */ -#define HAVE_MAJOR +extern char ** environ; +#endif /* __APPLE__ */ #endif - -#ifndef HAVE_MAJOR -#define major(dev) (((dev) >> 8) & 0xff) -#define minor(dev) ((dev) & 0xff) -#define makedev(maj, min) (((maj) << 8) | (min)) -#endif -#undef HAVE_MAJOR - -#ifdef HAVE_UTIME_H -#include -#endif - -/* Don't use bcopy! Use memmove if source and destination may overlap, - memcpy otherwise. */ - -#ifdef HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#else -# include -char *memchr (); #endif -#if !defined(HAVE_STPCPY) || defined(__LCLINT__) +#if !defined(HAVE_STPCPY) char * stpcpy(char * dest, const char * src); #endif -#if !defined(HAVE_STPNCPY) || defined(__LCLINT__) +#if !defined(HAVE_STPNCPY) char * stpncpy(char * dest, const char * src, size_t n); #endif -#include -#ifndef errno -extern int errno; -#endif - -#ifdef STDC_HEADERS -#define getopt system_getopt -/*@-skipansiheaders@*/ -#include -/*@=skipansiheaders@*/ -#undef getopt -#else /* not STDC_HEADERS */ -char *getenv (const char *name); -#endif /* STDC_HEADERS */ - -/* XXX solaris2.5.1 has not */ -#if !defined(EXIT_FAILURE) -#define EXIT_FAILURE 1 +#if HAVE_SECURE_GETENV +#define getenv(_s) secure_getenv(_s) +#elif HAVE___SECURE_GETENV +#define getenv(_s) __secure_getenv(_s) #endif #ifdef HAVE_FCNTL_H @@ -110,18 +47,6 @@ char *getenv (const char *name); #include #endif -#ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#endif -#ifndef F_OK -#define F_OK 0 -#define X_OK 1 -#define W_OK 2 -#define R_OK 4 -#endif - #ifdef HAVE_DIRENT_H # include # define NLENGTH(direct) (strlen((direct)->d_name)) @@ -139,77 +64,52 @@ char *getenv (const char *name); # endif /* HAVE_NDIR_H */ #endif /* HAVE_DIRENT_H */ -#ifdef __GNUC__ -# undef alloca -# define alloca __builtin_alloca -#else -# ifdef HAVE_ALLOCA_H -# include -# else -# ifndef _AIX -/* AIX alloca decl has to be the first thing in the file, bletch! */ -char *alloca (); -# endif -# endif +#if HAVE_LIMITS_H +#include #endif -#include - -#if HAVE_SYS_MMAN_H -#include +#ifndef PATH_MAX +#ifdef _POSIX_PATH_MAX +#define PATH_MAX _POSIX_PATH_MAX +#elif defined MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 256 #endif - -/* XXX FIXME: popt on sunos4.1.3: requires */ -#if HAVE_SYS_RESOURCE_H && HAVE_SYS_TIME_H -#include #endif -#if HAVE_SYS_UTSNAME_H -#include -#endif +#if WITH_SELINUX +#include +#include +#include +#else +typedef char * security_context_t; -#if HAVE_SYS_WAIT_H -#include -#endif +#define freecon(_c) -#if HAVE_GETOPT_H -#include -#endif +#define setfilecon(_fn, _c) (-1) +#define lsetfilecon(_fn, _c) (-1) -#if HAVE_GRP_H -#include -#endif +#define is_selinux_enabled() (0) -#if HAVE_LIMITS_H -#include -#endif - -#if HAVE_ERR_H -#include -#endif +#define matchpathcon_init(_fn) (-1) +#define matchpathcon_fini() (0) +#define matchpathcon(_fn, _fm, _c) (-1) -#if HAVE_MALLOC_H -#include -#endif +#define selabel_lookup_raw(_hnd, _scon, _key,_type) (-1) -/*@only@*/ void * xmalloc (size_t size); -/*@only@*/ void * xcalloc (size_t nmemb, size_t size); -/*@only@*/ void * xrealloc (/*@only@*/ /*@null@*/ void * ptr, size_t size); -/*@only@*/ char * xstrdup (const char *str); -/*@only@*/ void *vmefail(size_t size); +#define selinux_file_context_path() (0) -#if HAVE_MCHECK_H -#include +#define rpm_execcon(_v, _fn, _av, _envp) (0) #endif - -/* Memory allocation via macro defs to get meaningful locations from mtrace() */ -#if HAVE_MCHECK_H && defined(__GNUC__) -#define xmalloc(_size) (malloc(_size) ? : vmefail(_size)) -#define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size)) -#define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size)) -#define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str))) -#endif /* HAVE_MCHECK_H && defined(__GNUC__) */ +#include "rpmio/rpmutil.h" +/* compatibility macros to avoid a mass-renaming all over the codebase */ +#define xmalloc(_size) rmalloc((_size)) +#define xcalloc(_nmemb, _size) rcalloc((_nmemb), (_size)) +#define xrealloc(_ptr, _size) rrealloc((_ptr), (_size)) +#define xstrdup(_str) rstrdup((_str)) +#define _free(_ptr) rfree((_ptr)) /* Retrofit glibc __progname */ #if defined __GLIBC__ && __GLIBC__ >= 2 @@ -224,155 +124,23 @@ char *alloca (); else __progname = pn; \ } #endif -const char *__progname; - -#if HAVE_NETDB_H -#ifndef __LCLINT__ -#include -#endif /* __LCLINT__ */ -#endif - -#if HAVE_PWD_H -#include -#endif +extern const char *__progname; /* Take care of NLS matters. */ - -#if HAVE_LOCALE_H +#if ENABLE_NLS # include -#endif -#if !HAVE_SETLOCALE -# define setlocale(Category, Locale) /* empty */ -#endif - -#if ENABLE_NLS && !defined(__LCLINT__) # include -# define _(Text) gettext (Text) +# define _(Text) dgettext (PACKAGE, Text) #else -# undef bindtextdomain -# define bindtextdomain(Domain, Directory) /* empty */ -# undef textdomain -# define textdomain(Domain) /* empty */ # define _(Text) Text -# undef dgettext -# define dgettext(DomainName, Text) Text #endif #define N_(Text) Text /* ============== from misc/miscfn.h */ -#if !defined(USE_GNU_GLOB) -#if HAVE_FNMATCH_H -#include -#endif - -#if HAVE_GLOB_H -#include -#endif -#else -#include "misc/glob.h" #include "misc/fnmatch.h" -#endif -#if ! HAVE_S_IFSOCK -#define S_IFSOCK (0xC000) -#endif - -#if ! HAVE_S_ISLNK -#define S_ISLNK(mode) ((mode & 0xF000) == S_IFLNK) -#endif - -#if ! HAVE_S_ISSOCK -#define S_ISSOCK(mode) ((mode & 0xF000) == S_IFSOCK) -#endif +#include -#if NEED_STRINGS_H -#include -#endif - -#if ! HAVE_REALPATH -char *realpath(const char *path, char resolved_path []); -#endif - -#if NEED_MYREALLOC -#define realloc(ptr,size) myrealloc(ptr,size) -extern void *myrealloc(void *, size_t); -#endif - -#if ! HAVE_SETENV -extern int setenv(const char *name, const char *value, int replace); -extern void unsetenv(const char *name); -#endif - -#if HAVE_SYS_SOCKET_H -#include -#ifndef __LCLINT__ -#include -#endif /* __LCLINT__ */ -#endif - -#if HAVE_SYS_SELECT_H -#include -#endif - -/* Solaris <= 2.6 limits getpass return to only 8 chars */ -#if HAVE_GETPASSPHRASE -#define getpass getpassphrase -#endif - -#if ! HAVE_LCHOWN -#define lchown chown -#endif - -#if HAVE_GETMNTINFO_R || HAVE_MNTCTL -# define GETMNTENT_ONE 0 -# define GETMNTENT_TWO 0 -# if HAVE_SYS_MNTCTL_H -# include -# endif -# if HAVE_SYS_VMOUNT_H -# include -# endif -# if HAVE_SYS_MOUNT_H -# include -# endif -#elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB -# if HAVE_MNTENT_H -# include -# include -# define our_mntent struct mntent -# define our_mntdir mnt_dir -# elif HAVE_STRUCT_MNTTAB -# include -# include - struct our_mntent { - char * our_mntdir; - }; - struct our_mntent *getmntent(FILE *filep); -# define our_mntent struct our_mntent -# else -# include - struct our_mntent { - char * our_mntdir; - }; - struct our_mntent *getmntent(FILE *filep); -# define our_mntent struct our_mntent -# endif -# define GETMNTENT_ONE 1 -# define GETMNTENT_TWO 0 -#elif HAVE_SYS_MNTTAB_H -# include -# include -# define GETMNTENT_ONE 0 -# define GETMNTENT_TWO 1 -# define our_mntent struct mnttab -# define our_mntdir mnt_mountp -#else /* if !HAVE_MNTCTL */ -# error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system. -#endif - -#ifndef MOUNTED -#define MOUNTED "/etc/mnttab" -#endif #endif /* H_SYSTEM */