[lkml]   [2003]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] How to write a portable "run_on" program?
In message <> you write:
> In other words, the proper way to do set_cpu() is
> int set_cpu(int cpu)
> {
> fd_set cpuset;
> FD_ZERO(&cpuset);
> FD_SET(cpu, cpuset);
> return sched_setaffinity(getpid(), sizeof(cpuset), &cpuset);
> }
> which is a HELL OF A LOT more readable than the crap you're spouting
> (either your "before" _or_ your "after" crap).

Sorry, I remember your solution now. You're absolutely right (still).

I preferred the "include/exclude" flag, which covers the "what to do
when cpus come online/go offline" as well as the size issue, but
that's personal preference.

However, I shall dutifully attack the glibc people for this, then

#ifdef __USE_GNU
/* Set the CPU affinity for a task */
extern int sched_setaffinity (__pid_t __pid, unsigned long int __len,
unsigned long int *__mask) __THROW;

/* Get the CPU affinity for a task */
extern int sched_getaffinity (__pid_t __pid, unsigned long int __len,
unsigned long int *__mask) __THROW;

Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:35    [W:0.044 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site