From owner-svn-src-all@freebsd.org Sun Aug 28 12:42:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13272B762FC for ; Sun, 28 Aug 2016 12:42:02 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F320D23 for ; Sun, 28 Aug 2016 12:42:00 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f44.google.com with SMTP id l89so84238475lfi.1 for ; Sun, 28 Aug 2016 05:42:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Ql3xqxQSlAuEtTK7JLYGOqdvGTisyNOoclJhBzEVpmg=; b=lRBSuAqxk/LHy5IPkgH80GTRF826msWKDgbfr7pMqGugXezQzvjqv8yBghH5zjnoOU 2lXMxau6oIy6bra4tOyHsV6mjhdEkzLIslOHPnza9cNv9kY+cJyPjs12RZY34qDPeTmQ nsJQcphxM1UE0tuRHquayEOzdWnFdJA4+sv/QUFAQb9TouPITl1N6dE7ZTMKK/P84Vfc pOIbhQVVebNqWgJfLyzSj9gEKl2wYEx+kbEvnpEmbRuZT7HLHSYf3ognBSpk++0w0Lp2 cW8bCi4e5/6Bs+cBVikawbC4iCe07pauzdr2tRM/X3numY/ql4U0AVlHABd96Lk55FqC OwOA== X-Gm-Message-State: AE9vXwM8Rg0h9jP9leA5ruDNBiQcGmDMPZTd6XA7AB5CIL/jfc462gB2ub1WKpphoIOP5g== X-Received: by 10.25.161.12 with SMTP id k12mr3465805lfe.22.1472388112585; Sun, 28 Aug 2016 05:41:52 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id i22sm5670319lfh.8.2016.08.28.05.41.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Aug 2016 05:41:52 -0700 (PDT) Subject: Re: svn commit: r304928 - in head/lib/libc: amd64/sys i386/sys sys To: Bruce Evans References: <201608272303.u7RN3N0D078505@repo.freebsd.org> <9bcf10db-de3f-33ce-e418-03ce3283ac90@freebsd.org> <20160828005637.GG83214@kib.kiev.ua> <59ac1812-7c77-b677-51c4-dcadc6b2be7f@freebsd.org> <20160828011501.GH83214@kib.kiev.ua> <80ad9e03-74bc-8c99-666f-787772bef2b9@freebsd.org> <20160828015210.GI83214@kib.kiev.ua> <70b3b052-4c29-c332-14bf-e50847636a8a@freebsd.org> <20160828144742.G1008@besplex.bde.org> Cc: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov Message-ID: Date: Sun, 28 Aug 2016 15:41:50 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160828144742.G1008@besplex.bde.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Aug 2016 12:42:02 -0000 On 28.08.2016 8:28, Bruce Evans wrote: >> How hard it will be to bring ptrace() to what C99 expects? Perhaps now >> time is suited well to change some obsoleted things. > > This should be safe to change, since portable applications like gdb can't > assume that the implemementation clobbers errno for them. It looks safe for me too. > Even FreeBSD's man page doesn't document the FreeBSD behaviour. It > documents, with poor wording, that applications must set errno as usual: > > %%% > RETURN VALUES > Some requests can cause ptrace() to return -1 as a non-error value; to > disambiguate, errno can be set to 0 before the call and checked > afterwards. > %%% > > The poor wording is just "errno can be set to 0". It _must_ be set to 0. > Also, the function gurantees to not clobber errno so that this checking > is guaranteed to work. Yes, I already mention this thing in my hour ago (related to your answer) reply. We even don't have documented that ptrace() itself overwrites errno, but document usual practice by setting it to 0 by its user instead. >> "conforming implementation may have extensions (including additional >> library functions), provided they do not alter the behavior of any >> strictly conforming program.3)" >> >> ptrace() is extension (additional library function) so can't set errno >> to 0 (it breaks strictly conforming program). > > Use of ptrace() makes a program very far from stricty conforming. Only > quality of implementation requires ptrace() to follow the usual rules. It was terms mistake from my side, I already correct myself in my hour ago reply.