
From: Rusty Russell <rusty@rustcorp.com.au>

Return EINVAL for invalid sched_setaffinity on UP.  I was a little
surprised that sys_sched_setaffinity for CPU 1 didn't fail on my UP box. 
With CONFIG_SMP it would have.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/sched.h |    3 +++
 1 files changed, 3 insertions(+)

diff -puN include/linux/sched.h~sys_sched_setaffinity-on-up-should-fail-for-non-zero include/linux/sched.h
--- 25/include/linux/sched.h~sys_sched_setaffinity-on-up-should-fail-for-non-zero	2004-12-03 20:56:01.055599712 -0800
+++ 25-akpm/include/linux/sched.h	2004-12-03 20:56:01.060598952 -0800
@@ -13,6 +13,7 @@
 #include <linux/rbtree.h>
 #include <linux/thread_info.h>
 #include <linux/cpumask.h>
+#include <linux/errno.h>
 
 #include <asm/system.h>
 #include <asm/semaphore.h>
@@ -733,6 +734,8 @@ extern int set_cpus_allowed(task_t *p, c
 #else
 static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask)
 {
+	if (!cpus_intersects(new_mask, cpu_online_map))
+		return -EINVAL;
 	return 0;
 }
 #endif
_
