Mailinglist Archive: opensuse-amd64 (491 mails)

< Previous Next >
sched_setaffinity (always EFAULTs) on Suse 2.6.4/5
  • From: "Philip J. Mucci" <mucci@xxxxxxxxxx>
  • Date: Tue, 29 Jun 2004 09:56:04 +0000 (UTC)
  • Message-id: <1088502667.3813.974.camel@xxxxxxxxxxxxxxxxxxxxx>
Hi folks,

I'm working with some guys at PGI/AMD to get some sched_setaffinity
support in some runtime systems. We're having great difficulty getting
sched_setaffinity working.

The code below was constructed via the code in linux/kernel/sched.c,
contrary to the prototypes and the like. Surely we must be doing
something rather stupid, because we keep getting -EFAULT.

The only thing I can guess is that the sizeof(cpumask) is different in
kernel than it is in user land.

Any help would be greatly appreciated...

Phil


#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <asm/cpumask.h>

void set_affin(void)
{
cpumask_t mask = { 0, };
int retval;

cpu_set(1,mask);
retval = sched_setaffinity(0,sizeof(cpumask_t),&mask);
printf("sched_setaffinity returns %d, errno %d\n",retval,errno);
perror("ERROR MESSAGE");
}
int main(int argc, char **argv)
{
set_affin();
sleep(1);
exit(0);
}



< Previous Next >