There is currently no way to ignore signals using the os/signal package.
It is possible to catch a signal and do nothing but this is not the same
as ignoring it. The new function Ignore allows a set of signals to be
ignored. The new function Reset allows the initial handlers for a set of
signals to be restored.
Fixes#5572
Change-Id: I5c0f07956971e3a9ff9b9d9631e6e3a08c20df15
Reviewed-on: https://go-review.googlesource.com/3580
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This is an alternative to http://golang.org/cl/4150,
and is motivated by a review comment on that CL.
testKillProcess() tries to build and run the Go equivalent
for "sleep 1". This doesn't work for testing cross compilers
since the Go compiler is not available on the targets. This
change embeds the "sleep 1" functionality within the "os.test"
binary itself.
Change-Id: I6bad513deaa6c9e2704e70319098eb4983f1bb23
Reviewed-on: https://go-review.googlesource.com/4190
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reverts https://golang.org/cl/119530044 (OS X 10.10 Yosemite beta
14A299l workaround), since it was fixed in the final Yosemite release.
I verified that the C program http://swtch.com/~rsc/readdirbug.c
passes on Yosemite.
Adds a new test to the os package too, to verify that reading a
regular file as a directory fails.
Fixes#9789 (ReadDir: no error if dirname is a file)
Change-Id: I75286cef88fbb2ebccf045b479e33c810749dcbc
Reviewed-on: https://go-review.googlesource.com/4164
Reviewed-by: Dave Cheney <dave@cheney.net>
This change is an implementation of the signal
runtime and os/signal package on Plan 9.
Contrary to Unix, on Plan 9 a signal is called
a note and is represented by a string.
For this reason, the sigsend and signal_recv
functions had to be reimplemented specifically
for Plan 9.
In order to reuse most of the code and internal
interface of the os/signal package, the note
strings are mapped to integers.
Thanks to Russ Cox for the early review.
Change-Id: I95836645efe21942bb1939f43f87fb3c0eaaef1a
Reviewed-on: https://go-review.googlesource.com/2164
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Only documentation / comment changes. Update references to
point to golang.org permalinks or go.googlesource.com/go.
References in historical release notes under doc are left as is.
Change-Id: Icfc14e4998723e2c2d48f9877a91c5abef6794ea
Reviewed-on: https://go-review.googlesource.com/4060
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Since CL 3676, the TestMkdirAllAtSlash test
depends on syscall.EROFS, which isn't defined
on Plan 9.
This change works around this issue by
defining a system dependent isReadonlyError
function.
Change-Id: If972fd2fe4828ee3bcb8537ea7f4ba29f7a87619
Reviewed-on: https://go-review.googlesource.com/3696
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is a followup to CL 3676.
Rather than silently returning from the test, a pass,
use the Skip facility to mark the test as skipped.
Change-Id: I90d237e770150bf8d69f14fb09874e70894a7f86
Reviewed-on: https://go-review.googlesource.com/3682
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
On some systems (e.g. ChromeOS), / is mounted read-only.
This results in error code syscall.EROFS, which I guess
is just as valid as syscall.EACCES for this test.
Change-Id: I9188d5437a1b5ac1daa9c68b95b8dcb447666ca3
Reviewed-on: https://go-review.googlesource.com/3676
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change is a recreation of the CL written
by Nick Owens on http://golang.org/cl/150730043.
If the stat buffer is too short, the kernel
informs us by putting the 2-byte size in the
buffer, so we read that and try again.
This follows the same algorithm as /sys/src/libc/9sys/dirfstat.c.
Fixes#8781.
Change-Id: I01b4ad3a5e705dd4cab6673c7a119f8bef9bbd7c
Reviewed-on: https://go-review.googlesource.com/3281
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Remove use of itod on posix systems and replace with call to itoa.
Build and use same itoa function on all systems.
Fix infinite recursion in iota function for the case -1<<63.
Change-Id: I89d7e742383c5c4aeef8780501c78a3e1af87a6f
Reviewed-on: https://go-review.googlesource.com/2213
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is to reduce the delta between dev.cc and dev.garbage to just garbage collector changes.
These are the files that had merge conflicts and have been edited by hand:
malloc.go
mem_linux.go
mgc.go
os1_linux.go
proc1.go
panic1.go
runtime1.go
LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/174180043
For some reason lsof is now hanging on my workstation
without the -b (avoid blocking in the kernel) option.
Adding -b makes the test pass and shouldn't hurt.
I don't know how recent the -b option is. If the builders
are ok with it, it's probably ok.
LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/166220043
In CL 160670043 the write function was changed
so a zero-length write is now allowed. This leads
the ExampleWriter_Init test to fail.
The reason is that Plan 9 preserves message
boundaries, while the os library expects systems
that don't preserve them. We have to ignore
zero-length writes so they will never turn into EOF.
This issue was previously discussed in CL 7406046.
LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/163510043
This brings dev.power64 up-to-date with the current tip of
default. go_bootstrap is still panicking with a bad defer
when initializing the runtime (even on amd64).
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/152570049
This also removes pkg/runtime/traceback_lr.c, which was ported
to Go in an earlier commit and then moved to
runtime/traceback.go.
Reviewer: rsc@golang.org
rsc: LGTM
Since CL 104570043 and 112720043, we are using the
nsec system call instead of /dev/bintime on Plan 9.
LGTM=rsc
R=rsc
CC=aram, golang-codereviews
https://golang.org/cl/155590043
This error is returned by lib9p when removing a file
without parent. It should fix TestRemoveAllRace
when running on ramfs.
LGTM=bradfitz, aram
R=rsc, bradfitz, aram
CC=golang-codereviews, mischief
https://golang.org/cl/153410044
The internal comments are not completely precise about
what is going on, and they are causing confusion.
Fixes#8283.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/151460043
While we're here, fix the implementation of Release on both
Unix and Windows: Release is supposed to make Signal an error.
While we're here, make sure we never Signal pid 0.
(Don't try this at home.)
Fixes#7658.
LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/152240043
Should fix the Windows build. Untested.
on Windows, args are made by src/os/exec_windows.go, not package runtime.
runtime·goargs has if(Windows) return;
The two init funcs in pkg os were conflicting, with the second
overwriting Args back to an empty slice.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/143540044
In linker, refuse to write conservative (array of pointers) as the
garbage collection type for any variable in the data/bss GC program.
In the linker, attach the Go type to an already-read C declaration
during dedup. This gives us Go types for C globals for free as long
as the cmd/dist-generated Go code contains the declaration.
(Most runtime C declarations have a corresponding Go declaration.
Both are bss declarations and so the linker dedups them.)
In cmd/dist, add a few more C files to the auto-Go-declaration list
in order to get Go type information for the C declarations into the linker.
In C compiler, mark all non-pointer-containing global declarations
and all string data as NOPTR. This allows them to exist in C files
without any corresponding Go declaration. Count C function pointers
as "non-pointer-containing", since we have no heap-allocated C functions.
In runtime, add NOPTR to the remaining pointer-containing declarations,
none of which refer to Go heap objects.
In runtime, also move os.Args and syscall.envs data into runtime-owned
variables. Otherwise, in programs that do not import os or syscall, the
runtime variables named os.Args and syscall.envs will be missing type
information.
I believe that this CL eliminates the final source of conservative GC scanning
in non-SWIG Go programs, and therefore...
Fixes#909.
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/149770043
It's just fundamentally incompatible with
Windows' pickiness about removing things
that are in use.
TBR=brainman
CC=golang-codereviews
https://golang.org/cl/142270043