Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jun 2023 12:22:28 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 750a1522f6ac - stable/13 - libc: move declaration of 'char **environ' to common private header
Message-ID:  <202306121222.35CCMSje048059@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=750a1522f6acf9bb51eed67d350f9f730b647ad5

commit 750a1522f6acf9bb51eed67d350f9f730b647ad5
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-11-06 04:08:36 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-06-12 12:19:38 +0000

    libc: move declaration of 'char **environ' to common private header
    
    (cherry picked from commit 0c6f0c0db75ea5a1e89a68a163fc555bdd7d00f5)
---
 lib/libc/csu/ignore_init.c      | 2 --
 lib/libc/gen/auxv.c             | 1 -
 lib/libc/gen/exec.c             | 2 --
 lib/libc/gen/popen.c            | 2 --
 lib/libc/gen/posix_spawn.c      | 2 --
 lib/libc/gen/tls.c              | 2 --
 lib/libc/include/libc_private.h | 2 ++
 lib/libc/stdlib/getenv.c        | 3 +--
 8 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/lib/libc/csu/ignore_init.c b/lib/libc/csu/ignore_init.c
index 60c45d7e735f..346409e3f370 100644
--- a/lib/libc/csu/ignore_init.c
+++ b/lib/libc/csu/ignore_init.c
@@ -117,8 +117,6 @@ handle_static_init(int argc, char **argv, char **env)
 	}
 }
 
-extern char **environ;
-
 static void
 handle_argv(int argc, char *argv[], char **env)
 {
diff --git a/lib/libc/gen/auxv.c b/lib/libc/gen/auxv.c
index 2f043f8814cf..29b3d6929144 100644
--- a/lib/libc/gen/auxv.c
+++ b/lib/libc/gen/auxv.c
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 #include "libc_private.h"
 
-extern char **environ;
 extern int _DYNAMIC;
 #pragma weak _DYNAMIC
 
diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c
index 2c703bb4e73e..f1d69e147719 100644
--- a/lib/libc/gen/exec.c
+++ b/lib/libc/gen/exec.c
@@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 #include "libc_private.h"
 
-extern char **environ;
-
 static const char execvPe_err_preamble[] = "execvP: ";
 static const char execvPe_err_trailer[] = ": path too long\n";
 
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index c5373077f3ae..f0b1a61c2803 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -53,8 +53,6 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 #include "libc_private.h"
 
-extern char **environ;
-
 struct pid {
 	SLIST_ENTRY(pid) next;
 	FILE *fp;
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index 909db9a60a02..7dc0ade5b309 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 #include "libc_private.h"
 
-extern char **environ;
-
 struct __posix_spawnattr {
 	short			sa_flags;
 	pid_t			sa_pgroup;
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index d75b883b68db..74b2ae562c99 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -401,8 +401,6 @@ __libc_free_tls(void *tcb __unused, size_t tcbsize __unused,
 
 #endif /* PIC */
 
-extern char **environ;
-
 void
 _init_tls(void)
 {
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index 5fa7a6da1198..991624557118 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -39,6 +39,8 @@
 #include <sys/_types.h>
 #include <sys/_pthreadtypes.h>
 
+extern char **environ;
+
 /*
  * The kernel doesn't expose PID_MAX to the user space. Save it here
  * to allow to run a newer world on a pre-1400079 kernel.
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c
index 4c71801b242f..a413e8d7d93f 100644
--- a/lib/libc/stdlib/getenv.c
+++ b/lib/libc/stdlib/getenv.c
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <unistd.h>
 #include "un-namespace.h"
-
+#include "libc_private.h"
 
 static const char CorruptEnvFindMsg[] = "environment corrupt; unable to find ";
 static const char CorruptEnvValueMsg[] =
@@ -56,7 +56,6 @@ static const char CorruptEnvValueMsg[] =
  *	intEnviron:	Internally-built environ.  Exposed via environ during
  *			(re)builds of the environment.
  */
-extern char **environ;
 static char **origEnviron;
 static char **intEnviron = NULL;
 static int environSize = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306121222.35CCMSje048059>