static void process_sigusr2(const struct context *c) { struct status_output *so = status_open(NULL, 0, M_INFO, NULL, 0); print_status(c, so); status_close(so); signal_reset(c->sig); }
static void ifconfig_pool_msg(const struct ifconfig_pool *pool, int msglevel) { struct status_output *so = status_open(NULL, 0, msglevel, NULL, 0); ASSERT(so); status_printf(so, "IFCONFIG POOL LIST"); ifconfig_pool_list(pool, so); status_close(so); }
struct ifconfig_pool_persist * ifconfig_pool_persist_init(const char *filename, int refresh_freq) { struct ifconfig_pool_persist *ret; ASSERT(filename); ALLOC_OBJ_CLEAR(ret, struct ifconfig_pool_persist); if (refresh_freq > 0) { ret->fixed = false; ret->file = status_open(filename, refresh_freq, -1, NULL, STATUS_OUTPUT_READ|STATUS_OUTPUT_WRITE); } else { ret->fixed = true; ret->file = status_open(filename, 0, -1, NULL, STATUS_OUTPUT_READ); } return ret; }
static void *interrupt (void *param) { status_fd = status_open (((char **) param)[0]); if (source_fd < 0) { /* an error concerning status endpoint is not fatal for in/out bulk*/ /* transfer */ if (verbose > 1) perror("status_fd"); pthread_exit(0); } pthread_cleanup_push (close_fd, &status_fd); int result = 0; RDR_to_PC_NotifySlotChange_t *slotchange; do { /* original LinuxThreads cancelation didn't work right */ /* so test for it explicitly. */ pthread_testcancel (); if (ccid_state_changed(&slotchange, -1)) { /* don't bother host, when nothing changed */ if (verbose > 1) fprintf(stderr, "interrupt loop: writing RDR_to_PC_NotifySlotChange... "); result = write(status_fd, slotchange, sizeof *slotchange); if (verbose > 1) fprintf(stderr, "done (%d written).\n", result); } } while (result >= 0); if (errno != ESHUTDOWN || result < 0) { perror ("interrupt loop aborted"); pthread_cancel(ep0); } pthread_cleanup_pop (1); fflush (stdout); fflush (stderr); return 0; }