xref: /onnv-gate/usr/src/lib/libc/port/gen/env_data.c (revision 6879:150dcecba680)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*6879Sraf  * Common Development and Distribution License (the "License").
6*6879Sraf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*6879Sraf 
220Sstevel@tonic-gate /*
23*6879Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*
280Sstevel@tonic-gate  *	Copyright (c) 1988 AT&T
290Sstevel@tonic-gate  *	All Rights Reserved.
300Sstevel@tonic-gate  */
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
330Sstevel@tonic-gate 
340Sstevel@tonic-gate /*
350Sstevel@tonic-gate  * NOTE: The environment symbol pair may also occur in crt1.o.  The definitions
360Sstevel@tonic-gate  * within crt1.o are required for the generation of ABI compliant applications
370Sstevel@tonic-gate  * (see bugid 1181124).  No other symbol definitions should be added to this
380Sstevel@tonic-gate  * file.
390Sstevel@tonic-gate  */
40*6879Sraf 
41*6879Sraf /*
42*6879Sraf  * The original SVR3 ABI states:
43*6879Sraf  *
44*6879Sraf  * Application Constraints
45*6879Sraf  * As described above, libsys provides symbols for applications. In a few cases,
46*6879Sraf  * however, an application is obliged to provide symbols for the library.
47*6879Sraf  *
48*6879Sraf  * extern char **environ;
49*6879Sraf  *     Normally, this symbol is synonymous with environ, as
50*6879Sraf  *     exec(BA_OS) describes.  This isn't always true, though, because
51*6879Sraf  *     ANSI C does not define environ.  Thus, an ANSI C-conforming
52*6879Sraf  *     application can define its own environ symbol, unrelated to the pro-
53*6879Sraf  *     cess environment.  If the application defines environ and intends it
54*6879Sraf  *     to have the System V Interface Definition, Third Edition semantics, it
55*6879Sraf  *     must also define _environ so that the two symbols refer to the same
56*6879Sraf  *     data object.
57*6879Sraf  *
58*6879Sraf  * The ABI description implies that the process environment should use
59*6879Sraf  * _environ and that nothing in libc should make reference to the unadorned
60*6879Sraf  * "environ" symbol.  This way, an application can define and use a symbol
61*6879Sraf  * named "environ" for its own purposes without affecting the actual
62*6879Sraf  * process environment.
63*6879Sraf  */
64*6879Sraf 
650Sstevel@tonic-gate #pragma weak environ = _environ
66*6879Sraf const char **_environ = 0;
67