aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/os
AgeCommit message (Collapse)Author
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.
2014-08-19os: make SameFile handle paths like c:a.txt properlyAlex Brainman
Fixes #8490. LGTM=r, rsc R=golang-codereviews, rsc, bradfitz, r CC=golang-codereviews https://golang.org/cl/127740043
2014-08-12all: copy cmd/ld/textflag.h into pkg/GOOS_GOARCHRob Pike
The file is used by assembly code to define symbols like NOSPLIT. Having it hidden inside the cmd directory makes it hard to access outside the standard repository. Solution: As with a couple of other files used by cgo, copy the file into the pkg directory and add a -I argument to the assembler to access it. Thus one can write just #include "textflag.h" in .s files. The names in runtime are not updated because in the boot sequence the file has not been copied yet when runtime is built. All other .s files in the repository are updated. Changes to doc/asm.html, src/cmd/dist/build.c, and src/cmd/go/build.go are hand-made. The rest are just the renaming done by a global substitution. (Yay sam). LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/128050043
2014-08-08os: simplify windows Getwd (fixes build)Alex Brainman
Current version of Getwd calls Stat that calls Getwd therefore infinite recursion. LGTM=minux R=golang-codereviews, minux CC=golang-codereviews https://golang.org/cl/119600043
2014-08-07os: in Getwd, $PWD override syscall.GetwdRuss Cox
This makes os.Getwd mimic C getwd on OS X, and possibly other systems. The change on OS X was a regression from 1.2 to 1.3. Fixes #8400. LGTM=bradfitz R=iant, bradfitz CC=golang-codereviews https://golang.org/cl/118970043
2014-07-18os: broaden the range of errors understood by IsNotExist on Plan 9Nicolas Owens
Ken's standalone file server and its derivatives, like cwfs, return error strings different from fossil when the user opens non-existent files. LGTM=aram, 0intro, r R=0intro, aram, r CC=golang-codereviews, ken https://golang.org/cl/112420045
2014-07-17os: Implement symlink support for WindowsMichael Fraenkel
Fixes #5750. https://code.google.com/p/go/issues/detail?id=5750 os: Separate windows from posix. Implement windows support. path/filepath: Use the same implementation as other platforms syscall: Add/rework new APIs for Windows LGTM=alex.brainman R=golang-codereviews, alex.brainman, gobot, rsc, minux CC=golang-codereviews https://golang.org/cl/86160044
2014-07-16src, misc: applied gofmt -s -wRobert Griesemer
Pending CL 113120043. LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/112290043
2014-07-09os: no /tmp on androidDavid Crawshaw
LGTM=minux, bradfitz R=golang-codereviews, minux, bradfitz CC=golang-codereviews https://golang.org/cl/104650043
2014-07-09os: fix failing test on Plan 9Aram Hăvărneanu
LGTM=0intro, r R=0intro, r CC=ality, dave, golang-codereviews, jas, mischief, rsc https://golang.org/cl/105580044
2014-07-08os: adjust tests for android file systemDavid Crawshaw
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/108460043
2014-07-03cmd/go, cmd/ld, runtime, os/user: TLS emulation for androidDavid Crawshaw
Based on cl/69170045 by Elias Naur. There are currently several schemes for acquiring a TLS slot to save the g register. None of them appear to work for android. The closest are linux and darwin. Linux uses a linker TLS relocation. This is not supported by the android linker. Darwin uses a fixed offset, and calls pthread_key_create until it gets the slot it wants. As the runtime loads late in the android process lifecycle, after an arbitrary number of other libraries, we cannot rely on any particular slot being available. So we call pthread_key_create, take the first slot we are given, and put it in runtime.tlsg, which we turn into a regular variable in cmd/ld. Makes android/arm cgo binaries work. LGTM=minux R=elias.naur, minux, dave, josharian CC=golang-codereviews https://golang.org/cl/106380043
2014-06-14os: disable TestGetppid on plan9Alex Brainman
Fixes build. LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/105140047
2014-06-14syscall: implement syscall.Getppid() on WindowsAlan Shreve
Also added a test to verify os.Getppid() works across all platforms LGTM=alex.brainman R=golang-codereviews, alex.brainman, shreveal, iant CC=golang-codereviews https://golang.org/cl/102320044
2014-05-23os: document that Interrupt might not work on every osAlex Brainman
Fixes #6720. LGTM=bradfitz R=golang-codereviews, iant, bradfitz CC=golang-codereviews https://golang.org/cl/92340043
2014-05-20build: make nacl passRuss Cox
Add nacl.bash, the NaCl version of all.bash. It's a separate script because it builds a variant of package syscall with a large zip file embedded in it, containing all the input files needed for tests. Disable various tests new since the last round, mostly the ones using os/exec. Fixes #7945. LGTM=dave R=golang-codereviews, remyoudompheng, dave, bradfitz CC=golang-codereviews https://golang.org/cl/100590044
2014-05-02os: cut limited read to 1 GBRuss Cox
If systems actually read that much, using 2GB-1 will result in misaligned subsequent reads. Use 1GB instead, which will certainly keep reads aligned and which is plenty large enough. Update #7812. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/94070044
2014-04-26os: cap reads and writes to 2GB on Darwin and FreeBSDBrad Fitzpatrick
Fixes #7812 LGTM=josharian, iant R=rsc, iant, adg, ruiu, minux.ma, josharian CC=golang-codereviews https://golang.org/cl/89900044
2014-04-22os/exec: deflake a test on LinuxBrad Fitzpatrick
Work around buggy(?) Linux /proc filesystem. Fixes #7808 LGTM=iant R=golang-codereviews, iant CC=adg, golang-codereviews https://golang.org/cl/90400044
2014-04-17os: change return variable name for Getwd to avoid confusionShenghou Ma
changed (pwd string) to (dir string), as some think pwd means passwd. Fixes #7811. LGTM=iant R=golang-codereviews, iant, bradfitz CC=golang-codereviews https://golang.org/cl/89100043
2014-04-15os/exec: make TestPipeLookPathLeak more verbose when it failsBrad Fitzpatrick
Trying to understand the linux-386-387 failures: http://build.golang.org/log/78a91da173c11e986b4e623527c2d0b746f4e814 Also modernize the closeOnce code with a method value, while I was looking. LGTM=adg R=golang-codereviews, adg CC=golang-codereviews, iant https://golang.org/cl/87950044
2014-04-14os/exec: quiet distracting log output during testBrad Fitzpatrick
TLS handshake failures didn't use to log, but do in Go 1.3. Shut it up so the actual failure can be seen in e.g. http://build.golang.org/log/ede7e12362a941d93bf1fe21db9208a3e298029e LGTM=adg R=adg CC=golang-codereviews https://golang.org/cl/87870043
2014-04-11os/signal: use unique program name during TestCtrlBreakAlex Brainman
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/84650047
2014-04-04os/exec: always try appropriate command extensions during Cmd.Start on windowsAlex Brainman
Update #7362 Fixes #7377 Fixes #7570 LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/83020043
2014-03-12os: relax the way we kill processes on Plan 9Anthony Martin
Previously, we wrote "kill" to the process control file to kill a program. This is problematic because it doesn't let the program gracefully exit. This matters especially if the process we're killing is a Go program. On Unix, sending SIGKILL to a Go program will automatically kill all runtime threads. On Plan 9, there are no threads so when the program wants to exit it has to somehow signal all of the runtime processes. It can't do this if we mercilessly kill it by writing to it's control file. Instead, we now send it a note to invoke it's note handler and let it perform any cleanup before exiting. LGTM=rsc R=rsc, 0intro CC=golang-codereviews https://golang.org/cl/74440044
2014-03-07os: document that Process.Wait only works on child processesBrad Fitzpatrick
Fixes #7072 LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/71900045
2014-03-05os: try openFile before openDir in windows os.OpenFilePatrick Mézard
Logging calls when running "go install -a std" turns: 547 openDir succeeded 3593 openDir failed and fell back to openFile 3592 openFile succeeded 1 both failed into: 3592 openFile succeeded 548 openFile failed and fell back 547 openDir succeeded 1 both failed Here the change trades 3593 failed openDir for 548 failed openFile. Fix issue 7426. LGTM=alex.brainman R=golang-codereviews, alex.brainman, bradfitz CC=golang-codereviews https://golang.org/cl/70480044
2014-03-04os: handle file creation with close-on-exec flag correctly on darwin, freebsdMikio Hara
Fixes #7187. Update #7193 LGTM=bradfitz R=golang-codereviews, dave, rsc, minux.ma, bradfitz CC=golang-codereviews https://golang.org/cl/64510043
2014-02-28os: don't allow Process.Kill after Process.ReleaseBrad Fitzpatrick
This is a user error, but killing -1 kills everything, which is a pretty bad failure mode. Fixes #7434 LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/70140043
2014-02-25all: merge NaCl branch (part 1)Dave Cheney
See golang.org/s/go13nacl for design overview. This CL is the mostly mechanical changes from rsc's Go 1.2 based NaCl branch, specifically 39cb35750369 to 500771b477cf from https://code.google.com/r/rsc-go13nacl. This CL does not include working NaCl support, there are probably two or three more large merges to come. CL 15750044 is not included as it involves more invasive changes to the linker which will need to be merged separately. The exact change lists included are 15050047: syscall: support for Native Client 15360044: syscall: unzip implementation for Native Client 15370044: syscall: Native Client SRPC implementation 15400047: cmd/dist, cmd/go, go/build, test: support for Native Client 15410048: runtime: support for Native Client 15410049: syscall: file descriptor table for Native Client 15410050: syscall: in-memory file system for Native Client 15440048: all: update +build lines for Native Client port 15540045: cmd/6g, cmd/8g, cmd/gc: support for Native Client 15570045: os: support for Native Client 15680044: crypto/..., hash/crc32, reflect, sync/atomic: support for amd64p32 15690044: net: support for Native Client 15690048: runtime: support for fake time like on Go Playground 15690051: build: disable various tests on Native Client LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/68150047
2014-02-23os/exec: explicitly mention Cmd.Wait() has to be called eventuallyPatrick Mézard
LGTM=minux.ma, r R=golang-codereviews, minux.ma, r CC=golang-codereviews https://golang.org/cl/67280043
2014-02-20os: fix Rename on Plan 9David du Colombier
Rename should fail when the directory doesn't match. It will fix the newly introduced test from cmd/pack on Plan 9. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/65270044
2014-02-07os/exec: use filepath.Base in CommandAlex Brainman
filepath.Base covers all scenarios (for example paths like d:hello.txt) on windows LGTM=iant, bradfitz R=golang-codereviews, iant, bradfitz CC=golang-codereviews https://golang.org/cl/59740050
2014-02-03os/exec: fix Command with relative pathsBrad Fitzpatrick
Command was (and is) documented like: "If name contains no path separators, Command uses LookPath to resolve the path to a complete name if possible. Otherwise it uses name directly." But that wasn't true. It always did LookPath, and then set a sticky error that the user couldn't unset. And then if cmd.Dir was changed, Start would still fail due to the earlier sticky error being set. This keeps LookPath in the same place as before (so no user visible changes in cmd.Path after Command), but only does it when the documentation says it will happen. Also, clarify the docs about a relative Dir path. No change in any existing behavior, except using Command is now possible with relative paths. Previously it only worked if you built the *Cmd by hand. Fixes #7228 LGTM=iant R=iant CC=adg, golang-codereviews https://golang.org/cl/59580044
2014-01-13os/exec: disable fd check in TestHelperProcess on Plan 9David du Colombier
On Plan 9, we can observe the following open file descriptors: 0 r c 0 (000000000000000a 0 00) 0 0 /dev/null 1 rw | 0 (0000000001df6742 0 00) 65536 54 #|/data1 2 rw | 0 (0000000001df6782 0 00) 65536 0 #|/data1 3 rw M 1956 (0000000000d66dd2 0 00) 8192 12 /tmp/333163398 4 r c 0 (0000000000000001 0 00) 0 528 /dev/bintime 5 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 6 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 7 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 8 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 9 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 10 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 11 r c 0 (000000000000000f 0 00) 0 32 /dev/random 12 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 13 r c 0 (000000000000000a 0 00) 0 0 /dev/null 14 rw | 0 (0000000001df6801 0 00) 65536 0 #|/data 15 rw | 0 (0000000001df6802 0 00) 65536 1275 #|/data1 R=rsc, bradfitz, aram CC=golang-codereviews https://golang.org/cl/51420044
2014-01-13os: disable TestReaddirStatFailures on Plan 9David du Colombier
R=rsc, dave, aram, jeremyjackins, lucio.dere CC=golang-codereviews, jas https://golang.org/cl/50980043
2014-01-10os, os/exec, os/user: add support for GOOS=solarisAram Hăvărneanu
R=golang-codereviews, dave, minux.ma, gobot, jsing CC=golang-codereviews https://golang.org/cl/36020043
2014-01-04os: add tests for operations on nil *File methodsDave Cheney
R=shawn.p.smith, gobot, r CC=golang-codereviews https://golang.org/cl/46820043
2014-01-04os: return ErrInvalid if receiver is nil.Dave Cheney
Fixes #7043. Test coming in https://golang.org/cl/46820043 R=r, bradfitz CC=golang-codereviews https://golang.org/cl/38330045
2014-01-01os: improve Readdir and Readdirnames test coverageShawn Smith
R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/46450043
2013-12-21os: reimplement HasPrefix and LastIndex to not depend on stringsDavid du Colombier
R=golang-codereviews, rsc CC=golang-codereviews, jas https://golang.org/cl/44790043
2013-12-19os: rename only works as part of the same directory on Plan 9David du Colombier
R=golang-dev, lucio.dere, rsc CC=golang-dev https://golang.org/cl/44080046
2013-12-18crypto/x509: add non-cgo darwin system anchor certsJosh Bleecher Snyder
The set of certs fetched via exec'ing `security` is not quite identical to the certs fetched via the cgo call. The cgo fetch includes any trusted root certs that the user may have added; exec does not. The exec fetch includes an Apple-specific root cert; the cgo fetch does not. Other than that, they appear to be the same. Unfortunately, os/exec depends on crypto/x509, via net/http. Break the circular dependency by moving the exec tests to their own package. This will not work in iOS; we'll cross that bridge when we get to it. R=golang-dev, minux.ma, agl CC=golang-dev https://golang.org/cl/22020045
2013-12-17os: avoid a string concat in readdirBrad Fitzpatrick
R=golang-dev, crawshaw CC=golang-dev https://golang.org/cl/37690045
2013-12-17os, path/filepath: don't ignore Lstat errors in ReaddirBrad Fitzpatrick
os: don't ignore LStat errors in Readdir. If it's ENOENT, on the second pass, just treat it as missing. If it's another error, it's real. path/filepath: use ReaddirNames instead of Readdir in Walk, in order to obey the documented WalkFunc contract of returning each walked item's LStat error, if any. Fixes #6656 Fixes #6680 R=golang-dev, r CC=golang-dev https://golang.org/cl/43530043
2013-12-17all: add missing copyrightChaiShushan
R=golang-dev, iant CC=golang-dev https://golang.org/cl/43290043
2013-12-09os: fix build.Shenghou Ma
CL 36800043 and CL 36930044 have a merge conflict that I overlooked. R=golang-dev CC=golang-dev https://golang.org/cl/39850043
2013-12-09os: clarify docs for Rename.Shenghou Ma
Three changes: 1. mention "move" to clarify things up. 2. use {old,new}path instead of {old,new}name, which makes it clear what relative path would do here. 3. mention "OS-specific restrictions might apply". Fixes #6887. R=golang-dev, alex.brainman, iant, r CC=golang-dev https://golang.org/cl/36930044
2013-10-29os: do not return Lstat errors from ReaddirRuss Cox
This CL restores the Go 1.1.2 semantics for os.File's Readdir method. The code in Go 1.1.2 was rewritten mainly because it looked buggy. This new version attempts to be clearer but still provide the 1.1.2 results. The important diff is not this CL's version against tip but this CL's version against Go 1.1.2. Go 1.1.2: names, err := f.Readdirnames(n) fi = make([]FileInfo, len(names)) for i, filename := range names { fip, err := Lstat(dirname + filename) if err == nil { fi[i] = fip } else { fi[i] = &fileStat{name: filename} } } return fi, err This CL: names, err := f.Readdirnames(n) fi = make([]FileInfo, len(names)) for i, filename := range names { fip, lerr := lstat(dirname + filename) if lerr != nil { fi[i] = &fileStat{name: filename} continue } fi[i] = fip } return fi, err The changes from Go 1.1.2 are stylistic, not semantic: 1. Use lstat instead of Lstat, for testing (done before this CL). 2. Make error handling in loop body look more like an error case. 3. Use separate error variable name in loop body, to be clear we are not trying to influence the final return result. Fixes #6656. Fixes #6680. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/18870043
2013-10-07os/user: fix user lookups on dragonflyJoel Sing
Like FreeBSD, DragonFly does not provide a sysconf value for _SC_GETPW_R_SIZE_MAX. R=golang-dev, iant CC=golang-dev https://golang.org/cl/14469043