xref: /illumos-gate/usr/src/man/man3c/end.3c (revision 5d9d9091f564c198a760790b0bfa72c44e17912b)
te
Copyright 1989 AT&T.
Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
END 3C "Mar 31, 2006"
NAME
end, _end, etext, _etext, edata, _edata - last locations in program
SYNOPSIS

extern int _etext;

extern int _edata;

extern int _end;
DESCRIPTION

These names refer neither to routines nor to locations with interesting contents; only their addresses are meaningful. _etext

The address of _etext is the first location after the last read-only loadable segment.

_edata

The address of _edata is the first location after the last read-write loadable segment.

_end

If the address of _edata is greater than the address of _etext, the address of _end is same as the address of _edata. If the address of _etext is greater than the address of _edata, the address of _end is set to the page boundary after the address pointed to by _etext.

USAGE

When execution begins, the program break (the first location beyond the data) coincides with _end, but the program break can be reset by the brk(2), malloc(3C), and the standard input/output library (see stdio(3C)), functions by the profile (-p) option of cc, and so on. Thus, the current value of the program break should be determined by sbrk ((char *)0).

References to end, etext, and edata, without a preceding underscore will be aliased to the associated symbol that begins with the underscore.

SEE ALSO

brk (2), malloc (3C), stdio (3C)