From owner-svn-src-head@freebsd.org Wed Aug 12 04:06:10 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 4E3FA99FBAD; Wed, 12 Aug 2015 04:06:10 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-ob0-x234.google.com (mail-ob0-x234.google.com [IPv6:2607:f8b0:4003:c01::234]) (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 12F79CB7; Wed, 12 Aug 2015 04:06:10 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by obbop1 with SMTP id op1so4217496obb.2; Tue, 11 Aug 2015 21:06:09 -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=83/zYcjJmGjthccb79rf6Vb8MOiZRDgjBbvbUc6B+CM=; b=JihcQJ5WkKlzcZ0vsM9rCGieBkzzn4TKdJOsT3xeOkf2+zaqKVS63035YqvRrPJgdm 3UFPDGcnUNMM+OjLJARwJHnruJj2dJwH55i6Sful6CiCGVpH5da14wuwhXGxGPTPmtL+ EmZg+I+q0t2MfjY6EJCvUkaus22nH+lMajUEod1CQcXWJln5tCOfb8skKWgSTpA75sI5 C3iKI+C+jR7cqo4MELcmkDPPJNbxTEuMhjQhgw9Qy+sjvUnLxUHzUByjXXJf9olGJAEq xYGD4vuX/ezsbk93ufe0Pw/37+8ZoSoEjL0SmSy3wRQBY2t5eiSdpihI46YZ4HtKsPlH 3u+Q== MIME-Version: 1.0 X-Received: by 10.182.211.66 with SMTP id na2mr29693886obc.43.1439352369390; Tue, 11 Aug 2015 21:06:09 -0700 (PDT) Received: by 10.202.11.193 with HTTP; Tue, 11 Aug 2015 21:06:09 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: <20150812125431.P917@besplex.bde.org> References: <201508120049.t7C0nLPI029798@repo.freebsd.org> <20150812125431.P917@besplex.bde.org> Date: Wed, 12 Aug 2015 12:06:09 +0800 Message-ID: Subject: Re: svn commit: r286651 - head/lib/libc/string From: Marcelo Araujo To: Bruce Evans 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: Wed, 12 Aug 2015 04:06:10 -0000 Hello bde@ Maybe change it as it is in NetBSD would be better: http://netbsd.gw.com/cgi-bin/man-cgi?bcopy+3+NetBSD-current They still mention about memcpy(3). However, I need to check their implementation. What do you think? 2015-08-12 11:51 GMT+08:00 Bruce Evans : > On Wed, 12 Aug 2015, Marcelo Araujo wrote: > > Log: >> Describe that bcopy(3) is deprecated and marked as LEGACY in >> POSIX.1-2001 and removed from the specification in POSIX.1-2008. >> > > Only new and old POSIX software and all Standard C software. Standard > C never had bcopy(). POSIX didn't have it until API bloat restored > many old mistakes. But BSD has it. It is memmove(9undoc) that is > deprecated (but brought back by KPI bloat) in the kernel in FreeBSD, > but this is about userland. Only portability requires preferring > mememove(3). > > New softwares shall use memcpy(3) or memmove(3). >> > > Bad advice. bcopy() is only similar to memmove(). > > Modified: >> head/lib/libc/string/bcopy.3 >> >> Modified: head/lib/libc/string/bcopy.3 >> >> ============================================================================== >> --- head/lib/libc/string/bcopy.3 Tue Aug 11 22:43:28 2015 >> (r286650) >> +++ head/lib/libc/string/bcopy.3 Wed Aug 12 00:49:20 2015 >> (r286651) >> @@ -31,7 +31,7 @@ >> .\" @(#)bcopy.3 8.1 (Berkeley) 6/4/93 >> .\" $FreeBSD$ >> .\" >> -.Dd June 4, 1993 >> +.Dd August 11, 2015 >> .Dt BCOPY 3 >> .Os >> .Sh NAME >> @@ -57,6 +57,20 @@ The two strings may overlap. >> > > The strings must not overlap for memcpy(). > > 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 >> +.Xr memmove 3 >> +in new programs. >> > > Bad advice, since these functions are not similar, and it doesn't follow > from deprecation all the versions of POSIX that have it that it is > deprecated in FreeBSD. It follows from the nonexistence of the function > in POSIX before 2001 and after 2008 that the function is more than > deprecated. > > +Note that the first two arguments are >> +interchanged for >> +.Xr memcpy 3 >> +and >> +.Xr memmove 3 . >> > > The first 2 args are not interchanged for memcpy() and memmove(). They > are only interchanged for bcopy() and memmove(). > > > +POSIX.1-2008 removes the specification of >> +.Fn bcopy . >> .Sh SEE ALSO >> .Xr memccpy 3 , >> .Xr memcpy 3 , >> > > Removing all mention of memcpy() (except the one in the Xr) would fix half > of the bugs. > > POSIX has much better wording for this, as for most things. From a 2001 > draft: > > X 5112 APPLICATION USAGE > X 5113 memmove( ) is preferred over this function. > > When bcopy() was only deprecated, it was un-preferred but not banned. > > > X 5114 The following are approximately equivalent (note the > order of the arguments): > X 5115 bcopy(s1,s2,n) = memmove(s2,s1,n) > X 5116 For maximum portability, it is recommended to replace > the function call to bcopy( ) as follows: > X 5117 #define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), > (void) 0) > > No mention of memcpy(), but an example of how to translate with so much > attention to details that it is hard to read. It even translates the > return type. > > X X 5118 RATIONALE > X 5119 None. > X X 5120 FUTURE DIRECTIONS > X 5121 This function may be withdrawn in a future version. > > It was apparently withdrawn in 2008. > > X X 5122 SEE ALSO > X 5123 memmove( ), the Base Definitions volume of IEEE Std > 1003.1-200x, > > No mention of memcpy() here either. I don't like long lists of Xr's to > vaguely related man pages, with no hint of the exact relation, in FreeBSD > man pages. A reader wishing to know any relation at all would have to > read all the man pages in the long list to see some relation, and > understand > all their details to see the exact relation. > > X X 5124 CHANGE HISTORY > X 5125 First released in Issue 4, Version 2. > X X 5126 Issue 5 > X 5127 Moved from X/OPEN UNIX extension to BASE. > X X 5128 Issue 6 > X 5129 This function is marked LEGACY. > > So bcopy() was apparently XSI in Issue 4, BASE in Issue 5, and > BASE plus LEGACY in Issue 6. So why is it still XSI in 2001? > I don't know the dates of the Issues. Oops, this is because only > the include with the prototype for bcopy() is XSI in > 2001. It doesn't exist in POSIX.1-1996. > > Bruce > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_)