mcexec: --disable-sched-yield: avoid kernel/user switch

This commit is contained in:
Balazs Gerofi
2017-03-05 14:36:56 +09:00
parent a256280118
commit e554f4e2f9
6 changed files with 89 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
#define _GNU_SOURCE
#include <dlfcn.h>
#include <sys/time.h>
#include <sched.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#undef sched_yield
typedef int (*int_void_fn)(void);
static int_void_fn orig_sched_yield = 0;
int sched_yield(void)
{
#if 0
if (!orig_sched_yield) {
orig_sched_yield = (int_void_fn)dlsym(RTLD_NEXT, "sched_yield");
}
printf("sched_yield() called\n");
#endif
return 0;
}