xref: /illumos-gate/usr/src/lib/libc/port/gen/env_data.c (revision 1da57d55)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*59f081edSraf  * Common Development and Distribution License (the "License").
6*59f081edSraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*59f081edSraf 
227c478bd9Sstevel@tonic-gate /*
23*59f081edSraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  *	Copyright (c) 1988 AT&T
297c478bd9Sstevel@tonic-gate  *	All Rights Reserved.
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * NOTE: The environment symbol pair may also occur in crt1.o.  The definitions
347c478bd9Sstevel@tonic-gate  * within crt1.o are required for the generation of ABI compliant applications
357c478bd9Sstevel@tonic-gate  * (see bugid 1181124).  No other symbol definitions should be added to this
367c478bd9Sstevel@tonic-gate  * file.
377c478bd9Sstevel@tonic-gate  */
38*59f081edSraf 
39*59f081edSraf /*
40*59f081edSraf  * The original SVR3 ABI states:
41*59f081edSraf  *
42*59f081edSraf  * Application Constraints
43*59f081edSraf  * As described above, libsys provides symbols for applications. In a few cases,
44*59f081edSraf  * however, an application is obliged to provide symbols for the library.
45*59f081edSraf  *
46*59f081edSraf  * extern char **environ;
47*59f081edSraf  *     Normally, this symbol is synonymous with environ, as
48*59f081edSraf  *     exec(BA_OS) describes.  This isn't always true, though, because
49*59f081edSraf  *     ANSI C does not define environ.  Thus, an ANSI C-conforming
50*59f081edSraf  *     application can define its own environ symbol, unrelated to the pro-
51*59f081edSraf  *     cess environment.  If the application defines environ and intends it
52*59f081edSraf  *     to have the System V Interface Definition, Third Edition semantics, it
53*59f081edSraf  *     must also define _environ so that the two symbols refer to the same
54*59f081edSraf  *     data object.
55*59f081edSraf  *
56*59f081edSraf  * The ABI description implies that the process environment should use
57*59f081edSraf  * _environ and that nothing in libc should make reference to the unadorned
58*59f081edSraf  * "environ" symbol.  This way, an application can define and use a symbol
59*59f081edSraf  * named "environ" for its own purposes without affecting the actual
60*59f081edSraf  * process environment.
61*59f081edSraf  */
62*59f081edSraf 
637c478bd9Sstevel@tonic-gate #pragma weak environ = _environ
64*59f081edSraf const char **_environ = 0;
65