| 1 | /* |
| 2 | * Copyright 2016 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | */ |
| 20 | #ifndef __RPM_HELPER__ |
| 21 | #define __RPM_HELPER__cxx . . $ `src/OVAL/probes/unix/linux/rpm-helper.h:21:9`! |
| 22 | |
| 23 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 24 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 25 | #endif |
| 26 | |
| 27 | #include <rpm/rpmdb.h> |
| 28 | #include <rpm/rpmfi.h> |
| 29 | #include <rpm/rpmlib.h> |
| 30 | #include <rpm/rpmts.h> |
| 31 | #include <rpm/rpmmacro.h> |
| 32 | #include <rpm/rpmlog.h> |
| 33 | #include <rpm/rpmpgp.h> |
| 34 | #include <rpm/header.h> |
| 35 | |
| 36 | #include <pthread.h> |
| 37 | #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 38 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 39 | #include "pthread.h" |
| 40 | |
| 41 | struct rpm_probe_globalcxx . . $ rpm_probe_global# { |
| 42 | rpmtscxx . . $ rpmts# rpmtscxx . . $ rpm_probe_global#rpmts.; |
| 43 | pthread_mutex_tcxx . . $ pthread_mutex_t# mutexcxx . . $ rpm_probe_global#mutex.; |
| 44 | }; |
| 45 | |
| 46 | #ifndef HAVE_HEADERFORMATcxx . . $ `build/config.h:40:9`! |
| 47 | # define HAVE_LIBRPM44 1 /* hack */ |
| 48 | # define headerFormat(_h, _fmt, _emsg) headerSprintf((_h),( _fmt), rpmTagTable, rpmHeaderFormats, (_emsg)) |
| 49 | #endif |
| 50 | |
| 51 | #ifndef HAVE_RPMFREECRYPTOcxx . . $ `build/config.h:41:9`! |
| 52 | # define rpmFreeCrypto() while(0) |
| 53 | #endif |
| 54 | |
| 55 | #ifndef HAVE_RPMFREEFILESYSTEMS |
| 56 | # define rpmFreeFilesystemscxx . . $ `src/OVAL/probes/unix/linux/rpm-helper.h:56:10`!() while(0) |
| 57 | #endif |
| 58 | |
| 59 | #define RPM_MUTEX_LOCKcxx . . $ `src/OVAL/probes/unix/linux/rpm-helper.h:59:9`!(mutex_ptr) \ |
| 60 | do { \ |
| 61 | int prev_cancel_state = -1; \ |
| 62 | if (pthread_mutex_lock(mutex_ptr) != 0) { \ |
| 63 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Can't lock mutex"); \ |
| 64 | return (-1); \ |
| 65 | } \ |
| 66 | pthread_setcancelstate(PTHREAD_CANCEL_DISABLEcxx . . $ `<external>/14712363683955484316/pthread.h:173:9`!, &prev_cancel_state); \ |
| 67 | } while(0) |
| 68 | |
| 69 | #define RPM_MUTEX_UNLOCKcxx . . $ `src/OVAL/probes/unix/linux/rpm-helper.h:69:9`!(mutex_ptr) \ |
| 70 | do { \ |
| 71 | int prev_cancel_state = -1; \ |
| 72 | if (pthread_mutex_unlock(mutex_ptr) != 0) { \ |
| 73 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Can't unlock mutex. Aborting..."); \ |
| 74 | abort(); \ |
| 75 | } \ |
| 76 | pthread_setcancelstate(PTHREAD_CANCEL_ENABLEcxx . . $ `<external>/14712363683955484316/pthread.h:171:9`!, &prev_cancel_state); \ |
| 77 | } while(0) |
| 78 | |
| 79 | #ifdef RPM46_FOUNDcxx . . $ `build/config.h:46:9`! |
| 80 | int rpmErrorCbcxx . . $ rpmErrorCb(fff58a40e215938). (rpmlogReccxx . . $ rpmlogRec# rec, rpmlogCallbackDatacxx . . $ rpmlogCallbackData# data); |
| 81 | #endif |
| 82 | |
| 83 | // todo: HAVE_RPM412 needs to be set by configure, |
| 84 | // although fallback solution should have same result |
| 85 | #ifdef HAVE_RPM412 |
| 86 | #define DISABLE_PLUGINS(ts) rpmtsSetFlags(ts, RPMTRANS_FLAG_NOPLUGINS) |
| 87 | #else |
| 88 | #define DISABLE_PLUGINScxx . . $ `src/OVAL/probes/unix/linux/rpm-helper.h:88:9`!(ts) rpmDefineMacro(NULL,"__plugindir \"\"", 0); |
| 89 | #endif |
| 90 | |
| 91 | #ifndef HAVE_RPMVERIFYFILE |
| 92 | int rpmVerifyFilecxx . . $ rpmVerifyFile(3d59f9e68d5ecc36).(const rpmtscxx . . $ rpmts# ts, const rpmficxx . . $ rpmfi# fi, |
| 93 | rpmVerifyAttrscxx . . $ rpmVerifyAttrs# * res, rpmVerifyAttrscxx . . $ rpmVerifyAttrs# omitMask); |
| 94 | #endif |
| 95 | |
| 96 | /** |
| 97 | * Preload libraries required by rpm |
| 98 | * It destroy error callback! |
| 99 | */ |
| 100 | void rpmLibsPreloadcxx . . $ rpmLibsPreload(49f6e7a06ebc5aa8).(void); |
| 101 | |
| 102 | void set_rpm_db_pathcxx . . $ set_rpm_db_path(49f6e7a06ebc5aa8).(void); |
| 103 | |
| 104 | |
| 105 | #endif |