[SCM] Samba Shared Repository - branch v3-6-test updated

Jeremy Allison jra at samba.org
Wed Dec 22 16:26:35 MST 2010


The branch, v3-6-test has been updated
       via  7cdea69 All calls to event_add_to_select_args() call GetTimeOfDay() and pass this in as the &now parameter. Push this call inside of event_add_to_select_args() to the correct point so it doesn't get called unless needed.
      from  4e58621 s3-waf: fix the build.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 7cdea6983a63a9ca29dcd89d46b853f99dae355d
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 22 14:52:50 2010 -0800

    All calls to event_add_to_select_args() call GetTimeOfDay() and
    pass this in as the &now parameter. Push this call inside of
    event_add_to_select_args() to the correct point so it doesn't
    get called unless needed.
    
    Jeremy.
    (cherry picked from commit 053e30f2fc62a83d678414158558b27de80615df)

-----------------------------------------------------------------------

Summary of changes:
 source3/include/event.h          |    1 -
 source3/lib/events.c             |   11 +++++------
 source3/nmbd/nmbd_packets.c      |    7 ++-----
 source3/smbd/process.c           |    9 ++-------
 source3/winbindd/winbindd_dual.c |    5 +----
 5 files changed, 10 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/event.h b/source3/include/event.h
index 6b41b1d..101a967 100644
--- a/source3/include/event.h
+++ b/source3/include/event.h
@@ -27,7 +27,6 @@
 /* The following definitions come from lib/events.c  */
 
 bool event_add_to_select_args(struct event_context *event_ctx,
-			      const struct timeval *now,
 			      fd_set *read_fds, fd_set *write_fds,
 			      struct timeval *timeout, int *maxfd);
 bool run_events(struct event_context *event_ctx,
diff --git a/source3/lib/events.c b/source3/lib/events.c
index 0e127f0..d987072 100644
--- a/source3/lib/events.c
+++ b/source3/lib/events.c
@@ -27,10 +27,10 @@
  */
 
 bool event_add_to_select_args(struct tevent_context *ev,
-			      const struct timeval *now,
 			      fd_set *read_fds, fd_set *write_fds,
 			      struct timeval *timeout, int *maxfd)
 {
+	struct timeval now;
 	struct tevent_fd *fde;
 	struct timeval diff;
 	bool ret = false;
@@ -60,7 +60,8 @@ bool event_add_to_select_args(struct tevent_context *ev,
 		return ret;
 	}
 
-	diff = timeval_until(now, &ev->timer_events->next_event);
+	now = timeval_current();
+	diff = timeval_until(&now, &ev->timer_events->next_event);
 	*timeout = timeval_min(timeout, &diff);
 
 	return true;
@@ -167,7 +168,7 @@ struct timeval *get_timed_events_timeout(struct tevent_context *ev,
 
 static int s3_event_loop_once(struct tevent_context *ev, const char *location)
 {
-	struct timeval now, to;
+	struct timeval to;
 	fd_set r_fds, w_fds;
 	int maxfd = 0;
 	int ret = 0;
@@ -182,9 +183,7 @@ static int s3_event_loop_once(struct tevent_context *ev, const char *location)
 		return 0;
 	}
 
-	GetTimeOfDay(&now);
-
-	if (!event_add_to_select_args(ev, &now, &r_fds, &w_fds, &to, &maxfd)) {
+	if (!event_add_to_select_args(ev, &r_fds, &w_fds, &to, &maxfd)) {
 		return -1;
 	}
 
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 401eb25..c6bb205 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1881,11 +1881,8 @@ bool listen_for_packets(bool run_election)
 	timeout.tv_sec = (run_election||num_response_packets) ? 1 : NMBD_SELECT_LOOP;
 	timeout.tv_usec = 0;
 
-	{
-		struct timeval now = timeval_current();
-		event_add_to_select_args(nmbd_event_context(), &now,
-					 &r_fds, &w_fds, &timeout, &maxfd);
-	}
+	event_add_to_select_args(nmbd_event_context(),
+				 &r_fds, &w_fds, &timeout, &maxfd);
 
 	selrtn = sys_select(maxfd+1,&r_fds,&w_fds,NULL,&timeout);
 
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index a1aed80..150b2dd 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -979,13 +979,8 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *
 	 * select for longer than it would take to wait for them.
 	 */
 
-	{
-		struct timeval now;
-		GetTimeOfDay(&now);
-
-		event_add_to_select_args(smbd_event_context(), &now,
-					 &r_fds, &w_fds, &to, &maxfd);
-	}
+	event_add_to_select_args(smbd_event_context(),
+				 &r_fds, &w_fds, &to, &maxfd);
 
 	/* Process a signal and timed events now... */
 	if (run_events(smbd_event_context(), &selrtn, NULL, NULL)) {
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index cdf53d0..cc1c41e 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -1384,7 +1384,6 @@ static bool fork_domain_child(struct winbindd_child *child)
 		int maxfd;
 		struct timeval t;
 		struct timeval *tp;
-		struct timeval now;
 		TALLOC_CTX *frame = talloc_stackframe();
 		struct iovec iov[2];
 		int iov_count;
@@ -1395,8 +1394,6 @@ static bool fork_domain_child(struct winbindd_child *child)
 			continue;
 		}
 
-		GetTimeOfDay(&now);
-
 		if (child->domain && child->domain->startup &&
 				(time_mono(NULL) > child->domain->startup_time + 30)) {
 			/* No longer in "startup" mode. */
@@ -1418,7 +1415,7 @@ static bool fork_domain_child(struct winbindd_child *child)
 		t.tv_sec = 999999;
 		t.tv_usec = 0;
 
-		event_add_to_select_args(winbind_event_context(), &now,
+		event_add_to_select_args(winbind_event_context(),
 					 &r_fds, &w_fds, &t, &maxfd);
 		tp = get_timed_events_timeout(winbind_event_context(), &t);
 		if (tp) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list