From owner-p4-projects@FreeBSD.ORG Sat Nov 20 04:02:13 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 344C516A4D0; Sat, 20 Nov 2004 04:02:13 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0F85616A4CE for ; Sat, 20 Nov 2004 04:02:13 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id F24F843D55 for ; Sat, 20 Nov 2004 04:02:12 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id iAK42CVE004925 for ; Sat, 20 Nov 2004 04:02:12 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iAK42CNC004922 for perforce@freebsd.org; Sat, 20 Nov 2004 04:02:12 GMT (envelope-from davidxu@freebsd.org) Date: Sat, 20 Nov 2004 04:02:12 GMT Message-Id: <200411200402.iAK42CNC004922@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to davidxu@freebsd.org using -f From: David Xu To: Perforce Change Reviews Subject: PERFORCE change 65504 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Nov 2004 04:02:13 -0000 http://perforce.freebsd.org/chv.cgi?CH=65504 Change 65504 by davidxu@davidxu_alona on 2004/11/20 04:01:43 1. simplify code. 2. undef errno. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthread/sys/thr_error.c#2 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthread/sys/thr_error.c#2 (text+ko) ==== @@ -37,22 +37,16 @@ #include "libc_private.h" #include "thr_private.h" +#undef errno extern int errno; int * __error(void) { - struct pthread *curthread; + struct pthread *curthread = _get_curthread(); - if (__isthreaded == 0) + if (curthread != NULL && curthread != _thr_initial) + return (&curthread->error); + else return (&errno); - else if (_kse_in_critical()) - return &(_get_curkse()->k_error); - else { - curthread = _get_curthread(); - if ((curthread == NULL) || (curthread == _thr_initial)) - return (&errno); - else - return (&curthread->error); - } }