From owner-svn-src-head@freebsd.org Sun Aug 28 12:41:55 2016 Return-Path: Delivered-To: svn-src-head@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 93347B76231 for ; Sun, 28 Aug 2016 12:41:55 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) (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 210F3CCA for ; Sun, 28 Aug 2016 12:41:54 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f54.google.com with SMTP id g62so84120096lfe.3 for ; Sun, 28 Aug 2016 05:41:54 -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=a1qWzc5Xl0HIe66lqQulMWStRl4rZlMrNFd5BdPNEkM3wARQK93ax0AdXJw3wdZXZX lf19gpqadpfYuzeOMOS9piQYR7Ohk/gmxGbUIqfVPxDqSIOS24cCSVSwDzSQAAPZgTky 2vF7EXMGL0oFNTmk5t118YqFsrZX5sb5myATJefVj8PIl/WSO0l3vE26hOwezYFFf5p3 2R+ObnXOpVggfmzusuOAksWtKZ4WUnwo2NEVMK5cupdsuXVfmj40yaviMJTL9fjnl8My IT6rKtluvbnRMd0eSff6DXq5JxXUsCH2R40cy4Yh/nFK1vwy0beD2o1FKt+8lip1zXVo lDhQ== X-Gm-Message-State: AE9vXwPZOOyVCVDS7lI4nYVNrCwJ9yu66znvZco5rb7k7pJbu02ColmYe4xsAe4q/5OYaw== 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-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Aug 2016 12:41:55 -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.