static int timer_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { const char *tm_status, *wd_status = ""; int len; if (xnpod_active_p() && xntbase_enabled_p(&nktbase)) { tm_status = "on"; #ifdef CONFIG_XENO_OPT_WATCHDOG wd_status = "+watchdog"; #endif /* CONFIG_XENO_OPT_WATCHDOG */ } else tm_status = "off"; len = sprintf(page, "status=%s%s:setup=%Lu:clock=%Lu:timerdev=%s:clockdev=%s\n", tm_status, wd_status, xnarch_tsc_to_ns(nktimerlat), xntbase_get_rawclock(&nktbase), XNARCH_TIMER_DEVICE, XNARCH_CLOCK_DEVICE); len -= off; if (len <= off + count) *eof = 1; *start = page + off; if (len > count) len = count; if (len < 0) len = 0; return len; }
int *xnthread_get_errno_location(xnthread_t *thread) { static int fallback_errno; if (unlikely(!xnpod_active_p())) return &fallback_errno; #ifndef __XENO_SIM__ if (xnthread_test_state(thread, XNSHADOW)) return &thread->errcode; if (xnthread_test_state(thread, XNROOT)) return &xnshadow_errno(current); #endif /* !__XENO_SIM__ */ return &thread->errcode; }
int *xnthread_get_errno_location(xnthread_t *thread) { static int fallback_errno; if (unlikely(!xnpod_active_p())) return &fallback_errno; #ifdef CONFIG_XENO_OPT_PERVASIVE if (xnthread_test_state(thread, XNSHADOW)) return &thread->errcode; if (xnthread_test_state(thread, XNROOT)) return &xnshadow_errno(current); #endif /* CONFIG_XENO_OPT_PERVASIVE */ return &thread->errcode; }
static int timer_vfile_show(struct xnvfile_regular_iterator *it, void *data) { const char *tm_status, *wd_status = ""; if (xnpod_active_p() && xntbase_enabled_p(&nktbase)) { tm_status = testbits(nktbase.status, XNTBLCK) ? "locked" : "on"; #ifdef CONFIG_XENO_OPT_WATCHDOG wd_status = "+watchdog"; #endif /* CONFIG_XENO_OPT_WATCHDOG */ } else tm_status = "off"; xnvfile_printf(it, "status=%s%s:setup=%Lu:clock=%Lu:timerdev=%s:clockdev=%s\n", tm_status, wd_status, xnarch_tsc_to_ns(nktimerlat), xntbase_get_rawclock(&nktbase), XNARCH_TIMER_DEVICE, XNARCH_CLOCK_DEVICE); return 0; }