public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@canonical.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: linux-audit@redhat.com
Subject: [PATCH 2/5] Store daemon config pointer in the periodic watcher's private data
Date: Wed,  1 Aug 2012 00:00:21 -0700	[thread overview]
Message-ID: <1343804424-3172-3-git-send-email-tyhicks@canonical.com> (raw)
In-Reply-To: <1343804424-3172-1-git-send-email-tyhicks@canonical.com>

In preparation for moving the periodic watcher to auditd-listen.c,
periodic_handler() cannot rely on having access to the config global
variable. That can be solved by using the private data pointer built
into libev watchers.
---
 src/auditd.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/auditd.c b/src/auditd.c
index a5b8b2c..e0ee702 100644
--- a/src/auditd.c
+++ b/src/auditd.c
@@ -445,7 +445,9 @@ static void netlink_handler(struct ev_loop *loop, struct ev_io *io,
 static void periodic_handler(struct ev_loop *loop, struct ev_periodic *per,
 			int revents )
 {
-	if (config.tcp_client_max_idle)
+	struct daemon_conf *config = (struct daemon_conf *) per->data;
+
+	if (config->tcp_client_max_idle)
 		auditd_tcp_listen_check_idle (loop);
 }
 
@@ -719,6 +721,7 @@ int main(int argc, char *argv[])
 
 	ev_periodic_init (&periodic_watcher, periodic_handler,
 			  0, config.tcp_client_max_idle, NULL);
+	periodic_watcher.data = &config;
 	if (config.tcp_client_max_idle)
 		ev_periodic_start (loop, &periodic_watcher);
 
-- 
1.7.9.5

  parent reply	other threads:[~2012-08-01  7:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01  7:00 [PATCH 0/5] Build time disabling of auditd network listener Tyler Hicks
2012-08-01  7:00 ` [PATCH 1/5] Move auditd listener reconfigure code into auditd-listen.c Tyler Hicks
2012-08-01  7:00 ` Tyler Hicks [this message]
2012-08-01  7:00 ` [PATCH 3/5] Move periodic watcher " Tyler Hicks
2012-08-01  7:00 ` [PATCH 4/5] Consolidate periodic handler code Tyler Hicks
2012-08-01  7:00 ` [PATCH 5/5] Conditionally build auditd network listener support Tyler Hicks
2012-09-10 18:39 ` [PATCH 0/5] Build time disabling of auditd network listener Tyler Hicks
2012-09-11 13:12   ` Steve Grubb
2012-09-11 17:10     ` Tyler Hicks
2012-10-26 17:09       ` Tyler Hicks
2012-10-26 17:14         ` Steve Grubb
2012-11-05 14:17 ` Steve Grubb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343804424-3172-3-git-send-email-tyhicks@canonical.com \
    --to=tyhicks@canonical.com \
    --cc=linux-audit@redhat.com \
    --cc=sgrubb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox