From 185a0cdc2d0f72d64768dc6dd5465ad6fe561028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= Date: Tue, 5 Dec 2017 10:27:51 +0100 Subject: Document that os:putenv/2 and putenv(3) modify different environments This is *ONLY* relevant for drivers/NIFs, so it's probably counter- productive to document it elsewhere. --- erts/doc/src/erl_driver.xml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml index ca9d458e1e..c790872fe4 100644 --- a/erts/doc/src/erl_driver.xml +++ b/erts/doc/src/erl_driver.xml @@ -2304,8 +2304,13 @@ r = driver_async(myPort, &myKey, myData, myFunc); ]]> buffer is too small, a value > 0 is returned and *value_size has been set to the buffer size needed.

-

Do not use libc's getenv or similar C library - interfaces from a driver.

+

This function reads the emulated environment used by + os:getenv/1 and not + the environment used by libc's getenv(3) or similar. Drivers + that require that these are in sync will need to do so + themselves, but keep in mind that they are segregated for a reason; + getenv(3) and its friends are not thread-safe and + may cause unrelated code to misbehave or crash the emulator.

This function is thread-safe.

@@ -2650,8 +2655,13 @@ erl_drv_output_term(driver_mk_port(drvport), spec, sizeof(spec) / sizeof(spec[0] environment variable is removed.

-

Do not use libc's putenv or similar C library - interfaces from a driver.

+

This function modifies the emulated environment used by + os:putenv/2 and not + the environment used by libc's putenv(3) or similar. Drivers + that require that these are in sync will need to do so + themselves, but keep in mind that they are segregated for a reason; + putenv(3) and its friends are not thread-safe and + may cause unrelated code to misbehave or crash the emulator.

This function is thread-safe.

-- cgit v1.2.3