00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __RPM_HELPER__
00021 #define __RPM_HELPER__
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include <rpm/rpmdb.h>
00028 #include <rpm/rpmfi.h>
00029 #include <rpm/rpmlib.h>
00030 #include <rpm/rpmts.h>
00031 #include <rpm/rpmmacro.h>
00032 #include <rpm/rpmlog.h>
00033 #include <rpm/header.h>
00034
00035 #include <pthread.h>
00036 #include "common/util.h"
00037 #include "common/debug_priv.h"
00038 #include "pthread.h"
00039
00040 struct rpm_probe_global {
00041 rpmts rpmts;
00042 pthread_mutex_t mutex;
00043 };
00044
00045 #ifndef HAVE_HEADERFORMAT
00046 # define HAVE_LIBRPM44 1
00047 # define headerFormat(_h, _fmt, _emsg) headerSprintf((_h),( _fmt), rpmTagTable, rpmHeaderFormats, (_emsg))
00048 #endif
00049
00050 #ifndef HAVE_RPMFREECRYPTO
00051 # define rpmFreeCrypto() while(0)
00052 #endif
00053
00054 #ifndef HAVE_RPMFREEFILESYSTEMS
00055 # define rpmFreeFilesystems() while(0)
00056 #endif
00057
00058 #define RPM_MUTEX_LOCK(mutex_ptr) \
00059 do { \
00060 int prev_cancel_state = -1; \
00061 if (pthread_mutex_lock(mutex_ptr) != 0) { \
00062 dE("Can't lock mutex"); \
00063 return (-1); \
00064 } \
00065 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &prev_cancel_state); \
00066 } while(0)
00067
00068 #define RPM_MUTEX_UNLOCK(mutex_ptr) \
00069 do { \
00070 int prev_cancel_state = -1; \
00071 if (pthread_mutex_unlock(mutex_ptr) != 0) { \
00072 dE("Can't unlock mutex. Aborting..."); \
00073 abort(); \
00074 } \
00075 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &prev_cancel_state); \
00076 } while(0)
00077
00078 #ifdef HAVE_RPM46
00079 int rpmErrorCb (rpmlogRec rec, rpmlogCallbackData data);
00080 #endif
00081
00082
00083
00084 #ifdef HAVE_RPM412
00085 #define DISABLE_PLUGINS(ts) rpmtsSetFlags(ts, RPMTRANS_FLAG_NOPLUGINS)
00086 #else
00087 #define DISABLE_PLUGINS(ts) rpmDefineMacro(NULL,"__plugindir \"\"", 0);
00088 #endif
00089
00094 void rpmLibsPreload(void);
00095
00096 #endif