From: Shaun Pereira Get socket timestamp handler function that does not use the ioctl32_hash_table. Signed-off-by: Shaun Pereira Acked-by: Arnd Bergmann Signed-off-by: Andrew Morton --- include/net/compat.h | 5 ++++- net/compat.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff -puN include/net/compat.h~net-socket-timestamp-32-bit-handler-for-64-bit-kernel include/net/compat.h --- devel/include/net/compat.h~net-socket-timestamp-32-bit-handler-for-64-bit-kernel 2006-03-11 02:45:48.000000000 -0800 +++ devel-akpm/include/net/compat.h 2006-03-11 02:45:48.000000000 -0800 @@ -23,6 +23,10 @@ struct compat_cmsghdr { compat_int_t cmsg_type; }; +struct sock; + +extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); + #else /* defined(CONFIG_COMPAT) */ #define compat_msghdr msghdr /* to avoid compiler warnings */ #endif /* defined(CONFIG_COMPAT) */ @@ -34,7 +38,6 @@ extern asmlinkage long compat_sys_recvms extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); -struct sock; extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); #endif /* NET_COMPAT_H */ diff -puN net/compat.c~net-socket-timestamp-32-bit-handler-for-64-bit-kernel net/compat.c --- devel/net/compat.c~net-socket-timestamp-32-bit-handler-for-64-bit-kernel 2006-03-11 02:45:48.000000000 -0800 +++ devel-akpm/net/compat.c 2006-03-11 02:45:48.000000000 -0800 @@ -543,6 +543,25 @@ static int compat_sock_getsockopt(struct return sock_getsockopt(sock, level, optname, optval, optlen); } +int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) +{ + struct compat_timeval __user *ctv = + (struct compat_timeval __user*) userstamp; + int err = -ENOENT; + + if (!sock_flag(sk, SOCK_TIMESTAMP)) + sock_enable_timestamp(sk); + if (sk->sk_stamp.tv_sec == -1) + return err; + if (sk->sk_stamp.tv_sec == 0) + do_gettimeofday(&sk->sk_stamp); + if (put_user(sk->sk_stamp.tv_sec, &ctv->tv_sec) || + put_user(sk->sk_stamp.tv_usec, &ctv->tv_usec)) + err = -EFAULT; + return err; +} +EXPORT_SYMBOL(compat_sock_get_timestamp); + asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen) { _