From owner-svn-src-stable-10@freebsd.org Thu May 31 16:10:46 2018 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0D41EFDE0B; Thu, 31 May 2018 16:10:45 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85EFA7032D; Thu, 31 May 2018 16:10:45 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 682F61C67D; Thu, 31 May 2018 16:10:45 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VGAj5l070998; Thu, 31 May 2018 16:10:45 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VGAimc070994; Thu, 31 May 2018 16:10:44 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201805311610.w4VGAimc070994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 31 May 2018 16:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r334440 - stable/10/lib/libc/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/10/lib/libc/sys X-SVN-Commit-Revision: 334440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2018 16:10:46 -0000 Author: brooks Date: Thu May 31 16:10:44 2018 New Revision: 334440 URL: https://svnweb.freebsd.org/changeset/base/334440 Log: MFC r292268, r334176 r292268: Remove sys/types.h due to STANDARDS and unistd.h also includes sys/types.h. r334176: Indicate the brk/sbrk are deprecated and not portable. More firmly suggest mmap(2) instead. Include the history of arm64 and riscv shipping without brk/sbrk. Mention that sbrk(0) produces unreliable results. Reviewed by: emaste, Marcin Cieślak Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15535 Modified: stable/10/lib/libc/sys/brk.2 stable/10/lib/libc/sys/getgid.2 stable/10/lib/libc/sys/getpid.2 stable/10/lib/libc/sys/read.2 stable/10/lib/libc/sys/write.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/brk.2 ============================================================================== --- stable/10/lib/libc/sys/brk.2 Thu May 31 16:01:10 2018 (r334439) +++ stable/10/lib/libc/sys/brk.2 Thu May 31 16:10:44 2018 (r334440) @@ -28,7 +28,7 @@ .\" @(#)brk.2 8.4 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd July 12, 1999 +.Dd May 24, 2018 .Dt BRK 2 .Os .Sh NAME @@ -38,7 +38,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h .In unistd.h .Ft int .Fn brk "const void *addr" @@ -52,6 +51,10 @@ and .Fn sbrk functions are legacy interfaces from before the advent of modern virtual memory management. +They are deprecated and not present on the arm64 or riscv architectures. +The +.Xr mmap 2 +interface should be used to allocate pages instead. .Ef .Pp The @@ -153,6 +156,11 @@ The .Fn brk function appeared in .At v7 . +.Fx 11.0 +introduced the arm64 and riscv architectures which do not support +.Fn brk +or +.Fn sbrk . .Sh BUGS Mixing .Fn brk @@ -169,3 +177,9 @@ It is not possible to distinguish this from a failure caused by exceeding the maximum size of the data segment without consulting .Xr getrlimit 2 . +.Pp +.Fn sbrk +is sometimes used to monitor heap use by calling with an argument of 0. +The result is unlikely to reflect actual utilization in combination with an +.Xr mmap 2 +based malloc. Modified: stable/10/lib/libc/sys/getgid.2 ============================================================================== --- stable/10/lib/libc/sys/getgid.2 Thu May 31 16:01:10 2018 (r334439) +++ stable/10/lib/libc/sys/getgid.2 Thu May 31 16:10:44 2018 (r334440) @@ -28,7 +28,7 @@ .\" @(#)getgid.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 15, 2015 .Dt GETGID 2 .Os .Sh NAME @@ -38,7 +38,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h .In unistd.h .Ft gid_t .Fn getgid void Modified: stable/10/lib/libc/sys/getpid.2 ============================================================================== --- stable/10/lib/libc/sys/getpid.2 Thu May 31 16:01:10 2018 (r334439) +++ stable/10/lib/libc/sys/getpid.2 Thu May 31 16:10:44 2018 (r334440) @@ -28,7 +28,7 @@ .\" @(#)getpid.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 2, 2006 +.Dd December 15, 2015 .Dt GETPID 2 .Os .Sh NAME @@ -38,7 +38,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h .In unistd.h .Ft pid_t .Fn getpid void Modified: stable/10/lib/libc/sys/read.2 ============================================================================== --- stable/10/lib/libc/sys/read.2 Thu May 31 16:01:10 2018 (r334439) +++ stable/10/lib/libc/sys/read.2 Thu May 31 16:10:44 2018 (r334440) @@ -28,7 +28,7 @@ .\" @(#)read.2 8.4 (Berkeley) 2/26/94 .\" $FreeBSD$ .\" -.Dd September 11, 2013 +.Dd December 15, 2015 .Dt READ 2 .Os .Sh NAME @@ -40,7 +40,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h .In unistd.h .Ft ssize_t .Fn read "int fd" "void *buf" "size_t nbytes" Modified: stable/10/lib/libc/sys/write.2 ============================================================================== --- stable/10/lib/libc/sys/write.2 Thu May 31 16:01:10 2018 (r334439) +++ stable/10/lib/libc/sys/write.2 Thu May 31 16:10:44 2018 (r334440) @@ -28,7 +28,7 @@ .\" @(#)write.2 8.5 (Berkeley) 4/2/94 .\" $FreeBSD$ .\" -.Dd September 11, 2013 +.Dd December 15, 2015 .Dt WRITE 2 .Os .Sh NAME @@ -40,7 +40,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h .In unistd.h .Ft ssize_t .Fn write "int fd" "const void *buf" "size_t nbytes"