mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
45e8778129
commit
6684ba202b
2 changed files with 76 additions and 8 deletions
|
@ -87,10 +87,26 @@ typedef struct {
|
|||
compat_sigset_word sig[_COMPAT_NSIG_WORDS];
|
||||
} compat_sigset_t;
|
||||
|
||||
/*
|
||||
* These functions operate strictly on struct compat_time*
|
||||
*/
|
||||
extern int get_compat_timespec(struct timespec *,
|
||||
const struct compat_timespec __user *);
|
||||
extern int put_compat_timespec(const struct timespec *,
|
||||
struct compat_timespec __user *);
|
||||
extern int get_compat_timeval(struct timeval *,
|
||||
const struct compat_timeval __user *);
|
||||
extern int put_compat_timeval(const struct timeval *,
|
||||
struct compat_timeval __user *);
|
||||
/*
|
||||
* These functions operate on 32- or 64-bit specs depending on
|
||||
* COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the
|
||||
* naming as compat_get/put_ rather than get/put_compat_.
|
||||
*/
|
||||
extern int compat_get_timespec(struct timespec *, const void __user *);
|
||||
extern int compat_put_timespec(const struct timespec *, void __user *);
|
||||
extern int compat_get_timeval(struct timeval *, const void __user *);
|
||||
extern int compat_put_timeval(const struct timeval *, void __user *);
|
||||
|
||||
struct compat_iovec {
|
||||
compat_uptr_t iov_base;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue