Ejemplo n.º 1
0
int __wrap_fputc(int c, FILE *stream)
{
	if (unlikely(xeno_get_current() != XN_NO_HANDLE &&
		     !(xeno_get_current_mode() & XNRELAX)))
		return rt_fputc(c, stream);
	else {
		rt_print_flush_buffers();
		return __real_fputc(c, stream);
	}
}
Ejemplo n.º 2
0
static void check_sigdebug_inner(const char *fn, int line, const char *reason)
{
    if (sigdebug_received)
        return;

    rt_task_set_mode(T_WARNSW, 0, NULL);
    rt_print_flush_buffers();
    fprintf(stderr, "FAILURE %s:%d: no %s received\n", fn, line, reason);
    exit(EXIT_FAILURE);
}
Ejemplo n.º 3
0
int __wrap_putchar(int c)
{
	if (unlikely(xeno_get_current() != XN_NO_HANDLE &&
		     !(xeno_get_current_mode() & XNRELAX)))
		return rt_putchar(c);
	else {
		rt_print_flush_buffers();
		return __real_putchar(c);
	}
}
Ejemplo n.º 4
0
int __wrap_vfprintf(FILE *stream, const char *fmt, va_list args)
{
	if (unlikely(xeno_get_current() != XN_NO_HANDLE &&
		     !(xeno_get_current_mode() & XNRELAX)))
		return rt_vfprintf(stream, fmt, args);
	else {
		rt_print_flush_buffers();
		return __real_vfprintf(stream, fmt, args);
	}
}
Ejemplo n.º 5
0
void __wrap_vsyslog(int priority, const char *fmt, va_list ap)
{
	if (unlikely(xeno_get_current() != XN_NO_HANDLE &&
		     !(xeno_get_current_mode() & XNRELAX)))
		return rt_vsyslog(priority, fmt, ap);
	else {
		rt_print_flush_buffers();
		__real_vsyslog(priority, fmt, ap);
	}
}
Ejemplo n.º 6
0
int __wrap_puts(const char *s)
{
	if (unlikely(xeno_get_current() != XN_NO_HANDLE &&
		     !(xeno_get_current_mode() & XNRELAX)))
		return rt_puts(s);
	else {
		rt_print_flush_buffers();
		return puts(s);
	}
}
Ejemplo n.º 7
0
size_t __wrap_fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
	if (unlikely(xeno_get_current() != XN_NO_HANDLE &&
		     !(xeno_get_current_mode() & XNRELAX)))
		return rt_fwrite(ptr, size, nmemb, stream);
	else {
		rt_print_flush_buffers();
		return __real_fwrite(ptr, size, nmemb, stream);
	}

}
Ejemplo n.º 8
0
static void check_inner(const char *fn, int line, const char *msg,
                        int status, int expected)
{
    if (status == expected)
        return;

    rt_task_set_mode(T_WARNSW, 0, NULL);
    rt_print_flush_buffers();
    fprintf(stderr, "FAILURE %s:%d: %s returned %d instead of %d - %s\n",
            fn, line, msg, status, expected, strerror(-status));
    exit(EXIT_FAILURE);
}
Ejemplo n.º 9
0
void sigdebug_handler(int sig, siginfo_t *si, void *context)
{
    unsigned int reason = si->si_value.sival_int;

    if (reason != expected_reason) {
        rt_print_flush_buffers();
        fprintf(stderr, "FAILURE: sigdebug_handler expected reason %d,"
                " received %d\n", expected_reason, reason);
        exit(EXIT_FAILURE);
    }
    sigdebug_received = true;
}
Ejemplo n.º 10
0
void __wrap___vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
{
#ifdef CONFIG_XENO_FORTIFY
	if (unlikely(xeno_get_current() != XN_NO_HANDLE &&
		     !(xeno_get_current_mode() & XNRELAX)))
		return __rt_vsyslog_chk(pri, flag, fmt, ap);
	else {
		rt_print_flush_buffers();
		__real___vsyslog_chk(pri, flag, fmt, ap);
	}
#else
	__wrap_fprintf(stderr, 
		       "Xenomai needs to be compiled with --enable-fortify "
		      "to support applications\ncompiled with "
		      "-D_FORTIFY_SOURCE\n");
	exit(EXIT_FAILURE);
#endif
}
Ejemplo n.º 11
0
void rt_task_body(void *cookie)
{
    RTIME end;
    int err;

    rt_task_thread = pthread_self();

    rt_printf("syscall\n");
    setup_checkdebug(SIGDEBUG_MIGRATE_SYSCALL);
    sched_yield();
    check_sigdebug_received("SIGDEBUG_MIGRATE_SYSCALL");

    rt_printf("signal\n");
    setup_checkdebug(SIGDEBUG_MIGRATE_SIGNAL);
    err = rt_sem_v(&send_signal);
    check_no_error("rt_sem_v", err);
    rt_task_sleep(rt_timer_ns2ticks(10000000LL));
    check_sigdebug_received("SIGDEBUG_MIGRATE_SIGNAL");

    rt_printf("relaxed mutex owner\n");
    setup_checkdebug(SIGDEBUG_MIGRATE_PRIOINV);
    err = rt_mutex_acquire(&prio_invert, TM_INFINITE);
    check("rt_mutex_acquire", err, -EINTR);
    check_sigdebug_received("SIGDEBUG_MIGRATE_PRIOINV");

    rt_printf("page fault\n");
    setup_checkdebug(SIGDEBUG_MIGRATE_FAULT);
    rt_task_sleep(0);
    *mem ^= 0xFF;
    check_sigdebug_received("SIGDEBUG_MIGRATE_FAULT");

    if (wd) {
        rt_printf("watchdog\n");
        rt_print_flush_buffers();
        setup_checkdebug(SIGDEBUG_WATCHDOG);
        end = rt_timer_tsc() + rt_timer_ns2tsc(2100000000ULL);
        rt_task_sleep(0);
        while (rt_timer_tsc() < end && !sigdebug_received)
            /* busy loop */;
        check_sigdebug_received("SIGDEBUG_WATCHDOG");
    }
}
Ejemplo n.º 12
0
int __wrap_fclose(FILE *stream)
{
	rt_print_flush_buffers();
	return __real_fclose(stream);
}