diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-13 16:12:23 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-13 16:12:23 -0800 |
commit | 463020ce428e2f00d4f33a383d6f39c7453a6854 (patch) | |
tree | c82d90c19e83c32b01c9748b4671640a670324e6 /arch/mips/kernel/linux32.c | |
parent | 58a3bb59973e33a428d72fa530a3d1d81feb0e8f (diff) | |
parent | 431dc8040354db65e4f8d4d4e21ae4fab41f5bc3 (diff) |
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
[MIPS] Fix sigset_t endianess swapping issues in 32-bit compat code.
[MIPS] Fix uniprocessor Sibyte builds.
[MIPS] Make entry.S a little more readable.
[MIPS] Remove stray instruction from __get_user_asm_ll32.
[MIPS] 32-bit: Fix warning about cast for fetching pointer from userspace.
[MIPS] DECstation: Fix irq handling
[MIPS] signals: make common _BLOCKABLE macro
[MIPS] signal: Move sigframe definition for native O32/N64 into signal.c
[MIPS] signal: Move {restore,setup}_sigcontext prototypes to their user
[MIPS] signal: Fix warnings in o32 compat code.
[MIPS] IP27: Enable N32 support in defconfig.
Revert "[MIPS] Fix warning in get_user when fetching pointer object from userspace."
[MIPS] Don't claim we support dma_declare_coherent_memory - we don't.
[MIPS] Unify dma-{coherent,noncoherent.ip27,ip32}
[MIPS] Improve branch prediction in ll/sc atomic operations.
Diffstat (limited to 'arch/mips/kernel/linux32.c')
-rw-r--r-- | arch/mips/kernel/linux32.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index ca7ad78f4de..fc4dd6c9dd8 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c @@ -39,6 +39,7 @@ #include <net/sock.h> #include <net/scm.h> +#include <asm/compat-signal.h> #include <asm/ipc.h> #include <asm/sim.h> #include <asm/uaccess.h> @@ -736,3 +737,49 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs) return do_fork(clone_flags, newsp, ®s, 0, parent_tidptr, child_tidptr); } + +/* + * Implement the event wait interface for the eventpoll file. It is the kernel + * part of the user space epoll_pwait(2). + */ +asmlinkage long compat_sys_epoll_pwait(int epfd, + struct epoll_event __user *events, int maxevents, int timeout, + const compat_sigset_t __user *sigmask, size_t sigsetsize) +{ + int error; + sigset_t ksigmask, sigsaved; + + /* + * If the caller wants a certain signal mask to be set during the wait, + * we apply it here. + */ + if (sigmask) { + if (sigsetsize != sizeof(sigset_t)) + return -EINVAL; + if (!access_ok(VERIFY_READ, sigmask, sizeof(ksigmask))) + return -EFAULT; + if (__copy_conv_sigset_from_user(&ksigmask, sigmask)) + return -EFAULT; + sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP)); + sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); + } + + error = sys_epoll_wait(epfd, events, maxevents, timeout); + + /* + * If we changed the signal mask, we need to restore the original one. + * In case we've got a signal while waiting, we do not restore the + * signal mask yet, and we allow do_signal() to deliver the signal on + * the way back to userspace, before the signal mask is restored. + */ + if (sigmask) { + if (error == -EINTR) { + memcpy(¤t->saved_sigmask, &sigsaved, + sizeof(sigsaved)); + set_thread_flag(TIF_RESTORE_SIGMASK); + } else + sigprocmask(SIG_SETMASK, &sigsaved, NULL); + } + + return error; +} |