git: 0c6f0c0db75e - main - libc: move declaration of 'char **environ' to common private header
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Mar 2023 22:51:18 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0c6f0c0db75ea5a1e89a68a163fc555bdd7d00f5 commit 0c6f0c0db75ea5a1e89a68a163fc555bdd7d00f5 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-11-06 04:08:36 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-03-11 22:50:04 +0000 libc: move declaration of 'char **environ' to common private header Suggested by: imp Reviewed by: markj Tested by: markj (aarch64) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D37220 --- 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 5ceaf439d839..c0ed0126db6a 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 67750d354f22..228eb5c0945f 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 ed0c9efcba6d..7ca27ab710c4 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;