Some are important, e.g. the seemingly harmless braces around if with dprintf, since that dprintf is defined as empty, will screw things up and grab the next line Change-Id: Ie5e1cf813178ad708ff42ae5e477fbc96034471c
30 lines
453 B
C
30 lines
453 B
C
#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);
|
|
|
|
#if 0
|
|
static int_void_fn orig_sched_yield = 0;
|
|
#endif
|
|
|
|
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;
|
|
}
|