diff -urN 2.4.10pre9/arch/i386/lib/usercopy.c copy-user-lat/arch/i386/lib/usercopy.c --- 2.4.10pre9/arch/i386/lib/usercopy.c Tue May 1 19:35:18 2001 +++ copy-user-lat/arch/i386/lib/usercopy.c Fri Sep 14 06:38:01 2001 @@ -6,6 +6,7 @@ * Copyright 1997 Linus Torvalds */ #include +#include #include #include @@ -91,6 +92,7 @@ "=&D" (__d2) \ : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ : "memory"); \ + conditional_schedule(); \ } while (0) long @@ -134,6 +136,7 @@ ".previous" \ : "=&c"(size), "=&D" (__d0) \ : "r"(size & 3), "0"(size / 4), "1"(addr), "a"(0)); \ + conditional_schedule(); \ } while (0) unsigned long @@ -180,5 +183,6 @@ :"=r" (n), "=D" (s), "=a" (res), "=c" (tmp) :"0" (n), "1" (s), "2" (0), "3" (mask) :"cc"); + conditional_schedule(); return res & mask; } diff -urN 2.4.10pre9/include/asm-alpha/uaccess.h copy-user-lat/include/asm-alpha/uaccess.h --- 2.4.10pre9/include/asm-alpha/uaccess.h Sun Apr 1 20:11:14 2001 +++ copy-user-lat/include/asm-alpha/uaccess.h Fri Sep 14 06:38:01 2001 @@ -3,6 +3,7 @@ #include #include +#include /* @@ -384,19 +385,36 @@ return len; } -#define __copy_to_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n)) -#define __copy_from_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n)) +static inline long +__copy_to_user(void *to, const void *from, long n) +{ + n = __copy_tofrom_user_nocheck(to, from, n); + conditional_schedule(); + return n; +} + +static inline long +__copy_from_user(void *to, const void *from, long n) +{ + n = __copy_tofrom_user_nocheck(to, from, n); + conditional_schedule(); + return n; +} extern inline long copy_to_user(void *to, const void *from, long n) { - return __copy_tofrom_user(to, from, n, to); + n = __copy_tofrom_user(to, from, n, to); + conditional_schedule(); + return n; } extern inline long copy_from_user(void *to, const void *from, long n) { - return __copy_tofrom_user(to, from, n, from); + n = __copy_tofrom_user(to, from, n, from); + conditional_schedule(); + return n; } extern void __do_clear_user(void); @@ -434,6 +452,7 @@ : "$1","$2","$3","$4","$5","$28","memory"); len = __cl_len; } + conditional_schedule(); return len; } @@ -448,6 +467,7 @@ long ret = -EFAULT; if (__access_ok((long)from, 0, get_fs())) ret = __strncpy_from_user(to, from, n); + conditional_schedule(); return ret; } @@ -456,7 +476,11 @@ extern inline long strlen_user(const char *str) { - return access_ok(VERIFY_READ,str,0) ? __strlen_user(str) : 0; + long ret = 0; + if (access_ok(VERIFY_READ,str,0)) + ret = __strlen_user(str); + conditional_schedule(); + return ret; } /* Returns: 0 if exception before NUL or reaching the supplied limit (N), @@ -465,7 +489,11 @@ extern inline long strnlen_user(const char *str, long n) { - return access_ok(VERIFY_READ,str,0) ? __strnlen_user(str, n) : 0; + long ret = 0; + if (access_ok(VERIFY_READ,str,0)) + ret = __strnlen_user(str, n); + conditional_schedule(); + return ret; } /* diff -urN 2.4.10pre9/include/asm-i386/uaccess.h copy-user-lat/include/asm-i386/uaccess.h --- 2.4.10pre9/include/asm-i386/uaccess.h Fri Sep 14 04:07:01 2001 +++ copy-user-lat/include/asm-i386/uaccess.h Fri Sep 14 06:38:18 2001 @@ -7,6 +7,7 @@ #include #include #include +#include #include #define VERIFY_READ 0 @@ -272,6 +273,7 @@ : "=&c"(size), "=&D" (__d0), "=&S" (__d1) \ : "r"(size & 3), "0"(size / 4), "1"(to), "2"(from) \ : "memory"); \ + conditional_schedule(); \ } while (0) #define __copy_user_zeroing(to,from,size) \ @@ -300,6 +302,7 @@ : "=&c"(size), "=&D" (__d0), "=&S" (__d1) \ : "r"(size & 3), "0"(size / 4), "1"(to), "2"(from) \ : "memory"); \ + conditional_schedule(); \ } while (0) /* We let the __ versions of copy_from/to_user inline, because they're often @@ -340,6 +343,7 @@ : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ : "1"(from), "2"(to), "0"(size/4) \ : "memory"); \ + conditional_schedule(); \ break; \ case 1: \ __asm__ __volatile__( \ @@ -430,6 +434,7 @@ : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ : "1"(from), "2"(to), "0"(size/4) \ : "memory"); \ + conditional_schedule(); \ break; \ case 1: \ __asm__ __volatile__( \ diff -urN 2.4.10pre9/include/linux/condsched.h copy-user-lat/include/linux/condsched.h --- 2.4.10pre9/include/linux/condsched.h Thu Jan 1 01:00:00 1970 +++ copy-user-lat/include/linux/condsched.h Fri Sep 14 06:38:01 2001 @@ -0,0 +1,14 @@ +#ifndef _LINUX_CONDSCHED_H +#define _LINUX_CONDSCHED_H + +#ifndef __ASSEMBLY__ +#define conditional_schedule() \ +do { \ + if (current->need_resched) { \ + current->state = TASK_RUNNING; \ + schedule(); \ + } \ +} while(0) +#endif + +#endif