mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-30 17:18:21 +03:00
o stick multilog into the dm-event lib and dmeventd code again
o more tweaks to libmultilog calls - the api isn't set in stone yet, so don't get too comfortable. o not sure the dmeventd in device-mapper/dmeventd works - i've been using the one in lib/event/ o currently both daemons are set to log only to syslog
This commit is contained in:
parent
f81656fd48
commit
cd4355d8f4
@ -28,7 +28,7 @@ else
|
||||
LIB_SHARED = libdmeventdnoop.so
|
||||
endif
|
||||
|
||||
LDFLAGS += -ldl -ldevmapper -lpthread
|
||||
LDFLAGS += -ldl -ldevmapper -lpthread -lmultilog
|
||||
|
||||
include ../make.tmpl
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "libdevmapper.h"
|
||||
#include "libdm-event.h"
|
||||
#include "libmultilog.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -100,6 +101,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int list = 0, next = 0, ret, reg = default_reg;
|
||||
char *device = NULL, *device_arg, *dso_name = NULL, *dso_name_arg;
|
||||
struct log_data *ldata;
|
||||
|
||||
if (!parse_argv(argc, argv, &dso_name, &device, ®, &list))
|
||||
exit(EXIT_FAILURE);
|
||||
@ -107,6 +109,16 @@ int main(int argc, char **argv)
|
||||
device_arg = device;
|
||||
dso_name_arg = dso_name;
|
||||
|
||||
|
||||
if(!(ldata = malloc(sizeof(*ldata))))
|
||||
exit(ENOMEM);
|
||||
if(!memset(ldata, 0, sizeof(*ldata)))
|
||||
exit(ENOMEM);
|
||||
|
||||
/* FIXME: use -v/-q options to set this */
|
||||
ldata->verbose_level = _LOG_DEBUG;
|
||||
multilog_add_type(standard, ldata);
|
||||
|
||||
if (list) {
|
||||
do {
|
||||
if (!(ret= dm_get_registered_device(&dso_name,
|
||||
|
@ -19,10 +19,8 @@
|
||||
*/
|
||||
|
||||
#include "libdevmapper.h"
|
||||
#include "log.h"
|
||||
#include "libdm-event.h"
|
||||
#include "list.h"
|
||||
// #include "libmultilog.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
@ -42,6 +40,8 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libmultilog.h"
|
||||
|
||||
|
||||
#define dbg_malloc(x...) malloc(x)
|
||||
#define dbg_strdup(x...) strdup(x)
|
||||
@ -1020,7 +1020,12 @@ static void init_thread_signals(int hup)
|
||||
int main(void)
|
||||
{
|
||||
struct fifos fifos;
|
||||
pthread_t log_thread = { 0 };
|
||||
|
||||
struct log_data *tsdata = malloc(sizeof(*tsdata));
|
||||
if(!tsdata)
|
||||
exit(-ENOMEM);
|
||||
if(!memset(tsdata, 0, sizeof(*tsdata)))
|
||||
exit(-ENOMEM);
|
||||
|
||||
/* Make sure, parent accepts HANGUP signal. */
|
||||
init_thread_signals(1);
|
||||
@ -1036,15 +1041,9 @@ int main(void)
|
||||
init_thread_signals(0);
|
||||
kill(getppid(), HANGUP);
|
||||
|
||||
/* Startup the syslog thread now so log_* macros work */
|
||||
/*
|
||||
if(!start_syslog_thread(&log_thread, 100)) {
|
||||
fprintf(stderr, "Could not start logging thread\n");
|
||||
munlockall();
|
||||
pthread_mutex_destroy(&mutex);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
multilog_clear_logging();
|
||||
tsdata->verbose_level = _LOG_DEBUG;
|
||||
multilog_add_type(threaded_syslog, tsdata);
|
||||
|
||||
init_fifos(&fifos);
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
|
@ -19,15 +19,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* FIXME Replace with log.h */
|
||||
#undef log_print
|
||||
#undef log_err
|
||||
#undef stack
|
||||
#define log_print(x...) fprintf(stderr, "[dmeventdlib] " x)
|
||||
#define log_err(x...) log_print(x)
|
||||
#define stack log_print("trace: %s:%s(%d)\n", __FILE__, __func__, __LINE__);
|
||||
|
||||
|
||||
#define DAEMON "/sbin/dmeventd"
|
||||
#define LOCKFILE "/var/lock/dmeventd"
|
||||
#define FIFO_CLIENT "/var/run/dmeventd-client"
|
||||
|
Loading…
Reference in New Issue
Block a user