/* 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,
*/
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;
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;
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;
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;
}
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);
* 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)) {
int maxfd;
struct timeval t;
struct timeval *tp;
- struct timeval now;
TALLOC_CTX *frame = talloc_stackframe();
struct iovec iov[2];
int iov_count;
continue;
}
- GetTimeOfDay(&now);
-
if (child->domain && child->domain->startup &&
(time_mono(NULL) > child->domain->startup_time + 30)) {
/* No longer in "startup" mode. */
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) {