linux-um archives
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@addtoit.com>
To: "Stroesser, Bodo" <Bodo.Stroesser@fujitsu-siemens.com>
Cc: user-mode-linux-devel@lists.sourceforge.net,
	BlaisorBlade <blaisorblade_spam@yahoo.it>
Subject: Re: [uml-devel] Minor problems with interrupted systemcalls
Date: Fri, 24 Sep 2004 17:32:36 -0400	[thread overview]
Message-ID: <200409242132.i8OLWaZX003940@ccure.user-mode-linux.org> (raw)
In-Reply-To: Your message of "Wed, 22 Sep 2004 19:12:37 +0200." <8B6FF516CBA0194AB0996705076B02520F7C38@ABGEX01E.abg.fsc.net>

Change the interface to handle_signal so that it doesn't take the system call
return value as an argument and eliminate its return value.
kern_do_signal also now doesn't return immediately after determining that
there is no signal to deliver.

Index: 2.6.9-rc/arch/um/kernel/signal_kern.c
===================================================================
--- 2.6.9-rc.orig/arch/um/kernel/signal_kern.c	2004-09-24 16:04:00.000000000 -0400
+++ 2.6.9-rc/arch/um/kernel/signal_kern.c	2004-09-24 16:17:04.000000000 -0400
@@ -38,16 +38,17 @@
 /*
  * OK, we're invoking a handler
  */	
-static int handle_signal(struct pt_regs *regs, unsigned long signr, 
-			 struct k_sigaction *ka, siginfo_t *info, 
-			 sigset_t *oldset, int error)
+static void handle_signal(struct pt_regs *regs, unsigned long signr, 
+			  struct k_sigaction *ka, siginfo_t *info, 
+			  sigset_t *oldset)
 {
         __sighandler_t handler;
 	void (*restorer)(void);
 	unsigned long sp;
 	sigset_t save;
-	int err, ret;
+	int error, err, ret;
 
+	error = PT_REGS_SYSCALL_RET(&current->thread.regs);
 	ret = 0;
 	/* Always make any pending restarted system calls return -EINTR */
 	current_thread_info()->restart_block.fn = do_no_restart_syscall;
@@ -109,31 +110,25 @@
 	else
 		err = setup_signal_stack_sc(sp, signr, (unsigned long) handler,
 					    restorer, regs, &save);
-	if(err) goto segv;
-
-	return(0);
- segv:
-	force_sigsegv(signr, current);
-	return(1);
+	if(err)
+		force_sigsegv(signr, current);
 }
 
-static int kern_do_signal(struct pt_regs *regs, sigset_t *oldset, int error)
+static int kern_do_signal(struct pt_regs *regs, sigset_t *oldset)
 {
 	struct k_sigaction ka_copy;
 	siginfo_t info;
-	int err, sig;
+	int sig;
 
 	if (!oldset)
 		oldset = &current->blocked;
 
 	sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL);
-	if(sig == 0)
-		return(0);
-
-	/* Whee!  Actually deliver the signal.  */
-	err = handle_signal(regs, sig, &ka_copy, &info, oldset, error);
-	if(!err)
+	if(sig > 0){
+		/* Whee!  Actually deliver the signal.  */
+		handle_signal(regs, sig, &ka_copy, &info, oldset);
 		return(1);
+	}
 
 	/* Did we come from a system call? */
 	if(PT_REGS_SYSCALL_NR(regs) >= 0){
@@ -165,8 +160,7 @@
 
 int do_signal(void)
 {
-	return(kern_do_signal(&current->thread.regs, NULL,
-			      PT_REGS_SYSCALL_RET(&current->thread.regs)));
+	return(kern_do_signal(&current->thread.regs, NULL));
 }
 
 /*
@@ -183,10 +177,11 @@
 	recalc_sigpending();
 	spin_unlock_irq(&current->sighand->siglock);
 
+	PT_REGS_SYSCALL_RET(&current->thread.regs) = -EINTR;
 	while (1) {
 		current->state = TASK_INTERRUPTIBLE;
 		schedule();
-		if(kern_do_signal(&current->thread.regs, &saveset, -EINTR))
+		if(kern_do_signal(&current->thread.regs, &saveset))
 			return(-EINTR);
 	}
 }
@@ -209,10 +204,11 @@
 	recalc_sigpending();
 	spin_unlock_irq(&current->sighand->siglock);
 
+	PT_REGS_SYSCALL_RET(&current->thread.regs) = -EINTR;
 	while (1) {
 		current->state = TASK_INTERRUPTIBLE;
 		schedule();
-		if (kern_do_signal(&current->thread.regs, &saveset, -EINTR))
+		if (kern_do_signal(&current->thread.regs, &saveset))
 			return(-EINTR);
 	}
 }




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

  parent reply	other threads:[~2004-09-24 20:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-22 17:12 [uml-devel] Minor problems with interrupted systemcalls Stroesser, Bodo
2004-09-24 21:32 ` Jeff Dike
2004-09-24 21:32 ` Jeff Dike
2004-09-24 21:32 ` Jeff Dike [this message]
2004-09-24 21:32 ` Jeff Dike
2004-09-24 21:32 ` Jeff Dike
  -- strict thread matches above, loose matches on Subject: below --
2004-09-29 16:34 Stroesser, Bodo
2004-09-29 21:10 ` Jeff Dike
2004-09-20 10:06 Stroesser, Bodo
2004-09-21 17:31 ` BlaisorBlade
2004-09-17 17:46 Stroesser, Bodo
2004-09-18 16:17 ` BlaisorBlade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200409242132.i8OLWaZX003940@ccure.user-mode-linux.org \
    --to=jdike@addtoit.com \
    --cc=Bodo.Stroesser@fujitsu-siemens.com \
    --cc=blaisorblade_spam@yahoo.it \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox