Commit ae40eb1e authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

[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: default avatarEric Dumazet <dada1@cosmosbay.com>
CC: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cb69cc52
...@@ -266,6 +266,23 @@ static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -266,6 +266,23 @@ static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
return err; return err;
} }
static int do_siocgstampns(unsigned int fd, unsigned int cmd, unsigned long arg)
{
struct compat_timespec __user *up = compat_ptr(arg);
struct timespec kts;
mm_segment_t old_fs = get_fs();
int err;
set_fs(KERNEL_DS);
err = sys_ioctl(fd, cmd, (unsigned long)&kts);
set_fs(old_fs);
if (!err) {
err = put_user(kts.tv_sec, &up->tv_sec);
err |= __put_user(kts.tv_nsec, &up->tv_nsec);
}
return err;
}
struct ifmap32 { struct ifmap32 {
compat_ulong_t mem_start; compat_ulong_t mem_start;
compat_ulong_t mem_end; compat_ulong_t mem_end;
...@@ -2437,6 +2454,7 @@ HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc) ...@@ -2437,6 +2454,7 @@ HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc)
/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */ /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
HANDLE_IOCTL(SIOCRTMSG, ret_einval) HANDLE_IOCTL(SIOCRTMSG, ret_einval)
HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns)
#endif #endif
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define SIOCSPGRP _IOW('s', 8, pid_t) #define SIOCSPGRP _IOW('s', 8, pid_t)
#define SIOCGPGRP _IOR('s', 9, pid_t) #define SIOCGPGRP _IOR('s', 9, pid_t)
#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* _ASM_ALPHA_SOCKIOS_H */ #endif /* _ASM_ALPHA_SOCKIOS_H */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif #endif
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif #endif
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* __ASM_AVR32_SOCKIOS_H */ #endif /* __ASM_AVR32_SOCKIOS_H */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif #endif
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* _ASM_SOCKIOS__ */ #endif /* _ASM_SOCKIOS__ */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* __ARCH_H8300_SOCKIOS__ */ #endif /* __ARCH_H8300_SOCKIOS__ */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif #endif
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* _ASM_IA64_SOCKIOS_H */ #endif /* _ASM_IA64_SOCKIOS_H */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* _ASM_M32R_SOCKIOS_H */ #endif /* _ASM_M32R_SOCKIOS_H */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* __ARCH_M68K_SOCKIOS__ */ #endif /* __ARCH_M68K_SOCKIOS__ */
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define SIOCSPGRP _IOW('s', 8, pid_t) #define SIOCSPGRP _IOW('s', 8, pid_t)
#define SIOCGPGRP _IOR('s', 9, pid_t) #define SIOCGPGRP _IOR('s', 9, pid_t)
#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* _ASM_SOCKIOS_H */ #endif /* _ASM_SOCKIOS_H */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif #endif
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* _ASM_POWERPC_SOCKIOS_H */ #endif /* _ASM_POWERPC_SOCKIOS_H */
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif #endif
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
#define SIOCSPGRP _IOW('s', 8, pid_t) #define SIOCSPGRP _IOW('s', 8, pid_t)
#define SIOCGPGRP _IOR('s', 9, pid_t) #define SIOCGPGRP _IOR('s', 9, pid_t)
#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ #define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */
#define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */
#endif /* __ASM_SH_SOCKIOS_H */ #endif /* __ASM_SH_SOCKIOS_H */
...@@ -20,5 +20,6 @@ ...@@ -20,5 +20,6 @@
#define SIOCSPGRP _IOW('s', 8, pid_t) #define SIOCSPGRP _IOW('s', 8, pid_t)
#define SIOCGPGRP _IOR('s', 9, pid_t) #define SIOCGPGRP _IOR('s', 9, pid_t)
#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ #define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */
#define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */
#endif /* __ASM_SH64_SOCKIOS_H */ #endif /* __ASM_SH64_SOCKIOS_H */
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* !(_ASM_SPARC_SOCKIOS_H) */ #endif /* !(_ASM_SPARC_SOCKIOS_H) */
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* !(_ASM_SPARC64_SOCKIOS_H) */ #endif /* !(_ASM_SPARC64_SOCKIOS_H) */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* __V850_SOCKIOS_H__ */ #endif /* __V850_SOCKIOS_H__ */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define FIOGETOWN 0x8903 #define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904 #define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905 #define SIOCATMARK 0x8905
#define SIOCGSTAMP 0x8906 /* Get stamp */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif #endif
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define SIOCSPGRP _IOW('s', 8, pid_t) #define SIOCSPGRP _IOW('s', 8, pid_t)
#define SIOCGPGRP _IOR('s', 9, pid_t) #define SIOCGPGRP _IOR('s', 9, pid_t)
#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
#endif /* _XTENSA_SOCKIOS_H */ #endif /* _XTENSA_SOCKIOS_H */
...@@ -25,6 +25,7 @@ struct compat_cmsghdr { ...@@ -25,6 +25,7 @@ struct compat_cmsghdr {
}; };
extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
#else /* defined(CONFIG_COMPAT) */ #else /* defined(CONFIG_COMPAT) */
#define compat_msghdr msghdr /* to avoid compiler warnings */ #define compat_msghdr msghdr /* to avoid compiler warnings */
......
...@@ -1329,6 +1329,7 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e ...@@ -1329,6 +1329,7 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
extern void sock_enable_timestamp(struct sock *sk); extern void sock_enable_timestamp(struct sock *sk);
extern int sock_get_timestamp(struct sock *, struct timeval __user *); extern int sock_get_timestamp(struct sock *, struct timeval __user *);
extern int sock_get_timestampns(struct sock *, struct timespec __user *);
/* /*
* Enable debug/info messages * Enable debug/info messages
......
...@@ -1771,6 +1771,9 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1771,6 +1771,9 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCGSTAMP: case SIOCGSTAMP:
rc = sock_get_timestamp(sk, argp); rc = sock_get_timestamp(sk, argp);
break; break;
case SIOCGSTAMPNS:
rc = sock_get_timestampns(sk, argp);
break;
/* Routing */ /* Routing */
case SIOCADDRT: case SIOCADDRT:
case SIOCDELRT: case SIOCDELRT:
......
...@@ -82,6 +82,9 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -82,6 +82,9 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCGSTAMP: /* borrowed from IP */ case SIOCGSTAMP: /* borrowed from IP */
error = sock_get_timestamp(sk, argp); error = sock_get_timestamp(sk, argp);
goto done; goto done;
case SIOCGSTAMPNS: /* borrowed from IP */
error = sock_get_timestampns(sk, argp);
goto done;
case ATM_SETSC: case ATM_SETSC:
printk(KERN_WARNING "ATM_SETSC is obsolete\n"); printk(KERN_WARNING "ATM_SETSC is obsolete\n");
error = 0; error = 0;
......
...@@ -1711,6 +1711,10 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1711,6 +1711,10 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
res = sock_get_timestamp(sk, argp); res = sock_get_timestamp(sk, argp);
break; break;
case SIOCGSTAMPNS:
res = sock_get_timestampns(sk, argp);
break;
case SIOCAX25ADDUID: /* Add a uid to the uid/call map table */ case SIOCAX25ADDUID: /* Add a uid to the uid/call map table */
case SIOCAX25DELUID: /* Delete a uid from the uid/call map table */ case SIOCAX25DELUID: /* Delete a uid from the uid/call map table */
case SIOCAX25GETUID: { case SIOCAX25GETUID: {
......
...@@ -564,6 +564,30 @@ int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) ...@@ -564,6 +564,30 @@ int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
} }
EXPORT_SYMBOL(compat_sock_get_timestamp); EXPORT_SYMBOL(compat_sock_get_timestamp);
int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
{
struct compat_timespec __user *ctv =
(struct compat_timespec __user*) userstamp;
int err = -ENOENT;
struct timespec ts;
if (!sock_flag(sk, SOCK_TIMESTAMP))
sock_enable_timestamp(sk);
ts = ktime_to_timespec(sk->sk_stamp);
if (ts.tv_sec == -1)
return err;
if (ts.tv_sec == 0) {
sk->sk_stamp = ktime_get_real();
ts = ktime_to_timespec(sk->sk_stamp);
}
err = 0;
if (put_user(ts.tv_sec, &ctv->tv_sec) ||
put_user(ts.tv_nsec, &ctv->tv_nsec))
err = -EFAULT;
return err;
}
EXPORT_SYMBOL(compat_sock_get_timestampns);
asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
{ {
......
...@@ -1567,6 +1567,22 @@ int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) ...@@ -1567,6 +1567,22 @@ int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
} }
EXPORT_SYMBOL(sock_get_timestamp); EXPORT_SYMBOL(sock_get_timestamp);
int sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
{
struct timespec ts;
if (!sock_flag(sk, SOCK_TIMESTAMP))
sock_enable_timestamp(sk);
ts = ktime_to_timespec(sk->sk_stamp);
if (ts.tv_sec == -1)
return -ENOENT;
if (ts.tv_sec == 0) {
sk->sk_stamp = ktime_get_real();
ts = ktime_to_timespec(sk->sk_stamp);
}
return copy_to_user(userstamp, &ts, sizeof(ts)) ? -EFAULT : 0;
}
EXPORT_SYMBOL(sock_get_timestampns);
void sock_enable_timestamp(struct sock *sk) void sock_enable_timestamp(struct sock *sk)
{ {
if (!sock_flag(sk, SOCK_TIMESTAMP)) { if (!sock_flag(sk, SOCK_TIMESTAMP)) {
......
...@@ -727,6 +727,9 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg ...@@ -727,6 +727,9 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg
case SIOCGSTAMP: case SIOCGSTAMP:
return sock_get_timestamp(sk, argp); return sock_get_timestamp(sk, argp);
case SIOCGSTAMPNS:
return sock_get_timestampns(sk, argp);
case SIOCSIFADDR: case SIOCSIFADDR:
case SIOCGIFADDR: case SIOCGIFADDR:
return ec_dev_ioctl(sock, cmd, argp); return ec_dev_ioctl(sock, cmd, argp);
......
...@@ -755,6 +755,9 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -755,6 +755,9 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCGSTAMP: case SIOCGSTAMP:
err = sock_get_timestamp(sk, (struct timeval __user *)arg); err = sock_get_timestamp(sk, (struct timeval __user *)arg);
break; break;
case SIOCGSTAMPNS:
err = sock_get_timestampns(sk, (struct timespec __user *)arg);
break;
case SIOCADDRT: case SIOCADDRT:
case SIOCDELRT: case SIOCDELRT:
case SIOCRTMSG: case SIOCRTMSG:
......
...@@ -443,6 +443,9 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -443,6 +443,9 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCGSTAMP: case SIOCGSTAMP:
return sock_get_timestamp(sk, (struct timeval __user *)arg); return sock_get_timestamp(sk, (struct timeval __user *)arg);
case SIOCGSTAMPNS:
return sock_get_timestampns(sk, (struct timespec __user *)arg);
case SIOCADDRT: case SIOCADDRT:
case SIOCDELRT: case SIOCDELRT:
......
...@@ -1209,6 +1209,12 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1209,6 +1209,12 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
release_sock(sk); release_sock(sk);
return ret; return ret;
case SIOCGSTAMPNS:
lock_sock(sk);
ret = sock_get_timestampns(sk, argp);
release_sock(sk);
return ret;
case SIOCGIFADDR: case SIOCGIFADDR:
case SIOCSIFADDR: case SIOCSIFADDR:
case SIOCGIFDSTADDR: case SIOCGIFDSTADDR:
......
...@@ -1545,6 +1545,8 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1545,6 +1545,8 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
} }
case SIOCGSTAMP: case SIOCGSTAMP:
return sock_get_timestamp(sk, (struct timeval __user *)arg); return sock_get_timestamp(sk, (struct timeval __user *)arg);
case SIOCGSTAMPNS:
return sock_get_timestampns(sk, (struct timespec __user *)arg);
#ifdef CONFIG_INET #ifdef CONFIG_INET
case SIOCADDRT: case SIOCADDRT:
......
...@@ -1296,6 +1296,9 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1296,6 +1296,9 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCGSTAMP: case SIOCGSTAMP:
return sock_get_timestamp(sk, (struct timeval __user *) argp); return sock_get_timestamp(sk, (struct timeval __user *) argp);
case SIOCGSTAMPNS:
return sock_get_timestampns(sk, (struct timespec __user *) argp);
case SIOCGIFADDR: case SIOCGIFADDR:
case SIOCSIFADDR: case SIOCSIFADDR:
case SIOCGIFDSTADDR: case SIOCGIFDSTADDR:
......
...@@ -1280,6 +1280,12 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1280,6 +1280,12 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
rc = sock_get_timestamp(sk, rc = sock_get_timestamp(sk,
(struct timeval __user *)argp); (struct timeval __user *)argp);
break; break;
case SIOCGSTAMPNS:
rc = -EINVAL;
if (sk)
rc = sock_get_timestampns(sk,
(struct timespec __user *)argp);
break;
case SIOCGIFADDR: case SIOCGIFADDR:
case SIOCSIFADDR: case SIOCSIFADDR:
case SIOCGIFDSTADDR: case SIOCGIFDSTADDR:
...@@ -1521,6 +1527,12 @@ static int compat_x25_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1521,6 +1527,12 @@ static int compat_x25_ioctl(struct socket *sock, unsigned int cmd,
rc = compat_sock_get_timestamp(sk, rc = compat_sock_get_timestamp(sk,
(struct timeval __user*)argp); (struct timeval __user*)argp);
break; break;
case SIOCGSTAMPNS:
rc = -EINVAL;
if (sk)
rc = compat_sock_get_timestampns(sk,
(struct timespec __user*)argp);
break;
case SIOCGIFADDR: case SIOCGIFADDR:
case SIOCSIFADDR: case SIOCSIFADDR:
case SIOCGIFDSTADDR: case SIOCGIFDSTADDR:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment