Subject: misc/6833: sbrk/brk man page doesn't mention sbrk very well
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bgrayson@ece.utexas.edu>
List: netbsd-bugs
Date: 01/17/1999 23:41:48
>Number:         6833
>Category:       misc
>Synopsis:       sbrk/brk man page doesn't mention sbrk very well
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 17 21:50:01 1999
>Last-Modified:
>Originator:     Brian Grayson
>Organization:
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        Jan 15, 1998
>Environment:

>Description:
	Two things:

	1.  sbrk isn't described very well.  There is a
	commented-out description of sbrk, but I don't really
	like "allocates chunks" -- it doesn't make the data
	segment sound like one continuous address range.

	2.  To me, "addressing is restricted between ..." is
	ambiguous:  is addressing restricted to be between ...,
	or is addressing not permitted at all between ...?  Of
	course, the correct answer is "not permitted."  With
	uses of mmap() and sbrk()/brk() at the same time, this
	isn't quite true, as a mmap'd section could end up
	being in this range.  Maybe "Unless explicitly allowed
	via mmap() or other actions, data accesses are not permitted
	to any address between .Fa addr and the lowest stack
	pointer to the stack segment."
>How-To-Repeat:
>Fix:
	My suggestions are:
--- brk.2.dist  Sun Jan 17 22:58:25 1999
+++ brk.2       Sun Jan 17 23:27:36 1999
@@ -58,7 +58,7 @@
 segment (uninitialized data) to
 .Fa addr
 (immediately above bss).
-Data addressing is restricted between
+Data addressing is not permitted between
 .Fa addr
 and the lowest stack pointer to the stack segment.
 Memory is allocated by
@@ -68,6 +68,14 @@
 .Fa addr
 is not evenly divisible by the system page size, it is increased
 to the next page boundary.
+.Pp
+The
+.Nm sbrk
+function increments the program break by
+.Fa incr
+bytes.  Note that
+.Fa incr
+may be negative.
 .Pp
 .\" The
 .\" .Nm sbrk


>Audit-Trail:
>Unformatted: