Commit febc3903 authored by nextime's avatar nextime

Qemu doesn't implement syscall for sched_getcpu()

parent 8870b011
......@@ -43,13 +43,19 @@ int pthread_create(pthread_t *thread,
int ret;
cpu_set_t mask; /* Define your cpu_set bit mask. */
CPU_ZERO(&mask); /* Initialize it all to 0, i.e. no CPUs selected. */
CPU_SET(sched_getcpu(), &mask); /* set the bit that represents core 0. */
//CPU_SET(sched_getcpu(), &mask); /* set the bit that represents the core. */
// XXX if we are running under qemu, sched_getcpu() will give us a unimplemented syscall.
CPU_SET(0, &mask);
//targs.arg = arg;
//targs.fn = start_routine;
if (real_pthread_create == NULL)
{
// make sure the main thread is running on the same core:
sched_setaffinity(getpid(), sizeof(mask), &mask);
real_pthread_create = dlsym(RTLD_NEXT,"pthread_create");
if ((msg=dlerror())!=NULL)
printf("**fopen dlopen failed : %s\n", msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment