From owner-freebsd-threads@FreeBSD.ORG Sun Aug 17 10:19:38 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6E39B37B404 for ; Sun, 17 Aug 2003 10:19:38 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 517B343FBF for ; Sun, 17 Aug 2003 10:19:37 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.8/8.12.1) with ESMTP id h7HHJauN013035; Sun, 17 Aug 2003 13:19:36 -0400 (EDT) Date: Sun, 17 Aug 2003 13:19:36 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Marcel Moolenaar In-Reply-To: <20030817161255.GA567@dhcp42.pn.xcllnt.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: KSE/ia64: NULL thread pointer in _thr_sig_add() X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Aug 2003 17:19:38 -0000 On Sun, 17 Aug 2003, Marcel Moolenaar wrote: > On Sun, Aug 17, 2003 at 08:54:56AM -0400, Daniel Eischen wrote: > > > > > > > > One question. When you call (the syscall) setcontext() from > > > > _ia64_break_setcontext(), do you ignore the signal mask (uc.uc_sigmask)? > > > > > > Good point. I don't think so. > > > > OK, this will cause signal handling problems. You can > > use another flag, but that would dirty up MI setcontext(). > > Perhaps a separate ia64-specific system call? > > I actually have been thinking about using a flag. One that simply > indicates that the sigmask field is valid or not. The advantage > of such flag is that it makes the general interaction with user > land versions of getcontext() much more predictable and increases > the overall applicability of the *context syscalls. > > For example: libthr uses getcontext(2) but is not interested in > the sigmask. It simply uses the syscall as an initialization for > new threads. The context is passed to thr_create where we only > use the mcontext part to setup the registers. libkse tries to > avoid the syscalls. The userland versions don't save or restore > signal masks. There too we use contexts without actually being > interested in sigmasks. Also in libkse we see that the contexts > created in the kernel and given to userland are not contexts that > contains sigmasks. We simply copyout the mcontext part of the > ucontext. So, it appears that most of our uses of contexts are > such that we don't need to save and/or restore sigmasks. > > I think an UCF_SIGMASK flag to indicate that the context has a > valid sigmask is a logical or natural way to have setcontext(2) > operate well with getcontext(2), which always defines contexts > with sigmasks and userland versions of getcontext() or other > more specific uses of contexts that may or may not have a need > to save the sigmask. > > Reasoning differently: if we were to introduce a new syscall, > then the syscall would in effect be a clone of setcontext(2) > with the difference that we don't restore a part of the context. > This is duplication to avoid variation. Also, with a new syscall > we introduce the notion of having 2 seperate contexts. This not > only begs for a getcontext() clone that does not save the sigmask, > but also begs for a flag to differentiate between those 2 contexts. OK. I mostly wanted to avoid #if defined(ia64) in kern_context.c thinking the flag would have been in mc_flags. Please get rid of UCF_SWAPPED while you're at it; it's no longer used. -- Dan Eischen