aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat_ioctl.c
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2007-03-18 20:33:16 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:04 -0400
commitae40eb1ef30ab4120bd3c8b7e3da99ee53d27a23 (patch)
treeb5ae288b3c27d13bde9648c41d7db3cfe1884bc2 /fs/compat_ioctl.c
parentcb69cc52364690d7789940c480b3a9490784b680 (diff)
[NET]: Introduce SIOCGSTAMPNS ioctl to get timestamps with nanosec resolution
Now network timestamps use ktime_t infrastructure, we can add a new ioctl() SIOCGSTAMPNS command to get timestamps in 'struct timespec'. User programs can thus access to nanosecond resolution. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> CC: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r--fs/compat_ioctl.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 8b1c5d8bf4ef..c68b055fa26e 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -266,6 +266,23 @@ static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
266 return err; 266 return err;
267} 267}
268 268
269static int do_siocgstampns(unsigned int fd, unsigned int cmd, unsigned long arg)
270{
271 struct compat_timespec __user *up = compat_ptr(arg);
272 struct timespec kts;
273 mm_segment_t old_fs = get_fs();
274 int err;
275
276 set_fs(KERNEL_DS);
277 err = sys_ioctl(fd, cmd, (unsigned long)&kts);
278 set_fs(old_fs);
279 if (!err) {
280 err = put_user(kts.tv_sec, &up->tv_sec);
281 err |= __put_user(kts.tv_nsec, &up->tv_nsec);
282 }
283 return err;
284}
285
269struct ifmap32 { 286struct ifmap32 {
270 compat_ulong_t mem_start; 287 compat_ulong_t mem_start;
271 compat_ulong_t mem_end; 288 compat_ulong_t mem_end;
@@ -2437,6 +2454,7 @@ HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc)
2437/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */ 2454/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
2438HANDLE_IOCTL(SIOCRTMSG, ret_einval) 2455HANDLE_IOCTL(SIOCRTMSG, ret_einval)
2439HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) 2456HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
2457HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns)
2440#endif 2458#endif
2441#ifdef CONFIG_BLOCK 2459#ifdef CONFIG_BLOCK
2442HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) 2460HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)