public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/daemons/dmeventd dmeventd.c
@ 2012-02-27 11:13 prajnoha
0 siblings, 0 replies; 14+ messages in thread
From: prajnoha @ 2012-02-27 11:13 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2012-02-27 11:13:52
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Systemd is linux-specific - move the supporting code under the 'ifdef linux'.
Some 'defines' used in this specific code were already under an ifdef so this
patch just completes it.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90
--- LVM2/daemons/dmeventd/dmeventd.c 2012/02/13 11:18:45 1.89
+++ LVM2/daemons/dmeventd/dmeventd.c 2012/02/27 11:13:51 1.90
@@ -1657,6 +1657,76 @@
return _set_oom_adj(OOM_ADJ_FILE, OOM_SCORE_ADJ_MIN);
}
+
+static int _handle_preloaded_fifo(int fd, const char *path)
+{
+ struct stat st_fd, st_path;
+ int flags;
+
+ if ((flags = fcntl(fd, F_GETFD)) < 0)
+ return 0;
+
+ if (flags & FD_CLOEXEC)
+ return 0;
+
+ if (fstat(fd, &st_fd) < 0 || !S_ISFIFO(st_fd.st_mode))
+ return 0;
+
+ if (stat(path, &st_path) < 0 ||
+ st_path.st_dev != st_fd.st_dev ||
+ st_path.st_ino != st_fd.st_ino)
+ return 0;
+
+ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0)
+ return 0;
+
+ return 1;
+}
+
+static int _systemd_handover(struct dm_event_fifos *fifos)
+{
+ const char *e;
+ char *p;
+ unsigned long env_pid, env_listen_fds;
+ int r = 0;
+
+ memset(fifos, 0, sizeof(*fifos));
+
+ /* LISTEN_PID must be equal to our PID! */
+ if (!(e = getenv(SD_LISTEN_PID_ENV_VAR_NAME)))
+ goto out;
+
+ errno = 0;
+ env_pid = strtoul(e, &p, 10);
+ if (errno || !p || *p || env_pid <= 0 ||
+ getpid() != (pid_t) env_pid)
+ goto out;
+
+ /* LISTEN_FDS must be 2 and the fds must be FIFOSs! */
+ if (!(e = getenv(SD_LISTEN_FDS_ENV_VAR_NAME)))
+ goto out;
+
+ errno = 0;
+ env_listen_fds = strtoul(e, &p, 10);
+ if (errno || !p || *p || env_listen_fds != 2)
+ goto out;
+
+ /* Check and handle the FIFOs passed in */
+ r = (_handle_preloaded_fifo(SD_FD_FIFO_SERVER, DM_EVENT_FIFO_SERVER) &&
+ _handle_preloaded_fifo(SD_FD_FIFO_CLIENT, DM_EVENT_FIFO_CLIENT));
+
+ if (r) {
+ fifos->server = SD_FD_FIFO_SERVER;
+ fifos->server_path = DM_EVENT_FIFO_SERVER;
+ fifos->client = SD_FD_FIFO_CLIENT;
+ fifos->client_path = DM_EVENT_FIFO_CLIENT;
+ }
+
+out:
+ unsetenv(SD_LISTEN_PID_ENV_VAR_NAME);
+ unsetenv(SD_LISTEN_FDS_ENV_VAR_NAME);
+ return r;
+}
#endif
static void remove_lockfile(void)
@@ -1723,10 +1793,12 @@
fd = rlim.rlim_cur;
for (--fd; fd >= 0; fd--) {
+#ifdef linux
/* Do not close fds preloaded by systemd! */
if (_systemd_activation &&
(fd == SD_FD_FIFO_SERVER || fd == SD_FD_FIFO_CLIENT))
continue;
+#endif
close(fd);
}
@@ -1804,76 +1876,6 @@
fini_fifos(&fifos);
}
-static int _handle_preloaded_fifo(int fd, const char *path)
-{
- struct stat st_fd, st_path;
- int flags;
-
- if ((flags = fcntl(fd, F_GETFD)) < 0)
- return 0;
-
- if (flags & FD_CLOEXEC)
- return 0;
-
- if (fstat(fd, &st_fd) < 0 || !S_ISFIFO(st_fd.st_mode))
- return 0;
-
- if (stat(path, &st_path) < 0 ||
- st_path.st_dev != st_fd.st_dev ||
- st_path.st_ino != st_fd.st_ino)
- return 0;
-
- if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0)
- return 0;
-
- return 1;
-}
-
-static int _systemd_handover(struct dm_event_fifos *fifos)
-{
- const char *e;
- char *p;
- unsigned long env_pid, env_listen_fds;
- int r = 0;
-
- memset(fifos, 0, sizeof(*fifos));
-
- /* LISTEN_PID must be equal to our PID! */
- if (!(e = getenv(SD_LISTEN_PID_ENV_VAR_NAME)))
- goto out;
-
- errno = 0;
- env_pid = strtoul(e, &p, 10);
- if (errno || !p || *p || env_pid <= 0 ||
- getpid() != (pid_t) env_pid)
- goto out;
-
- /* LISTEN_FDS must be 2 and the fds must be FIFOSs! */
- if (!(e = getenv(SD_LISTEN_FDS_ENV_VAR_NAME)))
- goto out;
-
- errno = 0;
- env_listen_fds = strtoul(e, &p, 10);
- if (errno || !p || *p || env_listen_fds != 2)
- goto out;
-
- /* Check and handle the FIFOs passed in */
- r = (_handle_preloaded_fifo(SD_FD_FIFO_SERVER, DM_EVENT_FIFO_SERVER) &&
- _handle_preloaded_fifo(SD_FD_FIFO_CLIENT, DM_EVENT_FIFO_CLIENT));
-
- if (r) {
- fifos->server = SD_FD_FIFO_SERVER;
- fifos->server_path = DM_EVENT_FIFO_SERVER;
- fifos->client = SD_FD_FIFO_CLIENT;
- fifos->client_path = DM_EVENT_FIFO_CLIENT;
- }
-
-out:
- unsetenv(SD_LISTEN_PID_ENV_VAR_NAME);
- unsetenv(SD_LISTEN_FDS_ENV_VAR_NAME);
- return r;
-}
-
static void usage(char *prog, FILE *file)
{
fprintf(file, "Usage:\n"
@@ -1928,7 +1930,9 @@
if (_restart)
restart();
+#ifdef linux
_systemd_activation = _systemd_handover(&fifos);
+#endif
if (!_foreground)
_daemonize();
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2012-03-02 23:01 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2012-03-02 23:01 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-03-02 23:01:10
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Code refactoring
Properly test for dm_asprintf result.
Keep unlocking of mutex in the same function and do not spread lock and
unlock over functions.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.95&r2=1.96
--- LVM2/daemons/dmeventd/dmeventd.c 2012/03/02 22:57:25 1.95
+++ LVM2/daemons/dmeventd/dmeventd.c 2012/03/02 23:01:10 1.96
@@ -1000,10 +1000,8 @@
almost as good as dead already... */
if (thread_new->events & DM_EVENT_TIMEOUT) {
ret = -_register_for_timeout(thread_new);
- if (ret) {
- _unlock_mutex();
- goto out;
- }
+ if (ret)
+ goto outth;
}
if (!(thread = _lookup_thread_status(message_data))) {
@@ -1029,6 +1027,7 @@
/* Or event # into events bitfield. */
thread->events |= message_data->events.field;
+ outth:
_unlock_mutex();
out:
@@ -1105,15 +1104,19 @@
const char *id = message_data->id;
const char *dso = thread->dso_data->dso_name;
const char *dev = thread->device.uuid;
+ int r;
unsigned events = ((thread->status == DM_THREAD_RUNNING)
&& (thread->events)) ? thread->events : thread->
events | DM_EVENT_REGISTRATION_PENDING;
dm_free(msg->data);
- msg->size = dm_asprintf(&(msg->data), fmt, id, dso, dev, events);
+ if ((r = dm_asprintf(&(msg->data), fmt, id, dso, dev, events)) < 0) {
+ msg->size = 0;
+ return -ENOMEM;
+ }
- _unlock_mutex();
+ msg->size = (uint32_t) r;
return 0;
}
@@ -1146,6 +1149,7 @@
static int _get_registered_dev(struct message_data *message_data, int next)
{
struct thread_status *thread, *hit = NULL;
+ int ret = -ENOENT;
_lock_mutex();
@@ -1162,10 +1166,8 @@
* If we got a registered device and want the next one ->
* fetch next conforming element off the list.
*/
- if (hit && !next) {
- _unlock_mutex();
- return _registered_device(message_data, hit);
- }
+ if (hit && !next)
+ goto reg;
if (!hit)
goto out;
@@ -1181,13 +1183,13 @@
}
}
- _unlock_mutex();
- return _registered_device(message_data, hit);
+ reg:
+ ret = _registered_device(message_data, hit);
out:
_unlock_mutex();
-
- return -ENOENT;
+
+ return ret;
}
static int _get_registered_device(struct message_data *message_data)
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2012-03-01 22:54 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2012-03-01 22:54 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-03-01 22:54:17
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Skip zero length messages
In case of zero length message, there would be a memory leak on
return path from _do_process_request.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.93&r2=1.94
--- LVM2/daemons/dmeventd/dmeventd.c 2012/03/01 22:06:18 1.93
+++ LVM2/daemons/dmeventd/dmeventd.c 2012/03/01 22:54:17 1.94
@@ -1504,9 +1504,10 @@
while ((reg = _initial_registrations[i])) {
msg.cmd = DM_EVENT_CMD_REGISTER_FOR_EVENT;
- msg.size = strlen(reg);
- msg.data = reg;
- _do_process_request(&msg);
+ if ((msg.size = strlen(reg))) {
+ msg.data = reg;
+ _do_process_request(&msg);
+ }
++ i;
}
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2012-02-10 13:46 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2012-02-10 13:46 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-02-10 13:46:23
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Remove unreachable code
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88
--- LVM2/daemons/dmeventd/dmeventd.c 2012/02/08 11:36:18 1.87
+++ LVM2/daemons/dmeventd/dmeventd.c 2012/02/10 13:46:23 1.88
@@ -1907,7 +1907,6 @@
case 'V':
printf("dmeventd version: %s\n", DM_LIB_VERSION);
exit(1);
- break;
}
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2011-09-14 9:53 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2011-09-14 9:53 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-14 09:53:32
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Keep the old-style function definition
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84
--- LVM2/daemons/dmeventd/dmeventd.c 2011/08/31 08:23:05 1.83
+++ LVM2/daemons/dmeventd/dmeventd.c 2011/09/14 09:53:32 1.84
@@ -1632,7 +1632,7 @@
/*
* Protection against OOM killer if kernel supports it
*/
-static int _protect_against_oom_killer()
+static int _protect_against_oom_killer(void)
{
struct stat st;
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2011-08-31 8:23 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2011-08-31 8:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-08-31 08:23:05
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Fix resource leak when strdup fails
Static analyzer noticed, strdup failing path leaks dmt structure.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.82&r2=1.83
--- LVM2/daemons/dmeventd/dmeventd.c 2011/07/28 13:06:50 1.82
+++ LVM2/daemons/dmeventd/dmeventd.c 2011/08/31 08:23:05 1.83
@@ -751,8 +751,10 @@
if (!dmt)
return NULL;
- if (!dm_task_set_uuid(dmt, ts->device.uuid))
- return NULL;
+ if (!dm_task_set_uuid(dmt, ts->device.uuid)) {
+ dm_task_destroy(dmt);
+ return NULL;
+ }
if (!dm_task_run(dmt)) {
dm_task_destroy(dmt);
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2011-03-02 14:20 mornfall
0 siblings, 0 replies; 14+ messages in thread
From: mornfall @ 2011-03-02 14:20 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2011-03-02 14:20:48
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Do not run past the end of an array in dmeventd's _handle_request when faced
with an unknown command ID.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.76&r2=1.77
--- LVM2/daemons/dmeventd/dmeventd.c 2011/03/02 12:49:13 1.76
+++ LVM2/daemons/dmeventd/dmeventd.c 2011/03/02 14:20:48 1.77
@@ -1388,7 +1388,7 @@
static int _handle_request(struct dm_event_daemon_message *msg,
struct message_data *message_data)
{
- static struct {
+ static struct request {
unsigned int cmd;
int (*f)(struct message_data *);
} requests[] = {
@@ -1403,7 +1403,7 @@
{ DM_EVENT_CMD_GET_STATUS, _get_status},
}, *req;
- for (req = requests; req < requests + sizeof(requests); req++)
+ for (req = requests; req < requests + sizeof(requests) / sizeof(struct request); req++)
if (req->cmd == msg->cmd)
return req->f(message_data);
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2011-01-17 23:14 mbroz
0 siblings, 0 replies; 14+ messages in thread
From: mbroz @ 2011-01-17 23:14 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz@sourceware.org 2011-01-17 23:14:05
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Remove DEBUGLOG from dmeventd.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74
--- LVM2/daemons/dmeventd/dmeventd.c 2010/12/20 14:08:46 1.73
+++ LVM2/daemons/dmeventd/dmeventd.c 2011/01/17 23:14:05 1.74
@@ -95,8 +95,6 @@
#define THREAD_STACK_SIZE (300*1024)
-#define DEBUGLOG(fmt, args...) _debuglog(fmt, ## args)
-
int dmeventd_debug = 0;
static int _foreground = 0;
static int _restart = 0;
@@ -203,24 +201,6 @@
static pthread_mutex_t _timeout_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t _timeout_cond = PTHREAD_COND_INITIALIZER;
-static void _debuglog(const char *fmt, ...)
-{
- time_t P;
- va_list ap;
-
- if (!_foreground)
- return;
-
- va_start(ap,fmt);
-
- time(&P);
- fprintf(stderr, "dmeventd[%p]: %.15s ", (void *) pthread_self(), ctime(&P)+4 );
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
-
- va_end(ap);
-}
-
/* Allocate/free the status structure for a monitoring thread. */
static struct thread_status *_alloc_thread_status(struct message_data *data,
struct dso_data *dso_data)
@@ -1621,7 +1601,7 @@
if (stat(OOM_ADJ_FILE, &st) == -1) {
if (errno == ENOENT)
- DEBUGLOG(OOM_ADJ_FILE " not found");
+ perror(OOM_ADJ_FILE " not found");
else
perror(OOM_ADJ_FILE ": stat failed");
return 1;
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2010-11-29 12:15 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2010-11-29 12:15 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-11-29 12:15:42
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Use one fprintf call for usage print
Replace multiple fprintf calls with multiline one.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71
--- LVM2/daemons/dmeventd/dmeventd.c 2010/11/29 11:23:14 1.70
+++ LVM2/daemons/dmeventd/dmeventd.c 2010/11/29 12:15:41 1.71
@@ -1749,14 +1749,12 @@
static void usage(char *prog, FILE *file)
{
- fprintf(file, "Usage:\n");
- fprintf(file, "%s [-V] [-h] [-d] [-d] [-d] [-f]\n", prog);
- fprintf(file, "\n");
- fprintf(file, " -V Show version of dmeventd\n");
- fprintf(file, " -h Show this help information\n");
- fprintf(file, " -d Log debug messages to syslog (-d, -dd, -ddd)\n");
- fprintf(file, " -f Don't fork, run in the foreground\n");
- fprintf(file, "\n");
+ fprintf(file, "Usage:\n"
+ "%s [-V] [-h] [-d] [-d] [-d] [-f]\n\n"
+ " -V Show version of dmeventd\n"
+ " -h Show this help information\n"
+ " -d Log debug messages to syslog (-d, -dd, -ddd)\n"
+ " -f Don't fork, run in the foreground\n\n", prog);
}
int main(int argc, char *argv[])
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2010-11-29 11:23 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2010-11-29 11:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-11-29 11:23:14
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Remove dead assignment in 'main'
'ret' is never read anywhere - remove it.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.69&r2=1.70
--- LVM2/daemons/dmeventd/dmeventd.c 2010/10/26 08:54:37 1.69
+++ LVM2/daemons/dmeventd/dmeventd.c 2010/11/29 11:23:14 1.70
@@ -1761,7 +1761,6 @@
int main(int argc, char *argv[])
{
- int ret;
signed char opt;
struct dm_event_fifos fifos;
//struct sys_log logdata = {DAEMON_NAME, LOG_DAEMON};
@@ -1835,7 +1834,7 @@
pthread_mutex_init(&_global_mutex, NULL);
- if ((ret = _open_fifos(&fifos)))
+ if (_open_fifos(&fifos))
exit(EXIT_FIFO_FAILURE);
/* Signal parent, letting them know we are ready to go. */
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2010-10-26 8:54 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2010-10-26 8:54 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-26 08:54:37
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Update C declaration () -> (void)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.68&r2=1.69
--- LVM2/daemons/dmeventd/dmeventd.c 2010/10/25 11:57:07 1.68
+++ LVM2/daemons/dmeventd/dmeventd.c 2010/10/26 08:54:37 1.69
@@ -1477,7 +1477,7 @@
dm_free(msg.data);
}
-static void _process_initial_registrations()
+static void _process_initial_registrations(void)
{
int i = 0;
char *reg;
@@ -1697,7 +1697,7 @@
setsid();
}
-static void restart()
+static void restart(void)
{
struct dm_event_fifos fifos;
struct dm_event_daemon_message msg = { 0, 0, NULL };
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2010-03-30 14:40 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2010-03-30 14:40 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-03-30 14:40:30
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Force C locale
As we need to use mlockall() enforce "C" locales for dmeventd.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57
--- LVM2/daemons/dmeventd/dmeventd.c 2010/03/30 14:37:28 1.56
+++ LVM2/daemons/dmeventd/dmeventd.c 2010/03/30 14:40:30 1.57
@@ -1698,6 +1698,13 @@
}
}
+ /*
+ * Switch to C locale to avoid reading large locale-archive file
+ * used by some glibc (on some distributions it takes over 100MB).
+ * Daemon currently needs to use mlockall().
+ */
+ setenv("LANG", "C", 1);
+
if (!_debug)
_daemonize();
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2010-03-30 14:37 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2010-03-30 14:37 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-03-30 14:37:28
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Fix resouce leak in error path
If the error path of _register_for_event() calls _free_thread_status()
_lib_put() call is missing.
To make thing simpler move this _lib_put() into common error path code.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56
--- LVM2/daemons/dmeventd/dmeventd.c 2010/03/30 14:35:40 1.55
+++ LVM2/daemons/dmeventd/dmeventd.c 2010/03/30 14:37:28 1.56
@@ -243,8 +243,10 @@
return ret;
}
+static void _lib_put(struct dso_data *data);
static void _free_thread_status(struct thread_status *thread)
{
+ _lib_put(thread->dso_data);
if (thread->current_task)
dm_task_destroy(thread->current_task);
dm_free(thread->device.uuid);
@@ -1481,7 +1483,6 @@
if (thread->status == DM_THREAD_DONE) {
dm_list_del(l);
pthread_join(thread->thread, NULL);
- _lib_put(thread->dso_data);
_free_thread_status(thread);
}
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* LVM2/daemons/dmeventd dmeventd.c
@ 2010-03-30 14:35 zkabelac
0 siblings, 0 replies; 14+ messages in thread
From: zkabelac @ 2010-03-30 14:35 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-03-30 14:35:41
Modified files:
daemons/dmeventd: dmeventd.c
Log message:
Remove mlockall() form dmeventd
As the header file <sys/mman.h> was not included in dmeventd.c
thus missed definition of MCL_CURRENT so this patch only makes
it obvious we were not locking memory here.
This patch has no functional change.
Later part of this patch set handles mlockall() via memlock_inc_daemon().
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55
--- LVM2/daemons/dmeventd/dmeventd.c 2008/11/04 15:07:44 1.54
+++ LVM2/daemons/dmeventd/dmeventd.c 2010/03/30 14:35:40 1.55
@@ -1725,11 +1725,6 @@
pthread_mutex_init(&_global_mutex, NULL);
-#ifdef MCL_CURRENT
- if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
- exit(EXIT_FAILURE);
-#endif
-
if ((ret = _open_fifos(&fifos)))
exit(EXIT_FIFO_FAILURE);
@@ -1749,9 +1744,6 @@
_exit_dm_lib();
-#ifdef MCL_CURRENT
- munlockall();
-#endif
pthread_mutex_destroy(&_global_mutex);
syslog(LOG_NOTICE, "dmeventd shutting down.");
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2012-03-02 23:01 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-27 11:13 LVM2/daemons/dmeventd dmeventd.c prajnoha
-- strict thread matches above, loose matches on Subject: below --
2012-03-02 23:01 zkabelac
2012-03-01 22:54 zkabelac
2012-02-10 13:46 zkabelac
2011-09-14 9:53 zkabelac
2011-08-31 8:23 zkabelac
2011-03-02 14:20 mornfall
2011-01-17 23:14 mbroz
2010-11-29 12:15 zkabelac
2010-11-29 11:23 zkabelac
2010-10-26 8:54 zkabelac
2010-03-30 14:40 zkabelac
2010-03-30 14:37 zkabelac
2010-03-30 14:35 zkabelac
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).