1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibCore: Add System::environment

Move this from an internal function of Core::Process so that it can be
used elsewhere.
This commit is contained in:
Shannon Booth 2023-07-17 16:41:43 +12:00 committed by Sam Atkins
parent 806808f406
commit cb920b23cc
3 changed files with 16 additions and 16 deletions

View file

@ -43,7 +43,10 @@ static int memfd_create(char const* name, unsigned int flags)
#endif
#if defined(AK_OS_MACOS)
# include <crt_externs.h>
# include <sys/mman.h>
#else
extern char** environ;
#endif
#define HANDLE_SYSCALL_RETURN_VALUE(syscall_name, rc, success_value) \
@ -1714,4 +1717,13 @@ ErrorOr<String> resolve_executable_from_environment(StringView filename, int fla
return Error::from_errno(ENOENT);
}
char** environment()
{
#if defined(AK_OS_MACOS)
return *_NSGetEnviron();
#else
return environ;
#endif
}
}