Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Aug 2001 22:17:37 -0700
From:      Julian Elischer <julian@elischer.org>
To:        Daniel Eischen <eischen@vigrid.com>
Cc:        tlambert2@mindspring.com, Archie Cobbs <archie@dellroad.org>, arch@FreeBSD.ORG
Subject:   Re: changes to BSD APIs for THREADS support
Message-ID:  <3B89D7F1.74D834C9@elischer.org>
References:  <Pine.SUN.3.91.1010826224344.27633A-100000@pcnet1.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Eischen wrote:

> If the signal handler is installed with SA_RESTART, how does the
> UTS restart the thread after normal return of the signal handler
> (as opposed to when the thread longjmps out of the signal handler
> in which case the system call will never be restarted)?

well the signal will be delivered to the UTS as a pure notification.
The UTS decides that it should be deliverd to thread (X).
The UTS discoveres that thread (X) is suspended in the kernel.
It sends a "cancel syscall" bomb to thread (X).
Thread (X) returns to the user boundary. 
Here, we have two possibilities
(A) the kernel stores the state of the thread as if it had finished the 
    syscall.
-or-
(B) the kernel stores the state of the thread as if it was about to do 
    the syscall.
In either case, the UTS can compensate. to get the other case.
The signal trampoline code is placed on the stack of the thread.
The saved context is placed correctly in the trampoline code (as now).
The signal is processed.
The system call is either reported as failed, or re-done. (depending
			on what we chose to do) 

> 
> Does it save the context from just after being canceled in
> the kernel, and then munge it a bit to restart the system call
> again?  Or is the context already restartable and it needs to
> be munged to bypass the system call (returning EINTR)?  Can
> we tell the kernel what type of context to pass back based
> on whether SA_RESTART is set or not?

we could do it either way.. we could even make it an argument to
the "cancel_syscall(thread, how)" syscall.

Which ever you'd prefer..


> 
> --
> Dan Eischen

-- 
+------------------------------------+       ______ _  __
|   __--_|\  Julian Elischer         |       \     U \/ / hard at work in 
|  /       \ julian@elischer.org     +------>x   USA    \ a very strange
| (   OZ    )                                \___   ___ | country !
+- X_.---._/    presently in San Francisco       \_/   \\
          v

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B89D7F1.74D834C9>