[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070627101449.GH13886@enneenne.com>
Date: Wed, 27 Jun 2007 12:14:49 +0200
From: Rodolfo Giometti <giometti@...eenne.com>
To: David Woodhouse <dwmw2@...radead.org>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] LinuxPPS (with new syscalls API)
On Tue, Jun 26, 2007 at 06:38:40PM +0100, David Woodhouse wrote:
>
> 64-bit kernels can run 32-bit userspace programs. But some structures
> come out _differently_ between 32-bit and 64-bit compilation, so the
> system call needs a special 'compat' handler instead of just running the
> normal 64-bit system call.
>
> The 'struct timespec' is one structure which is sometimes different for
> 32-bit vs. 64-bit, so any system call taking a 'struct timespec' must
> have a separate compat_sys_xxxx() to handle that. See something like
> compat_sys_clock_settime() in kernel/compat.c for an example (but don't
> use set_fs() like it does; just see how it handles the compat_timespec).
Did you mean something like this?
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index befe292..3e401e5 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -26,6 +26,7 @@
#include <linux/init.h>
#include <linux/linkage.h>
#include <linux/sched.h>
+#include <linux/compat.h>
#include <linux/pps.h>
#include <asm/uaccess.h>
@@ -284,9 +285,15 @@ sys_time_pps_getcap_exit:
return ret;
}
+#ifdef CONFIG_COMPAT
asmlinkage long sys_time_pps_fetch(int source, const int tsformat,
- struct pps_info __user *info,
- const struct timespec __user *timeout)
+ struct pps_info __user *info,
+ const struct compat_timespec __user *timeout)
+#else
+asmlinkage long sys_time_pps_fetch(int source, const int tsformat,
+ struct pps_info __user *info,
+ const struct timespec __user *timeout)
+#endif
{
unsigned long ticks;
struct pps_info pi;
@@ -318,7 +325,11 @@ asmlinkage long sys_time_pps_fetch(int source, const int ts
/* Manage the timeout */
if (timeout) {
+#ifdef CONFIG_COMPAT
+ ret = get_compat_timespec(&to, timeout);
+#else
ret = copy_from_user(&to, timeout, sizeof(struct timespec));
+#endif
if (ret)
goto sys_time_pps_fetch_exit;
if (to.tv_sec != -1) {
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@...eenne.com
Linux Device Driver giometti@...dd.com
Embedded Systems giometti@...ux.it
UNIX programming phone: +39 349 2432127
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists