static int utils_updatenow(lua_State *T) { ev_now_update(LEM); lua_pushnumber(T, (lua_Number)ev_now(LEM)); return 1; }
void perf_snap_finish(ME_P_ struct perf_snap *snap) { ev_tstamp diff; assert(0 < snap->start); ev_now_update(mctx->loop); diff = ev_now(mctx->loop) - snap->start; snap->total += diff; snap->encounters++; snap->start = 0; }
static void dns_timeout_cb (EV_P_ ev_timer *w, int revents) { ev_now_update(EV_A); ev_tstamp now = ev_now(EV_A ); int next = dns_timeouts(NULL, -1, now); if (next > 0) { w->repeat = next; ev_timer_again (EV_A_ w); } else { w->repeat = 1; ev_timer_again (EV_A_ w); } }
static void input_done(void) { if (clear_pam_wrong_timeout) { ev_timer_stop(main_loop, clear_pam_wrong_timeout); free(clear_pam_wrong_timeout); clear_pam_wrong_timeout = NULL; } pam_state = STATE_PAM_VERIFY; redraw_screen(); if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) { DEBUG("successfully authenticated\n"); clear_password_memory(); if (shell_auth_done_command) { system(shell_auth_done_command); } exit(0); } else { if (shell_auth_fail_command) { system(shell_auth_fail_command); } } if (debug_mode) fprintf(stderr, "Authentication failure\n"); pam_state = STATE_PAM_WRONG; clear_input(); redraw_screen(); /* Clear this state after 2 seconds (unless the user enters another * password during that time). */ ev_now_update(main_loop); if ((clear_pam_wrong_timeout = calloc(sizeof(struct ev_timer), 1))) { ev_timer_init(clear_pam_wrong_timeout, clear_pam_wrong, 2.0, 0.); ev_timer_start(main_loop, clear_pam_wrong_timeout); } /* Cancel the clear_indicator_timeout, it would hide the unlock indicator * too early. */ stop_clear_indicator_timeout(); /* beep on authentication failure, if enabled */ if (beep) { xcb_bell(conn, 100); xcb_flush(conn); } }
/** * Establishes the current time by querying the kernel, updating the time * returned by EventLoop::now() in the progress. * * This is a costly operation and is usually done automatically within ev_run (). * This function is rarely useful, but when some event callback runs for a very * long time without entering the event loop, updating libev's idea of the current * time is a good idea. * * @return boolean false if object is not initialized */ PHP_METHOD(EventLoop, updateNow) { /* TODO: Is this method name confusing? */ event_loop_object *obj = (event_loop_object *)zend_object_store_get_object(getThis() TSRMLS_CC); assert(obj->loop); if(obj->loop) { ev_now_update(obj->loop); RETURN_BOOL(1); } RETURN_BOOL(0); }
void fiber_value(struct fbr_context *fiber_context, void *_arg) { struct client_context *cc; struct my_value *value; struct me_cli_value *mv; int retval; ev_tstamp t1, t2, diff; cc = fbr_container_of(fiber_context, struct client_context, fbr); for (;;) { value = new_value(cc); record_value(cc, value); assert(value->buf); assert(value->buf->ptr); for (;;) { if (value->nreceived > 0) break; mv = me_cli_value_new(cc->conn); mv->data = (uint8_t *)value->buf->ptr; mv->data_len = value->buf->size; value->nsent++; ev_now_update(cc->loop); t1 = ev_now(cc->loop); retval = me_cli_value_submit(mv, cc->args_info.instance_timeout_arg); if (0 == retval) { value->latency = mv->latency; cc->last_iid = mv->iid; t2 = ev_now(cc->loop); diff = cc->args_info.each_arg - (t2 - t1); if (diff > 0) fbr_sleep(&cc->fbr, diff); if (value->nreceived > 0) break; next_value(cc, value, mv->iid); me_cli_value_processed(mv); me_cli_value_dispose(mv); break; } me_cli_value_processed(mv); me_cli_value_dispose(mv); cc->stats.timeouts++; assert(value->buf); assert(value->buf->ptr); } } }
static void input_done(void) { STOP_TIMER(clear_pam_wrong_timeout); pam_state = STATE_PAM_VERIFY; redraw_screen(); if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) { DEBUG("successfully authenticated\n"); clear_password_memory(); /* Turn the screen on, as it may have been turned off * on release of the 'enter' key. */ turn_monitors_on(); /* PAM credentials should be refreshed, this will for example update any kerberos tickets. * Related to credentials pam_end() needs to be called to cleanup any temporary * credentials like kerberos /tmp/krb5cc_pam_* files which may of been left behind if the * refresh of the credentials failed. */ pam_setcred(pam_handle, PAM_REFRESH_CRED); pam_end(pam_handle, PAM_SUCCESS); exit(0); } if (debug_mode) fprintf(stderr, "Authentication failure\n"); pam_state = STATE_PAM_WRONG; failed_attempts += 1; clear_input(); if (unlock_indicator) redraw_screen(); /* Clear this state after 2 seconds (unless the user enters another * password during that time). */ ev_now_update(main_loop); START_TIMER(clear_pam_wrong_timeout, TSTAMP_N_SECS(2), clear_pam_wrong); /* Cancel the clear_indicator_timeout, it would hide the unlock indicator * too early. */ STOP_TIMER(clear_indicator_timeout); /* beep on authentication failure, if enabled */ if (beep) { xcb_bell(conn, 100); xcb_flush(conn); } }
void poller_init(void) { ev_idle *idle = &eidle; ev_timer *timer = &etimer; ev_prepare *prepare = &eprepare; ev_check *check = &echeck; the_loop = ev_loop_new(EVFLAG_NOSIGMASK); //CTRACE("v %d.%d", ev_version_major(), ev_version_minor()); //CTRACE("ev_supported_backends=%08x", ev_supported_backends()); //CTRACE("ev_recommended_backends=%08x", ev_recommended_backends()); //CTRACE("ev_embeddable_backends=%08x", ev_embeddable_backends()); //CTRACE("ev_backend=%08x", ev_backend(the_loop)); #if EV_MULTIPLICITY //CTRACE("ev_now=%lf", ev_now(the_loop)); #else //CTRACE("ev_now=%lf", ev_now()); #endif ev_now_update(the_loop); timecounter_now = (uint64_t)(ev_now(the_loop) * 1000000000.); ev_idle_init(idle, _idle_cb); ev_timer_init(timer, _timer_cb, 0.0, 0.0); ev_timer_again(the_loop, timer); ev_prepare_init(prepare, _prepare_cb); ev_prepare_start(the_loop, prepare); ev_check_init(check, _check_cb); ev_check_start(the_loop, check); ev_set_syserr_cb(_syserr_cb); hash_init(&events, 65521, (hash_hashfn_t)ev_item_hash, (hash_item_comparator_t)ev_item_cmp, (hash_item_finalizer_t)ev_item_fini); }
static void input_done(void) { STOP_TIMER(clear_pam_wrong_timeout); pam_state = STATE_PAM_VERIFY; redraw_screen(); if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) { DEBUG("successfully authenticated\n"); clear_password_memory(); /* Turn the screen on, as it may have been turned off * on release of the 'enter' key. */ turn_monitors_on(); exit(0); } if (debug_mode) fprintf(stderr, "Authentication failure\n"); pam_state = STATE_PAM_WRONG; clear_input(); redraw_screen(); /* Clear this state after 2 seconds (unless the user enters another * password during that time). */ ev_now_update(main_loop); START_TIMER(clear_pam_wrong_timeout, TSTAMP_N_SECS(2), clear_pam_wrong); /* Cancel the clear_indicator_timeout, it would hide the unlock indicator * too early. */ STOP_TIMER(clear_indicator_timeout); /* beep on authentication failure, if enabled */ if (beep) { xcb_bell(conn, 100); xcb_flush(conn); } }
void uv_update_time(uv_loop_t* loop) { ev_now_update(loop->ev); }
static void input_done(void) { STOP_TIMER(clear_pam_wrong_timeout); pam_state = STATE_PAM_VERIFY; redraw_screen(); if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) { DEBUG("successfully authenticated\n"); clear_password_memory(); /* PAM credentials should be refreshed, this will for example update any kerberos tickets. * Related to credentials pam_end() needs to be called to cleanup any temporary * credentials like kerberos /tmp/krb5cc_pam_* files which may of been left behind if the * refresh of the credentials failed. */ pam_setcred(pam_handle, PAM_REFRESH_CRED); pam_end(pam_handle, PAM_SUCCESS); exit(0); } if (debug_mode) fprintf(stderr, "Authentication failure\n"); /* Get state of Caps and Num lock modifiers, to be displayed in * STATE_PAM_WRONG state */ xkb_mod_index_t idx, num_mods; const char *mod_name; num_mods = xkb_keymap_num_mods(xkb_keymap); for (idx = 0; idx < num_mods; idx++) { if (!xkb_state_mod_index_is_active(xkb_state, idx, XKB_STATE_MODS_EFFECTIVE)) continue; mod_name = xkb_keymap_mod_get_name(xkb_keymap, idx); if (mod_name == NULL) continue; /* Replace certain xkb names with nicer, human-readable ones. */ if (strcmp(mod_name, XKB_MOD_NAME_CAPS) == 0) mod_name = "Caps Lock"; else if (strcmp(mod_name, XKB_MOD_NAME_ALT) == 0) mod_name = "Alt"; else if (strcmp(mod_name, XKB_MOD_NAME_NUM) == 0) mod_name = "Num Lock"; else if (strcmp(mod_name, XKB_MOD_NAME_LOGO) == 0) mod_name = "Win"; char *tmp; if (modifier_string == NULL) { if (asprintf(&tmp, "%s", mod_name) != -1) modifier_string = tmp; } else if (asprintf(&tmp, "%s, %s", modifier_string, mod_name) != -1) { free(modifier_string); modifier_string = tmp; } } pam_state = STATE_PAM_WRONG; failed_attempts += 1; clear_input(); if (unlock_indicator) redraw_screen(); /* Skip all the events during the pam verification to avoid bad people * spamming keys and locking pam in an endless validation loop */ xcb_generic_event_t *ev = xcb_poll_for_event(conn); free(ev); while (ev != NULL) { ev = xcb_poll_for_queued_event(conn); free(ev); } /* Clear this state after 2 seconds (unless the user enters another * password during that time). */ ev_now_update(main_loop); START_TIMER(clear_pam_wrong_timeout, TSTAMP_N_SECS(2), clear_pam_wrong); /* Cancel the clear_indicator_timeout, it would hide the unlock indicator * too early. */ STOP_TIMER(clear_indicator_timeout); /* beep on authentication failure, if enabled */ if (beep) { xcb_bell(conn, 100); xcb_flush(conn); } }
void uv_update_time() { ev_now_update(EV_DEFAULT_UC); }
void update() { ev_now_update(*m_loop); }
static PyObject * Loop_update(Loop *self) { ev_now_update(self->loop); Py_RETURN_NONE; }
void perf_snap_start(ME_P_ struct perf_snap *snap) { assert(0 == snap->start); ev_now_update(mctx->loop); snap->start = ev_now(mctx->loop); }