aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compat.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-02-19 20:38:00 -0500
committerH. Peter Anvin <hpa@zytor.com>2012-02-20 15:48:47 -0500
commit6684ba202b5ab2f36d574c72fe50c207d99b3e35 (patch)
tree58f692f4f827bba86120c0af385fb8c768889591 /include/linux/compat.h
parent45e877812926c69d643d6274347f79513a4ee934 (diff)
compat: Add helper functions to read/write struct timeval, timespec
Add helper functions to read and write struct timeval and struct timespec from userspace. We already had helper functions for reading and writing struct compat_timespec; add a set of functions to do the same with struct timeval, and add a second suite of functions which can be sensitive to COMPAT_USE_64BIT_TIME and access either 32- or 64-bit time structures. This also exports these helper functions to modules. Rename the existing inlines for converting between struct compat_timeval and native struct timespec so we can have a saner naming convention for the exported functions. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'include/linux/compat.h')
-rw-r--r--include/linux/compat.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 1be91c04824..a82e452bbdb 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -87,10 +87,26 @@ typedef struct {
87 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 87 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
88} compat_sigset_t; 88} compat_sigset_t;
89 89
90/*
91 * These functions operate strictly on struct compat_time*
92 */
90extern int get_compat_timespec(struct timespec *, 93extern int get_compat_timespec(struct timespec *,
91 const struct compat_timespec __user *); 94 const struct compat_timespec __user *);
92extern int put_compat_timespec(const struct timespec *, 95extern int put_compat_timespec(const struct timespec *,
93 struct compat_timespec __user *); 96 struct compat_timespec __user *);
97extern int get_compat_timeval(struct timeval *,
98 const struct compat_timeval __user *);
99extern int put_compat_timeval(const struct timeval *,
100 struct compat_timeval __user *);
101/*
102 * These functions operate on 32- or 64-bit specs depending on
103 * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the
104 * naming as compat_get/put_ rather than get/put_compat_.
105 */
106extern int compat_get_timespec(struct timespec *, const void __user *);
107extern int compat_put_timespec(const struct timespec *, void __user *);
108extern int compat_get_timeval(struct timeval *, const void __user *);
109extern int compat_put_timeval(const struct timeval *, void __user *);
94 110
95struct compat_iovec { 111struct compat_iovec {
96 compat_uptr_t iov_base; 112 compat_uptr_t iov_base;