Mercurial > louis > mq > lightsd
changeset 208:364ae9b0bacb
fix things, the daemon module needs testing now
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Wed, 29 Jul 2015 23:21:41 -0700 |
parents | de8eb0d227da |
children | 32024d53e06a |
files | daemon_module.patch tag_untag.patch |
diffstat | 2 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/daemon_module.patch Wed Jul 29 22:56:48 2015 -0700 +++ b/daemon_module.patch Wed Jul 29 23:21:41 2015 -0700 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent 1fcb29a52e8bf48ca4b5a7e04263644831e075e2 +# Parent 42ce0d8e8e56199b6f4b9dce0ce1ef5afcb0fb88 diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt --- a/core/CMakeLists.txt @@ -46,7 +46,7 @@ new file mode 100644 --- /dev/null +++ b/core/daemon.c -@@ -0,0 +1,148 @@ +@@ -0,0 +1,152 @@ +// Copyright (c) 2015, Louis Opter <kalessin@kalessin.fr> +// +// This file is part of lighstd. @@ -150,8 +150,9 @@ +void +lgtd_daemon_update_proctitle(void) +{ ++#if LGTD_HAVE_PROCTITLE + char title[LGTD_DAEMON_TITLE_SIZE] = { 0 }; -+ int i = snprintf(title, sizeof(title), "lightsd: "); ++ int i = 0; + +#define TITLE_APPEND(fmt, ...) do { \ + int n = snprintf((&title[i]), (sizeof(title) - i), (fmt), __VA_ARGS__); \ @@ -159,11 +160,11 @@ +} while (0) + +#define PREFIX(fmt, ...) TITLE_APPEND( \ -+ "%s" fmt, (title[i - 1] == ')' ? "; " : ""), __VA_ARGS__ \ ++ "%s" fmt, (i && title[i - 1] == ')' ? "; " : ""), __VA_ARGS__ \ +) + +#define ADD_ITEM(fmt, ...) TITLE_APPEND( \ -+ "%s" fmt, (title[i - 1] != '(' ? ", " : ""), __VA_ARGS__ \ ++ "%s" fmt, (i && title[i - 1] != '(' ? ", " : ""), __VA_ARGS__ \ +) +#define LOOP(list_type, list, elem_type, prefix, ...) do { \ + if (!list_type ## _EMPTY(list)) { \ @@ -194,6 +195,9 @@ + ); + + PREFIX("clients(connected=%d)", LGTD_STATS_GET(clients)); ++ ++ setproctitle("%s", title); ++#endif +} diff --git a/core/daemon.h b/core/daemon.h new file mode 100644
--- a/tag_untag.patch Wed Jul 29 22:56:48 2015 -0700 +++ b/tag_untag.patch Wed Jul 29 23:21:41 2015 -0700 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent c61333b9502c69273d1ea2eb5aee2ffed2cdc9c7 +# Parent 6c45f4b0e5d2dc90978e3db5b5537898ae7c84b4 Add the ability to tag (group) or untag (ungroup) bulbs diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -401,7 +401,7 @@ + n++; + } + } -+ assert(bulb->gw->tag_refcounts[tag_id] == n - 1); ++ assert(bulb->gw->tag_refcounts[tag_id] == n); + } +#endif +