From owner-freebsd-current Tue Jul 9 5:40:20 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1842437B400 for ; Tue, 9 Jul 2002 05:40:18 -0700 (PDT) Received: from mail.speakeasy.net (mail14.speakeasy.net [216.254.0.214]) by mx1.FreeBSD.org (Postfix) with ESMTP id A2D1243E3B for ; Tue, 9 Jul 2002 05:40:17 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 31309 invoked from network); 9 Jul 2002 12:40:16 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail14.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 9 Jul 2002 12:40:16 -0000 Received: from laptop.baldwin.cx (laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g69CeFf08599; Tue, 9 Jul 2002 08:40:15 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Tue, 09 Jul 2002 08:40:25 -0400 (EDT) From: John Baldwin To: John Baldwin Subject: RE: userret() , ast() and the end of syscalls Cc: FreeBSD current users Cc: FreeBSD current users , Julian Elischer Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 09-Jul-2002 John Baldwin wrote: > > On 09-Jul-2002 Julian Elischer wrote: >> >> A question to those who know.. >> >> why is userret() called both at the end of trap() or syscall() >> and also almost immediatly again (often) at the end of ast(). > > ast() is really a special form of a trap that is triggered by doing > a last-minute type check on return to userland to see if we still > have work to do. > >> It seems that really there is no one place that one can put code that will >> be called ONCE and ONLY ONCE as a thread progresses to userland. > > Sure there is. When you want an action done, set a thread flag marking > the request and set TDF_ASTPENDING. Then handle it in ast() if the flag > is set. Or, if this needs to happen on every return and not conditionally, then do it in userret() and use the state of a variable or some flag to note when you've already done it. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message