move compat select-related syscalls to fs/select.c
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -98,64 +98,8 @@ extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
|
||||
ktime_t *expires, unsigned long slack);
|
||||
extern u64 select_estimate_accuracy(struct timespec64 *tv);
|
||||
|
||||
|
||||
static inline int poll_schedule(struct poll_wqueues *pwq, int state)
|
||||
{
|
||||
return poll_schedule_timeout(pwq, state, NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Scalable version of the fd_set.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned long *in, *out, *ex;
|
||||
unsigned long *res_in, *res_out, *res_ex;
|
||||
} fd_set_bits;
|
||||
|
||||
/*
|
||||
* How many longwords for "nr" bits?
|
||||
*/
|
||||
#define FDS_BITPERLONG (8*sizeof(long))
|
||||
#define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
|
||||
#define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long))
|
||||
|
||||
/*
|
||||
* We do a VERIFY_WRITE here even though we are only reading this time:
|
||||
* we'll write to it eventually..
|
||||
*
|
||||
* Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
|
||||
*/
|
||||
static inline
|
||||
int get_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
|
||||
{
|
||||
nr = FDS_BYTES(nr);
|
||||
if (ufdset)
|
||||
return copy_from_user(fdset, ufdset, nr) ? -EFAULT : 0;
|
||||
|
||||
memset(fdset, 0, nr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long __must_check
|
||||
set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
|
||||
{
|
||||
if (ufdset)
|
||||
return __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline
|
||||
void zero_fd_set(unsigned long nr, unsigned long *fdset)
|
||||
{
|
||||
memset(fdset, 0, FDS_BYTES(nr));
|
||||
}
|
||||
|
||||
#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1)
|
||||
|
||||
extern int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time);
|
||||
extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
|
||||
struct timespec64 *end_time);
|
||||
extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
|
||||
fd_set __user *exp, struct timespec64 *end_time);
|
||||
|
||||
|
Reference in New Issue
Block a user