]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/brk.2
move_pages.2: Minor tweaks to Yang Shi's patch
[thirdparty/man-pages.git] / man2 / brk.2
index 8cc6a3c21b9b80169ef680bd7963019869a508e7..5daba3fca6d24e2d72f798dd15cb433d9149f73a 100644 (file)
@@ -1,5 +1,5 @@
-.\" Copyright (c) 1993 Michael Haardt
-.\" (michael@moria.de),
+.\" Copyright (c) 1993 Michael Haardt, (michael@moria.de)
+.\" and Copyright 2006, 2008, Michael Kerrisk <tmk.manpages@gmail.com>
 .\" Fri Apr  2 11:32:09 MET DST 1993
 .\"
 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
 .\" Modified Wed Jul 21 19:52:58 1993 by Rik Faith <faith@cs.unc.edu>
 .\" Modified Sun Aug 21 17:40:38 1994 by Rik Faith <faith@cs.unc.edu>
 .\"
-.TH BRK 2 2015-07-23 "Linux" "Linux Programmer's Manual"
+.TH BRK 2 2016-03-15 "Linux" "Linux Programmer's Manual"
 .SH NAME
 brk, sbrk \- change data segment size
 .SH SYNOPSIS
 .B #include <unistd.h>
-.sp
+.PP
 .BI "int brk(void *" addr );
-.sp
+.PP
 .BI "void *sbrk(intptr_t " increment );
-.sp
+.PP
 .in -4n
 Feature Test Macro Requirements for glibc (see
 .BR feature_test_macros (7)):
 .in
-.sp
+.PP
 .BR brk (),
 .BR sbrk ():
 .ad l
 .RS 4
 .PD 0
 .TP 4
-Since glibc 2.12:
+Since glibc 2.19:
+.nf
+_DEFAULT_SOURCE ||
+    (_XOPEN_SOURCE\ >=\ 500) &&
+.\"    (_XOPEN_SOURCE\ >=\ 500 ||
+.\"        _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
+    ! (_POSIX_C_SOURCE\ >=\ 200112L)
+.fi
+.TP 4
+From glibc 2.12 to 2.19:
 .nf
 _BSD_SOURCE || _SVID_SOURCE ||
-    (_XOPEN_SOURCE\ >=\ 500 ||
-        _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
-    ! (_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600)
+    (_XOPEN_SOURCE\ >=\ 500) &&
+.\"    (_XOPEN_SOURCE\ >=\ 500 ||
+.\"        _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
+    ! (_POSIX_C_SOURCE\ >=\ 200112L)
 .fi
 .TP 4
 Before glibc 2.12:
-_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
-    _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
+_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500
+.\"    || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
 .PD
 .RE
 .ad b
@@ -73,14 +83,14 @@ uninitialized data segment).
 Increasing the program break has the effect of
 allocating memory to the process;
 decreasing the break deallocates memory.
-
+.PP
 .BR brk ()
 sets the end of the data segment to the value specified by
 .IR addr ,
 when that value is reasonable, the system has enough memory,
 and the process does not exceed its maximum data size (see
 .BR setrlimit (2)).
-
+.PP
 .BR sbrk ()
 increments the program's data space by
 .I increment
@@ -98,7 +108,7 @@ On error, \-1 is returned, and
 .I errno
 is set to
 .BR ENOMEM .
-
+.PP
 On success,
 .BR sbrk ()
 returns the previous program break.
@@ -127,7 +137,7 @@ the
 .BR malloc (3)
 memory allocation package is the
 portable and comfortable way of allocating memory.
-
+.PP
 Various systems use various types for the argument of
 .BR sbrk ().
 Common are \fIint\fP, \fIssize_t\fP, \fIptrdiff_t\fP, \fIintptr_t\fP.
@@ -153,7 +163,7 @@ The glibc wrapper function does some work
 (i.e., checks whether the new break is less than
 .IR addr )
 to provide the 0 and \-1 return values described above.
-
+.PP
 On Linux,
 .BR sbrk ()
 is implemented as a library function that uses the