New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use _NSGetEnviron() on OSX to retrieve environ #9994
Merged
DanHeidinga
merged 1 commit into
eclipse-openj9:master
from
sharon-wang:useNSGetEnviron
Jun 24, 2020
Merged
Use _NSGetEnviron() on OSX to retrieve environ #9994
DanHeidinga
merged 1 commit into
eclipse-openj9:master
from
sharon-wang:useNSGetEnviron
Jun 24, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jenkins test sanity,extended osx jdk8 |
DanHeidinga
reviewed
Jun 24, 2020
Direct access to `environ` on OSX should use _NSGetEnviron(), as `environ` is only directly accessible via that environment subroutine from shared libraries and bundles. --- `environ` is a list of strings that is made available when a process begins. Each string has the convention "name=value" which is set in the user environment. `environ` can be directly accessed, except from shared libraries and bundles, since it is only available to the loader `ld` when a complete program is being linked. The environment routines `getenv`, `setenv` and `putenv` can be used to access `environ` whether referenced by the loader or in shared libraries and bundles. If direct access to `environ` is needed in shared libraries or bundles for OSX, `_NSGetEnviron` (defined in `crt_externs.h`) can be used to retrieve `environ` at runtime. Source: https://opensource.apple.com/source/Libc/Libc-1353.41.1/man/FreeBSD/environ.7.auto.html Signed-off-by: Sharon Wang <sharon-wang-cpsc@outlook.com>
sharon-wang
force-pushed
the
useNSGetEnviron
branch
from
June 24, 2020 01:45
5520232
to
d07d9e0
Compare
DanHeidinga
approved these changes
Jun 24, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Not going to rerun tests for the comment change |
@DanHeidinga should this (and eclipse/omr#5338) be considered for the 0.21 release? |
I would suggest no given @sharon-wang hasn't been able to reproduce the issue in recent builds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As per: #7247
Direct access to
environ
on OSX should use_NSGetEnviron
, asenviron
is only directly accessible via that environmentsubroutine from shared libraries and bundles since Mac OS X 10.5 (Leopard).
This change likely does not fix the crash noted in the issue, but makes access to
environ
available from shared libraries and bundles.environ
is a list of strings that is made available when a process begins. Each string has the convention "name=value" which is set in the user environment.environ
can be directly accessed, except from shared libraries and bundles, since it is only available to the loaderld
when a complete program is being linked. The environment routinesgetenv
,setenv
andputenv
can be used to accessenviron
whether referenced by the loader or in shared libraries and bundles. If direct access toenviron
is needed in shared libraries or bundles for OSX,_NSGetEnviron
(defined incrt_externs.h
) can be used to retrieveenviron
at runtime.Source: https://opensource.apple.com/source/Libc/Libc-1353.41.1/man/FreeBSD/environ.7.auto.html
Some other info: https://www.gnu.org/software/gnulib/manual/gnulib.html#environ
crt_externs.h
: https://opensource.apple.com/source/Libc/Libc-1353.41.1/sys/crt_externs.c.auto.html