From owner-svn-src-head@freebsd.org Thu Aug 13 07:11:46 2015 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 0920899F51A; Thu, 13 Aug 2015 07:11:46 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-oi0-x22f.google.com (mail-oi0-x22f.google.com [IPv6:2607:f8b0:4003:c06::22f]) (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 BB840B15; Thu, 13 Aug 2015 07:11:45 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by oiew67 with SMTP id w67so3505913oie.2; Thu, 13 Aug 2015 00:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=yxR3gLL9Zpe4JSxyHBaOW6r3WkDBFQDooxFGbS7r5Ko=; b=mfIGzL13IEY9Ib2m/77/hl7XK2yp0QAYwYtwUezDxPilbDwyoZkqDSKESUe+QPtkTB YY7NXkdhAFefydHQfz4u5GvQz1m/qiuhKzp1t9hxg8TGzL5ufAiHSxfo164pxVOg3jQ9 oXkZo1zYV6Waw+BtvVRihAw+MZfZM5j0UwyBn41eELZcNoqkm1XhT05xGwTp7raxScew 2A/z62U1PiE5v5E0incJzLksIX6LK3YT+rtDXcWZsR1QkeS8pr6hI/7XPttHUuoQtMgQ qVjMFCqtphMps2GyXQndFL9ku92jr2HE7xfsOc46NzIgmWB56pr5UXgYe7TVWoOAZJN5 aiUQ== MIME-Version: 1.0 X-Received: by 10.202.84.78 with SMTP id i75mr20018623oib.114.1439449904926; Thu, 13 Aug 2015 00:11:44 -0700 (PDT) Received: by 10.202.11.193 with HTTP; Thu, 13 Aug 2015 00:11:44 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: References: <201508130231.t7D2VOhc069855@repo.freebsd.org> <20150813134548.U1375@besplex.bde.org> Date: Thu, 13 Aug 2015 15:11:44 +0800 Message-ID: Subject: Re: svn commit: r286715 - head/lib/libc/string From: Marcelo Araujo To: Marcelo Araujo Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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: Thu, 13 Aug 2015 07:11:46 -0000 2015-08-13 14:51 GMT+08:00 Marcelo Araujo : > Hi Bruce, > > I sent it already in private to you, as we were talking about the > implementation of bcopy(3) on BSD and the POSIX one. > > So, I will send the patch again here, to let other developer give their > opinion about it. > > Thanks to explain over and over again. Now it is clear to me. > > > All the best. > > 2015-08-13 12:46 GMT+08:00 Bruce Evans : > >> On Thu, 13 Aug 2015, Marcelo Araujo wrote: >> >> Author: araujo >>> Date: Thu Aug 13 02:31:23 2015 >>> New Revision: 286715 >>> URL: https://svnweb.freebsd.org/changeset/base/286715 >>> >>> Log: >>> Remove the mention of memcpy(3) that is build on top of bcopy(3). >>> Fix some phrases to make it more clear. >>> >>> Differential Revision: D3378 >>> Reported by: bde@ >>> Reviewed by: wblock >>> Approved by: bapt, rodrigc (mentor) >>> Sponsored by: gandi.net >>> >> >> I don't like this version either :-). >> >> Modified: head/lib/libc/string/bcopy.3 >>> >>> ============================================================================== >>> --- head/lib/libc/string/bcopy.3 Thu Aug 13 01:04:26 2015 >>> (r286714) >>> +++ head/lib/libc/string/bcopy.3 Thu Aug 13 02:31:23 2015 >>> (r286715) >>> @@ -31,7 +31,7 @@ >>> .\" @(#)bcopy.3 8.1 (Berkeley) 6/4/93 >>> .\" $FreeBSD$ >>> .\" >>> -.Dd August 11, 2015 >>> +.Dd August 13, 2015 >>> .Dt BCOPY 3 >>> .Os >>> .Sh NAME >>> @@ -58,16 +58,14 @@ If >>> .Fa len >>> is zero, no bytes are copied. >>> .Pp >>> -This function is deprecated (marked as LEGACY in >>> -POSIX.1-2001): use >>> -.Xr memcpy 3 >>> -or >>> +This function is obsolete (marked as LEGACY in >>> +POSIX.1-2001): please use >>> >> >> This function is not obsolete, but is fully supported in FreeBSD. >> >> Its obsoletely doesn't follow at all from the clause in parentheses. >> LEGACY doesn't even mean obsolencent. In computerspeak it means >> "old stuff that we don't like". >> >> I think you got the "obsolete" wording from NetBSD. But I think >> NetBSD started deprecating it in 1995. It might really be obsolete >> for them after 20 years of deprecation. >> >> Please don't use pleasant nonsenses like "please" in man pages or >> comments. >> >> .Xr memmove 3 >>> in new programs. >>> >> >> Still not quite right. New programs should use the best function and >> that is usually memcpy(). Only old programs that are being roto-tilled >> should convert bcopy() to memmove() (so as to avoid having to understand >> them well enough to know if they do overlapped copies). >> >> -Note that the first two arguments are >>> -interchanged for >>> -.Xr memcpy 3 >>> -and >>> +Note that >>> +.Fn bcopy >>> +takes its src and dst arguments in the opposite >>> +order from >>> .Xr memmove 3 . >>> >> >> OK, except Xr should be Fn. ".Xr memmove 3" is a man page, not a >> function. >> Man pages don't take src and dst arguments :-). This normally shows up >> in the rendering -- in text mode, Fn gives highlighting but Xr doesn't. >> >> Now I notice more markup problems: the src and dst arguments are not >> marked >> up. In text mode, Fa gives highlighting for args. >> >> POSIX.1-2008 removes the specification of >>> .Fn bcopy . >>> >> >> Better put this before the LEGACY statement and maybe merge the LEGACY >> statement into the HISTORY section. Since I don't want to deprecate >> bcopy(), I would put this in the history section too. >> >> Technically, this function is not deprecated since it is still a standard >> BSD function in . The ifdef for this is already quite >> complicated and broken, thoough it only attempts to keep up with some >> of the POSIX churn: from strings.h: >> >> #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 >> int bcmp(const void *, const void *, size_t) __pure; /* LEGACY >> */ >> void bcopy(const void *, void *, size_t); /* LEGACY >> */ >> void bzero(void *, size_t); /* LEGACY >> */ >> #endif >> >> It is POSIX LEGACY, but standard BSD. >> >> The POSIX ifdef is quite broken: >> - before 1996, POSIX didn't have this function, but it also didn't have >> strings.h so there is no problem (the ifdef is vacuously correct) >> - between 1996 and 2001, there was an XSI version there may have been >> a POSIX version that had this function and too. The ifdef >> is wrong for any such version since it doesn't mention XSI. Such >> versions >> are just unsupported. >> - between 2001 and 2008, POSIX apparently required bcopy() (and the other >> functions) but didn't declare them anywhere, except in the XSI case it >> requires them to be declared in . The above supports the >> non-XSI case of this. The XSI case is broken as in any 1996-2001 >> versions. >> - the ifdef is not up to date with changing LEGACY to OBSOLETE, but since >> LEGACY already resulted in omission of the prototypes in the non-XSI >> case, >> nothing needed to be changed in this case, and since the XSI case is >> unsupported nothing need to be changed to turn off the prototypes for >> XSI >> either. >> >> Correct code here wouldn't have the POSIX ifdef or LEGACY comments, but >> might having a comment saying that XSI is intentionally unsupported. >> XSI messes elswhere are supported, and I am suprised that not supporting >> it here doesn't cause problems. >> >> Ifdefs for historical mistakes would cause much larger messes if they >> were complete. Just near here, there is the mess of the >> and . 1980's source code had messy ifdefs in applications >> for this. C90 didn't exactly help by standardizing the SYSVish >> . POSIX.1-2001 actively harmed by restoring the BSDish >> . FreeBSD handles this problem by including >> in if __BSD_VISIBLE and not documenting the details in man >> pages. contains mostly BSD functions, and man pages >> including bcopy(3) say to include , but most applications >> only include , which was where bcopy() was in 4.4.BSD-Lite, >> and where it still is by the #include hack, but not where it is >> according to the man page. The ifdefs here seem to be just messy >> enough to detect the error of using the wrong include in the >> !__BSD_VISIBLE case. >> >> Bruce >> > > Hi guys, Here is the review: https://reviews.freebsd.org/D3374 The bcopy() was removed in IEEE Std 1003.1-2008 and it is marked as LEGACY in IEEE Std 1003.1-2004. However, BSD has its implementation before IEEE Std 1003.1-2001. In my understood it is obsolete on POSIX, but not truly obsolete for FreeBSD. So I believe, this patch now address it in the correct way. Feel free to add yourself in the review and share with me your point of view, or reply here or even direct to me. Best Regards, -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_)