aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/env_plan9.go
AgeCommit message (Collapse)Author
2020-12-09all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox
As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-19runtime, syscall: use local cache for Setenv/Getenv in Plan 9Richard Miller
In os.Getenv and os.Setenv, instead of directly reading and writing the Plan 9 environment device (which may be shared with other processes), use a local copy of environment variables cached at the start of execution. This gives the same semantics for Getenv and Setenv as on other operating systems which don't share the environment, making it more likely that Go programs (for example the build tests) will be portable to Plan 9. This doesn't preclude writing non-portable Plan 9 Go programs which make use of the shared environment semantics (for example to have a command which exports variable definitions to the parent shell). To do this, use ioutil.ReadFile("/env/"+key) and ioutil.WriteFile("/env/"+key, value, 0666) in place of os.Getenv(key) and os.Setenv(key, value) respectively. Note that CL 5599054 previously added env cacheing, citing efficiency as the reason. However it made the cache write-through, with Setenv changing the shared environment as well as the cache (so not consistent with Posix semantics), and Clearenv breaking the sharing of the environment between the calling thread and other threads (leading to unpredictable behaviour). Because of these inconsistencies (#8849), CL 158970045 removed the cacheing again. This CL restores cacheing but without write-through. The local cache is initialised at start of execution, manipulated by the standard functions in syscall/env_unix.go to ensure the same semantics, and exported only when exec'ing a new program. Fixes #34971 Fixes #25234 Fixes #19388 Updates #38772 Change-Id: I2dd15516d27414afaf99ea382f0e00be37a570c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/236520 Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Fazlul Shahriar <fshahriar@gmail.com> Reviewed-by: David du Colombier <0intro@gmail.com>
2016-03-01all: make copyright headers consistent with one space after periodBrad Fitzpatrick
This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-20runtime: add stringStructOf helper functionMatthew Dempsky
Instead of open-coding conversions from *string to unsafe.Pointer then to *stringStruct, add a helper function to add some type safety. Bonus: This caught two **string values being converted to *stringStruct in heapdump.go. While here, get rid of the redundant _string type, but add in a stringStructDWARF type used for generating DWARF debug info. Change-Id: I8882f8cca66ac45190270f82019a5d85db023bd2 Reviewed-on: https://go-review.googlesource.com/16131 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-14runtime: rename close to closefdDavid Crawshaw
Avoids shadowing the builtin channel close function. Change-Id: I7a729b0937c8248fe27222be61318a88db995eee Reviewed-on: https://go-review.googlesource.com/8898 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org>
2015-03-02runtime: remove unused getenv functionDavid Crawshaw
Change-Id: I49cda99f81b754e25fad1483de373f7d07d64808 Reviewed-on: https://go-review.googlesource.com/6452 Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2014-11-21[dev.cc] runtime: convert Plan 9 port to GoDavid du Colombier
Thanks to Aram Hăvărneanu, Nick Owens and Russ Cox for the early reviews. LGTM=aram, rsc R=rsc, lucio.dere, aram, ality CC=golang-codereviews, mischief https://golang.org/cl/175370043
2014-10-20runtime: handle non-nil-terminated environment strings on Plan 9David du Colombier
Russ Cox pointed out that environment strings are not required to be nil-terminated on Plan 9. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/159130044
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.