return tv;
}
-/**
- return a timeval struct with the given elements
-*/
-_PUBLIC_ struct timeval timeval_set(uint32_t secs, uint32_t usecs)
-{
- struct timeval tv;
- tv.tv_sec = secs;
- tv.tv_usec = usecs;
- return tv;
-}
-
-
/**
return a timeval ofs microseconds after tv
*/
*/
struct timeval timeval_current(void);
-/**
- return a timeval struct with the given elements
-*/
-struct timeval timeval_set(uint32_t secs, uint32_t usecs);
-
/**
return a timeval ofs microseconds after tv
*/
/*
* Wait a day, i.e. forever...
*/
- status = g_lock_lock(ctx->lock_ctx, string_term_tdb_data(h->lock_name),
- G_LOCK_WRITE, timeval_set(86400, 0), NULL, NULL);
+ status = g_lock_lock(ctx->lock_ctx,
+ string_term_tdb_data(h->lock_name),
+ G_LOCK_WRITE,
+ tevent_timeval_set(86400, 0),
+ NULL,
+ NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("g_lock_lock failed: %s\n", nt_errstr(status)));
TALLOC_FREE(h);
return true;
}
- state->housekeep = event_add_idle(state->ev, NULL,
- timeval_set(housekeeping_period, 0),
- "print_queue_housekeeping",
- print_queue_housekeeping, state);
+ state->housekeep = event_add_idle(
+ state->ev,
+ NULL,
+ tevent_timeval_set(housekeeping_period, 0),
+ "print_queue_housekeeping",
+ print_queue_housekeeping,
+ state);
if (state->housekeep == NULL) {
DEBUG(0,("Could not add print_queue_housekeeping event\n"));
return false;
* measure here in case the other smbd is stuck
* somewhere else. */
- timeout = timeval_set(OPLOCK_BREAK_TIMEOUT*2, 0);
+ timeout = tevent_timeval_set(OPLOCK_BREAK_TIMEOUT * 2, 0);
if (request_timed_out(req, timeout)) {
return;
static void schedule_async_open(struct smb_request *req)
{
struct deferred_open_record *open_rec = NULL;
- struct timeval timeout = timeval_set(20, 0);
+ struct timeval timeout = tevent_timeval_set(20, 0);
bool ok;
if (request_timed_out(req, timeout)) {
* the oplock got removed.
*/
- setup_poll_open(
- req,
- &fsp->file_id,
- timeval_set(OPLOCK_BREAK_TIMEOUT*2, 0),
- timeval_set(1, 0));
+ setup_poll_open(req,
+ &fsp->file_id,
+ tevent_timeval_set(OPLOCK_BREAK_TIMEOUT * 2,
+ 0),
+ tevent_timeval_set(1, 0));
return NT_STATUS_SHARING_VIOLATION;
}
MSG_DEBUG, debug_message);
#if defined(WITH_SMB1SERVER)
- if ((lp_keepalive() != 0)
- && !(event_add_idle(ev_ctx, NULL,
- timeval_set(lp_keepalive(), 0),
- "keepalive", keepalive_fn,
- sconn))) {
+ if ((lp_keepalive() != 0) &&
+ !(event_add_idle(ev_ctx,
+ NULL,
+ tevent_timeval_set(lp_keepalive(), 0),
+ "keepalive",
+ keepalive_fn,
+ sconn)))
+ {
DEBUG(0, ("Could not add keepalive event\n"));
exit(1);
}
#endif
- if (!(event_add_idle(ev_ctx, NULL,
- timeval_set(IDLE_CLOSED_TIMEOUT, 0),
- "deadtime", deadtime_fn, sconn))) {
+ if (!(event_add_idle(ev_ctx,
+ NULL,
+ tevent_timeval_set(IDLE_CLOSED_TIMEOUT, 0),
+ "deadtime",
+ deadtime_fn,
+ sconn)))
+ {
DEBUG(0, ("Could not add deadtime event\n"));
exit(1);
}
- if (!(event_add_idle(ev_ctx, NULL,
- timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0),
- "housekeeping", housekeeping_fn, sconn))) {
+ if (!(event_add_idle(ev_ctx,
+ NULL,
+ tevent_timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0),
+ "housekeeping",
+ housekeeping_fn,
+ sconn)))
+ {
DEBUG(0, ("Could not add housekeeping event\n"));
exit(1);
}
tevent_req_set_callback(subreq, defer_rename_done, rename_state);
- timeout = timeval_set(OPLOCK_BREAK_TIMEOUT*2, 0);
+ timeout = tevent_timeval_set(OPLOCK_BREAK_TIMEOUT * 2, 0);
if (!tevent_req_set_endtime(subreq,
ev,
timeval_sum(&smb2req->request_time, &timeout))) {
printf("server_id: %s\n", server_id_str_buf(id, &tmp));
- req = msgcount_send(ev, ev, msg_ctx, MSG_SMB_NOTIFY,
- timeval_set(1, 0));
+ req = msgcount_send(
+ ev, ev, msg_ctx, MSG_SMB_NOTIFY, tevent_timeval_set(1, 0));
if (req == NULL) {
perror("msgcount_send failed");
return -1;
return -1;
}
- req = source_send(ev, ev, msg_ctx, MSG_SMB_NOTIFY,
- timeval_set(0, 10000), id);
+ req = source_send(ev,
+ ev,
+ msg_ctx,
+ MSG_SMB_NOTIFY,
+ tevent_timeval_set(0, 10000),
+ id);
if (req == NULL) {
perror("source_send failed");
return -1;
d_fprintf(stderr, _("g_lock_ctx_init failed\n"));
return -1;
}
- status = g_lock_lock(
- ctx,
- key,
- G_LOCK_WRITE,
- timeval_set(timeout / 1000, timeout % 1000),
- NULL,
- NULL);
+ status = g_lock_lock(ctx,
+ key,
+ G_LOCK_WRITE,
+ tevent_timeval_set(timeout / 1000,
+ timeout % 1000),
+ NULL,
+ NULL);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr,
_("g_lock_lock failed: %s\n"),
status = g_lock_lock(ctx,
lock_key,
G_LOCK_WRITE,
- timeval_set(600, 0),
+ tevent_timeval_set(600, 0),
NULL,
NULL);
if (!NT_STATUS_IS_OK(status)) {
new_start = time(NULL) +
MAX(30, lp_winbind_cache_time());
#endif
- add_krb5_ticket_gain_handler_event(entry,
- timeval_set(new_start, 0));
+ add_krb5_ticket_gain_handler_event(
+ entry,
+ tevent_timeval_set(new_start,
+ 0));
return;
}
TALLOC_FREE(entry->event);
#endif
/* ticket is destroyed here, we have to regain it
* if it is possible */
- add_krb5_ticket_gain_handler_event(entry,
- timeval_set(new_start, 0));
+ add_krb5_ticket_gain_handler_event(
+ entry, tevent_timeval_set(new_start, 0));
return;
}
&& (entry->renew_until <= expire_time)) {
/* try to regain ticket 10 seconds before expiration */
expire_time -= 10;
- add_krb5_ticket_gain_handler_event(entry,
- timeval_set(expire_time, 0));
+ add_krb5_ticket_gain_handler_event(
+ entry, tevent_timeval_set(expire_time, 0));
return;
}
if (entry->refresh_time == 0) {
entry->refresh_time = new_start;
}
- entry->event = tevent_add_timer(global_event_context(), entry,
- timeval_set(new_start, 0),
- krb5_ticket_refresh_handler,
- entry);
+ entry->event = tevent_add_timer(global_event_context(),
+ entry,
+ tevent_timeval_set(new_start, 0),
+ krb5_ticket_refresh_handler,
+ entry);
#endif
}
retry_later:
#if defined(DEBUG_KRB5_TKT_RENEWAL)
- t = timeval_set(time(NULL) + 30, 0);
+ t = tevent_timeval_set(time(NULL) + 30, 0);
#else
t = timeval_current_ofs(MAX(30, lp_winbind_cache_time()), 0);
#endif
got_ticket:
#if defined(DEBUG_KRB5_TKT_RENEWAL)
- t = timeval_set(time(NULL) + 30, 0);
+ t = tevent_timeval_set(time(NULL) + 30, 0);
#else
- t = timeval_set(krb5_event_refresh_time(entry->refresh_time), 0);
+ t = tevent_timeval_set(krb5_event_refresh_time(entry->refresh_time), 0);
#endif
if (entry->refresh_time == 0) {
} else {
/* Renew at 1/2 the ticket expiration time */
#if defined(DEBUG_KRB5_TKT_RENEWAL)
- t = timeval_set(time(NULL)+30, 0);
+ t = tevent_timeval_set(time(NULL) + 30, 0);
#else
- t = timeval_set(krb5_event_refresh_time(ticket_end),
- 0);
+ t = tevent_timeval_set(krb5_event_refresh_time(
+ ticket_end),
+ 0);
#endif
if (!entry->refresh_time) {
entry->refresh_time = t.tv_sec;
} else {
/* Renew at 1/2 the ticket expiration time */
#if defined(DEBUG_KRB5_TKT_RENEWAL)
- t = timeval_set(time(NULL)+30, 0);
+ t = tevent_timeval_set(time(NULL) + 30, 0);
#else
- t = timeval_set(krb5_event_refresh_time(ticket_end), 0);
+ t = tevent_timeval_set(krb5_event_refresh_time(ticket_end), 0);
#endif
if (entry->refresh_time == 0) {
entry->refresh_time = t.tv_sec;
next_change = pass_last_set_time + timeout;
DEBUG(10,("machine password still valid until: %s\n",
http_timestring(talloc_tos(), next_change)));
- *t = timeval_set(next_change, 0);
+ *t = tevent_timeval_set(next_change, 0);
if (lp_clustering()) {
uint8_t randbuf;