[crac] RFR: Environment vars propagation into restored process

Anton Kozlov akozlov at openjdk.org
Fri Sep 30 13:52:42 UTC 2022


On Thu, 29 Sep 2022 15:38:52 GMT, Roman Marchenko <duke at openjdk.org> wrote:

> This PR provides functionality to propagate actual environment variables to a restored process, as well as the test for this functionality.
> 
> Env propagation is done in few steps:
> - Store the actual environment before restoring
> - After restoring, replace the restored `environ` with a new one.
> - On `afterRestore` event, propagate the new environment into a restored process via `ProcessEnvironment`.

LGTM, thanks!

Just few minor questionable style issues.

src/hotspot/os/linux/os_linux.cpp line 373:

> 371:     // Write env vars
> 372:     for (char** env = environ; *env; ++env)
> 373:     {

Suggestion:

    for (char** env = environ; *env; ++env) {

src/hotspot/os/linux/os_linux.cpp line 6463:

> 6461: 
> 6462:   {
> 6463:     char* env_mem = NEW_C_HEAP_ARRAY(char, hdr->_env_memory_size, mtArguments); // left this pointer unowned, it is freed when process dies

Suggestion:

  char* env_mem = NEW_C_HEAP_ARRAY(char, hdr->_env_memory_size, mtArguments); // left this pointer unowned, it is freed when process dies


Here and below, we don't hesitate to introduce few local variables without creating a new syntax block. Please note the change once applied makes the code uncompilable.

-------------

Marked as reviewed by akozlov (Lead).

PR: https://git.openjdk.org/crac/pull/30


More information about the crac-dev mailing list