From owner-freebsd-threads@FreeBSD.ORG Sun Aug 17 09:12:56 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 E8C5D37B401; Sun, 17 Aug 2003 09:12:56 -0700 (PDT) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id E2E6643F75; Sun, 17 Aug 2003 09:12:55 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from dhcp42.pn.xcllnt.net (dhcp42.pn.xcllnt.net [192.168.4.242]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id h7HGCtwO097084; Sun, 17 Aug 2003 09:12:55 -0700 (PDT) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp42.pn.xcllnt.net (localhost [127.0.0.1]) by dhcp42.pn.xcllnt.net (8.12.9/8.12.9) with ESMTP id h7HGCtR6000643; Sun, 17 Aug 2003 09:12:55 -0700 (PDT) (envelope-from marcel@dhcp42.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp42.pn.xcllnt.net (8.12.9/8.12.9/Submit) id h7HGCtc9000642; Sun, 17 Aug 2003 09:12:55 -0700 (PDT) (envelope-from marcel) Date: Sun, 17 Aug 2003 09:12:55 -0700 From: Marcel Moolenaar To: deischen@freebsd.org Message-ID: <20030817161255.GA567@dhcp42.pn.xcllnt.net> References: <20030817004956.GA52247@dhcp42.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i 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 List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Aug 2003 16:12:57 -0000 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. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net