* [PATCH] m68k: wire up sys_restart_syscall
@ 2008-12-29 18:34 Andreas Schwab
2008-12-30 12:12 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2008-12-29 18:34 UTC (permalink / raw)
To: linux-m68k
Make restart blocks working, required for proper syscall restarting.
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
arch/m68k/kernel/entry.S | 2 +-
arch/m68k/kernel/signal.c | 15 +++++++++++++++
include/asm-m68k/unistd.h | 4 +---
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index f28404d..5b78082 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -424,7 +424,7 @@ resume:
.data
ALIGN
sys_call_table:
- .long sys_ni_syscall /* 0 - old "setup()" system call*/
+ .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
.long sys_exit
.long sys_fork
.long sys_read
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index d1e9220..842bfd9 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -348,6 +348,9 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __u
struct sigcontext context;
int err;
+ /* Always make any pending restarted system calls return -EINTR */
+ current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
/* get previous context */
if (copy_from_user(&context, usc, sizeof(context)))
goto badframe;
@@ -433,6 +436,9 @@ rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
unsigned long usp;
int err;
+ /* Always make any pending restarted system calls return -EINTR */
+ current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
err = __get_user(temp, &uc->uc_mcontext.version);
if (temp != MCONTEXT_VERSION)
goto badframe;
@@ -959,6 +965,15 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
regs->d0 = -EINTR;
break;
+ case -ERESTART_RESTARTBLOCK:
+ if (!has_handler) {
+ regs->d0 = __NR_restart_syscall;
+ regs->pc -= 2;
+ break;
+ }
+ regs->d0 = -EINTR;
+ break;
+
case -ERESTARTSYS:
if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) {
regs->d0 = -EINTR;
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index 965abb8..3c19027 100644
--- a/include/asm-m68k/unistd.h
+++ b/include/asm-m68k/unistd.h
@@ -5,6 +5,7 @@
* This file contains the system call numbers.
*/
+#define __NR_restart_syscall 0
#define __NR_exit 1
#define __NR_fork 2
#define __NR_read 3
@@ -359,9 +360,6 @@
#define __ARCH_WANT_SYS_SIGPROCMASK
#define __ARCH_WANT_SYS_RT_SIGACTION
-/* whitelist for checksyscalls */
-#define __IGNORE_restart_syscall
-
/*
* "Conditional" syscalls
*
--
1.6.1
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] m68k: wire up sys_restart_syscall
2008-12-29 18:34 [PATCH] m68k: wire up sys_restart_syscall Andreas Schwab
@ 2008-12-30 12:12 ` Geert Uytterhoeven
2008-12-30 13:09 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2008-12-30 12:12 UTC (permalink / raw)
To: Andreas Schwab; +Cc: linux-m68k
Hi Andreas,
On Mon, 29 Dec 2008, Andreas Schwab wrote:
> Make restart blocks working, required for proper syscall restarting.
Thanks!
Is there an easy way to test this?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] m68k: wire up sys_restart_syscall
2008-12-30 12:12 ` Geert Uytterhoeven
@ 2008-12-30 13:09 ` Andreas Schwab
2008-12-30 14:31 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2008-12-30 13:09 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k
Geert Uytterhoeven <geert@linux-m68k.org> writes:
> Is there an easy way to test this?
Run 'sleep 100' and then attach to it with strace. Without this patch
the nanosleep syscall returns with an error instead of being restarted.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] m68k: wire up sys_restart_syscall
2008-12-30 13:09 ` Andreas Schwab
@ 2008-12-30 14:31 ` Geert Uytterhoeven
0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2008-12-30 14:31 UTC (permalink / raw)
To: Andreas Schwab; +Cc: linux-m68k
On Tue, 30 Dec 2008, Andreas Schwab wrote:
> Geert Uytterhoeven <geert@linux-m68k.org> writes:
>
> > Is there an easy way to test this?
>
> Run 'sleep 100' and then attach to it with strace. Without this patch
> the nanosleep syscall returns with an error instead of being restarted.
Thanks! Applied.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-30 14:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-29 18:34 [PATCH] m68k: wire up sys_restart_syscall Andreas Schwab
2008-12-30 12:12 ` Geert Uytterhoeven
2008-12-30 13:09 ` Andreas Schwab
2008-12-30 14:31 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox