From 421807c3153d96e440a93939cc8ad56b5dcee898 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 15 Oct 2000 22:33:01 +0000 Subject: [PATCH] new --- include/asm/uaccess.h | 48 +++++++++++++++++++++++++++++++++++++++++++ include/linux/wait.h | 16 +++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 include/asm/uaccess.h create mode 100644 include/linux/wait.h diff --git a/include/asm/uaccess.h b/include/asm/uaccess.h new file mode 100644 index 00000000..01235476 --- /dev/null +++ b/include/asm/uaccess.h @@ -0,0 +1,48 @@ + +#ifndef __COMPAT_ASM_UACCESS_H +#define __COMPAT_ASM_UACCESS_H + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) +/* unknown, approx 2.1.4 */ + + +#include + +static inline int copy_to_user(void * to,const void *from,unsigned long n_bytes) +{ + int i; + + if((i=verify_area(VERIFY_WRITE,to,n_bytes)) != 0) + return i; + memcpy_tofs(to,from,n_bytes); + return 0; +} + +static inline int copy_from_user(void * to,const void *from,unsigned long n_bytes) +{ + int i; + if((i=verify_area(VERIFY_READ,from,n_bytes))!=0) + return i; + memcpy_fromfs(to,from,n_bytes); + return 0; +} + +static inline int clear_user(void * mem,unsigned long len) +{ + char *cmem=mem; + + if(verify_area(VERIFY_WRITE,mem,len)) + return len; + /* this is slow, but I'm lazy */ + while(len--){put_user(0,cmem);cmem++;} + return 0; +} + +#else + +#include_next + +#endif + +#endif + diff --git a/include/linux/wait.h b/include/linux/wait.h new file mode 100644 index 00000000..43a378cf --- /dev/null +++ b/include/linux/wait.h @@ -0,0 +1,16 @@ + +#ifndef __COMPAT_LINUX_WAIT_H +#define __COMPAT_LINUX_WAIT_H + +#include + +#include_next + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) +typedef struct wait_queue *wait_queue_head_t; +#define DECLARE_WAITQUEUE(x,y) struct wait_queue x={y,NULL} +#define init_waitqueue_head(x) +#endif + +#endif + -- 2.26.2