mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-07 05:58:00 +03:00
Change the multilog code to toggle between async and sync writes for all
log types. This means the threaded_syslog type is no longer valid. A new fxn multilog_async is available to toggle between the two modes. If an app is compiled without pthreads and tries to use async logging, no logging will occur while async is enabled. dmeventd has been modified to use the new code I'm not positive I like the way the async_logger code calls the log fxn, but it works for now. Suggestions for other ways to do it would be helpful
This commit is contained in:
parent
bd236f658d
commit
8e6230ddd9
@ -33,6 +33,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
@ -56,6 +57,7 @@
|
||||
#define UNLINK_DSO(x) UNLINK(x)
|
||||
#define UNLINK_THREAD(x) UNLINK(x)
|
||||
|
||||
#define DAEMON_NAME "dmeventd"
|
||||
|
||||
/* Global mutex for list accesses. */
|
||||
static pthread_mutex_t mutex;
|
||||
@ -1016,7 +1018,7 @@ static void init_thread_signals(int hup)
|
||||
int main(void)
|
||||
{
|
||||
struct fifos fifos;
|
||||
|
||||
struct sys_log logdata = {DAEMON_NAME, LOG_DAEMON};
|
||||
/* Make sure, parent accepts HANGUP signal. */
|
||||
init_thread_signals(1);
|
||||
|
||||
@ -1032,8 +1034,9 @@ int main(void)
|
||||
kill(getppid(), HANGUP);
|
||||
|
||||
multilog_clear_logging();
|
||||
multilog_add_type(threaded_syslog, NULL);
|
||||
multilog_init_verbose(threaded_syslog, _LOG_DEBUG);
|
||||
multilog_add_type(std_syslog, &logdata);
|
||||
multilog_init_verbose(std_syslog, _LOG_DEBUG);
|
||||
multilog_async(1);
|
||||
|
||||
init_fifos(&fifos);
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user