From bb844a2ce832c5ab1f32b3ecd2c0ff7038c3d1b6 Mon Sep 17 00:00:00 2001 From: perry Date: Wed, 16 Oct 1996 17:20:30 +0000 Subject: [PATCH] Close 2831, which noted that the man page is confusing. I have edited it slightly differently than Mike originally suggested after consulting with him and others. --- share/man/man3/end.3 | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/share/man/man3/end.3 b/share/man/man3/end.3 index 29c6d2cf0f2d..97feb2c4a1df 100644 --- a/share/man/man3/end.3 +++ b/share/man/man3/end.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: end.3,v 1.5 1996/03/01 00:17:49 jtc Exp $ +.\" $NetBSD: end.3,v 1.6 1996/10/16 17:20:30 perry Exp $ .\" .\" Copyright (c) 1986 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" .\" @(#)end.3 6.4 (Berkeley) 1/24/94 .\" -.Dd January 24, 1994 +.Dd October 16, 1996 .Dt END 3 .Os .Sh NAME @@ -46,21 +46,38 @@ .Vt extern etext; .Vt extern edata; .Sh DESCRIPTION -The global variables +The globals .Va end , etext and .Va edata -correspond to the -the next address following -the end of the text segment, -the end of initialized data segment and -the end of the data segment -.Pq Tn BSS . +are program segment end addresses. +.Pp +.Va etext +is the first address after the end of the text segment. +.Pp +.Va edata +is the first address after the end of the initialized data segment. +.Pp +.Va end +is the first address after the end of the data segment +.Pq Tn BSS +when the program is loaded. Use the +.Xr sbrk 2 +.\".Fn sbrk 0 +system call with zero as its argument to find the current end of the +data segment. .Sh SEE ALSO -.Xr brk 2 , -.Xr malloc 3 +.Xr sbrk 2 , +.Xr malloc 3 , +.Xr a.out 5 .Sh HISTORY -A +An .Nm end -manual appeared in +manual page appeared in .At v6 . +.Sh BUGS +Traditionally, no variable existed that pointed to the start of the +text segment because the text segment always started at address +zero. Although it is no longer valid to make this assumption, no +variable similar to the ones documented above exists to point to the +start of the text segment.