summaryrefslogtreecommitdiff
path: root/src/syscall/syscall_unix.go
Commit message (Collapse)AuthorAgeFilesLines
* syscall: let ENOSYS, ENOTSUP and EOPNOTSUPP implement errors.ErrUnsupportedTobias Klauser2023-03-161-2/+5
| | | | | | | | | | | | | | | | | | | As suggested by Bryan, also update (Errno).Is on windows to include the missing oserror cases that are covered on other platforms. Quoting Bryan: > Windows syscalls don't actually return those errors, but the dummy Errno > constants defined on Windows should still have the same meaning as on > Unix. Updates #41198 Change-Id: I15441abde4a7ebaa3c6518262c052530cd2add4b Reviewed-on: https://go-review.googlesource.com/c/go/+/476875 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
* syscall: check if to is nil to prevent panic from SendtoAndy Pan2022-09-261-4/+10
| | | | | | | | | | | | | Fixes #55845 Change-Id: If30263b7d34829c40e6606846115ec520f351f2c Reviewed-on: https://go-review.googlesource.com/c/go/+/433504 Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Andy Pan <panjf2000@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* syscall: use unsafe.Slice instead of unsafeheader packageTobias Klauser2022-09-091-6/+1
| | | | | | | | | | Change-Id: I9de5aafb36d05bdc90bbdba516367eb2b200a7e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/428777 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
* syscall: move Syscall declarations to OS filesMichael Pratt2022-04-211-5/+0
| | | | | | | | | | | | | | Future CLs will be changing the provenance of these functions. Move the declarations to the individual OS files now so that future CLs can change only 1 OS at a time rather than changing all at once. For #51087 Change-Id: I5e1bca71e670263d8c0faa586c1b6b4de1a114b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/388474 Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* all: gofmt main repoRuss Cox2022-04-111-0/+1
| | | | | | | | | | | | | | | [This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: use new "unix" build tag where appropriateIan Lance Taylor2022-03-291-1/+1
| | | | | | | | | | For #20322 For #51572 Change-Id: Id0b4799d097d01128e98ba4cc0092298357bca45 Reviewed-on: https://go-review.googlesource.com/c/go/+/389935 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
* syscall: use bytealg.IndexByte in clenTobias Klauser2022-03-181-4/+3
| | | | | | | | | | Change-Id: Ib3f92ea8371a13471acf9304dc9db66c0aae9bf4 Reviewed-on: https://go-review.googlesource.com/c/go/+/393756 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Trust: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gopher Robot <gobot@golang.org>
* syscall: add race annotations to Pread and PwriteIan Lance Taylor2022-03-121-0/+36
| | | | | | | | | | | Fixes #51618 Change-Id: Ife894d8c313dce8c4929f40fa0ac90a069f77a89 Reviewed-on: https://go-review.googlesource.com/c/go/+/391954 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
* net: pass around pointers to SockaddrInetNJosh Bleecher Snyder2021-11-041-4/+4
| | | | | | | | | | | | | ...instead of the structs themselves. Escape analysis can handle this, and it'll avoid a bunch of large struct copies. Change-Id: Ia9c6064ed32a4c26d5a96dae2ed7d7ece6d38704 Reviewed-on: https://go-review.googlesource.com/c/go/+/361264 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: remove the alloc from ReadMsgUDPAddrPortJosh Bleecher Snyder2021-11-041-0/+27
| | | | | | | | | | | | | | | | | | name old time/op new time/op delta ReadWriteMsgUDPAddrPort-8 4.95µs ± 5% 4.55µs ± 1% -7.96% (p=0.016 n=5+4) name old alloc/op new alloc/op delta ReadWriteMsgUDPAddrPort-8 32.0B ± 0% 0.0B -100.00% (p=0.008 n=5+5) name old allocs/op new allocs/op delta ReadWriteMsgUDPAddrPort-8 1.00 ± 0% 0.00 -100.00% (p=0.008 n=5+5) Change-Id: Ib968c6f2968926ec9a364dd52063cd0d7c29b10c Reviewed-on: https://go-review.googlesource.com/c/go/+/360862 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: remove the alloc from WriteMsgUDPAddrPortJosh Bleecher Snyder2021-11-041-0/+16
| | | | | | | | | | | | | | | | | | name old time/op new time/op delta ReadWriteMsgUDPAddrPort-8 5.12µs ± 8% 4.59µs ± 3% -10.19% (p=0.000 n=10+9) name old alloc/op new alloc/op delta ReadWriteMsgUDPAddrPort-8 64.0B ± 0% 32.0B ± 0% -50.00% (p=0.000 n=10+10) name old allocs/op new allocs/op delta ReadWriteMsgUDPAddrPort-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.000 n=10+10) Change-Id: Idf540b2f9f8035660305a0ab1cfc3e162569db63 Reviewed-on: https://go-review.googlesource.com/c/go/+/361257 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: unify unix Recvmsg epiloguesJosh Bleecher Snyder2021-11-041-0/+10
| | | | | | | | | | | | These were identical. This is a preliminary step towards remove allocs per UDP receive. Change-Id: I83106cd3f1fe4bc5bae2d1b0ebd23eedd820abed Reviewed-on: https://go-review.googlesource.com/c/go/+/361258 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: unify unix Sendmsg prologuesJosh Bleecher Snyder2021-11-041-0/+17
| | | | | | | | | | | | These were identical. This is a preliminary step towards remove allocs per UDP send. Change-Id: I21e1264c7d4747baa626ddb93afff4c1cf225d13 Reviewed-on: https://go-review.googlesource.com/c/go/+/361256 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: migrate new UDP send/recv API to internal/syscall/unixJosh Bleecher Snyder2021-11-031-4/+4
| | | | | | | | | | | | CL 331490 and friends added new API to package syscall. This was a mistake that we need to fix before Go 1.18 is released. Change-Id: I697c9a4fa649d564822f585dc163df5ab9e5ae08 Reviewed-on: https://go-review.googlesource.com/c/go/+/361216 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* runtime, syscall: add calls to asan functionsfanzha022021-11-021-0/+6
| | | | | | | | | | | | | | | | | | | | Add explicit address sanitizer instrumentation to the runtime and syscall packages. The compiler does not instrument the runtime package. It does instrument the syscall package, but we need to add a couple of cases that it can't see. Refer to the implementation of the asan malloc runtime library, this patch also allocates extra memory as the redzone, around the returned memory region, and marks the redzone as unaddressable to detect the overflows or underflows. Updates #44853. Change-Id: I2753d1cc1296935a66bf521e31ce91e35fcdf798 Reviewed-on: https://go-review.googlesource.com/c/go/+/298614 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: fannie zhang <Fannie.Zhang@arm.com>
* all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox2021-10-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* net: reduce allocation size in ReadFromUDPJosh Bleecher Snyder2021-08-161-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to concrete types. Bring your own object to fill in. Allocate just enough for the IP byte slice. The allocation is now just 4 bytes for IPv4, which puts it in the tiny allocator, which is much faster. name old time/op new time/op delta WriteToReadFromUDP-8 13.7µs ± 1% 13.4µs ± 2% -2.49% (p=0.000 n=10+10) name old alloc/op new alloc/op delta WriteToReadFromUDP-8 32.0B ± 0% 4.0B ± 0% -87.50% (p=0.000 n=10+10) name old allocs/op new allocs/op delta WriteToReadFromUDP-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) Windows is temporarily stubbed out. Updates #43451 Change-Id: Ief506f891b401d28715d22dce6ebda037941924e Reviewed-on: https://go-review.googlesource.com/c/go/+/331490 Trust: Josh Bleecher Snyder <josharian@gmail.com> Trust: Damien Neil <dneil@google.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com>
* net: remove allocation from UDPConn.WriteToJosh Bleecher Snyder2021-08-161-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | Duplicate some code to avoid an interface. name old time/op new time/op delta WriteToReadFromUDP-8 6.38µs ±20% 5.59µs ±10% -12.38% (p=0.001 n=10+9) name old alloc/op new alloc/op delta WriteToReadFromUDP-8 64.0B ± 0% 32.0B ± 0% -50.00% (p=0.000 n=10+10) name old allocs/op new allocs/op delta WriteToReadFromUDP-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.000 n=10+10) Windows is temporarily stubbed out. Updates #43451 Change-Id: Ied15ff92268c652cf445836e0446025eaeb60cc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/331489 Trust: Josh Bleecher Snyder <josharian@gmail.com> Trust: Damien Neil <dneil@google.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
* all: add internal/itoa packageJosh Bleecher Snyder2021-03-141-2/+3
| | | | | | | | | | | | | This replaces five implementations scattered across low level packages. (And I plan to use it in a sixth soon.) Three of the five were byte-for-byte identical. Change-Id: I3bbbeeac63723a487986c912b604e10ad1e042f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/301549 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
* all: go fmt std cmd (but revert vendor)Russ Cox2021-02-201-0/+1
| | | | | | | | | | | | | | | | Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: update references to symbols moved from os to io/fsRuss Cox2020-10-201-1/+1
| | | | | | | | | | | | | | | | | | The old os references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. For #41190. Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd Reviewed-on: https://go-review.googlesource.com/c/go/+/243907 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
* all: add GOOS=iosCherry Zhang2020-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Introduce GOOS=ios for iOS systems. GOOS=ios matches "darwin" build tag, like GOOS=android matches "linux" and GOOS=illumos matches "solaris". Only ios/arm64 is supported (ios/amd64 is not). GOOS=ios and GOOS=darwin remain essentially the same at this point. They will diverge at later time, to differentiate macOS and iOS. Uses of GOOS=="darwin" are changed to (GOOS=="darwin" || GOOS=="ios"), except if it clearly means macOS (e.g. GOOS=="darwin" && GOARCH=="amd64"), it remains GOOS=="darwin". Updates #38485. Change-Id: I4faacdc1008f42434599efb3c3ad90763a83b67c Reviewed-on: https://go-review.googlesource.com/c/go/+/254740 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* internal/unsafeheader: consolidate stringHeader and sliceHeader declarations ↵Bryan C. Mills2020-05-011-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | into an internal package The new package "internal/unsafeheader" depends only on "unsafe", and provides declarations equivalent to reflect.StringHeader and reflect.SliceHeader but with Data fields of the proper unsafe.Pointer type (instead of uintptr). Unlike the types it replaces, the "internal/unsafeheader" package has a regression test to ensure that its header types remain equivalent to the declarations provided by the "reflect" package. Since "internal/unsafeheader" has almost no dependencies, it can be used in other low-level packages such as "syscall" and "reflect". This change is based on the corresponding x/sys change in CL 231177. Fixes #37805 Updates #19367 Change-Id: I7a6d93ef8dd6e235bcab94e7c47270aad047af31 Reviewed-on: https://go-review.googlesource.com/c/go/+/231223 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: treat ENFILE as a temporary errorLorenz Bauer2019-10-301-1/+1
| | | | | | | | | | | | | | | ENFILE is returned from accept when the whole system has run out of file descriptors. Mark the error as temporary, so that accept loops continue working. Fixes #35131 Updates #1891 Change-Id: Idf44c084731898ff4c720d06c250d3b8a42de312 Reviewed-on: https://go-review.googlesource.com/c/go/+/203117 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: redirect writes to runtime.write in faketime modeAustin Clements2019-09-041-1/+8
| | | | | | | | | | | | | | | | | | | | | If the faketime build tag is set, this causes syscall.Write for FDs 1 and 2 to redirect to runtime.write, since that's where we'll apply the faketime framing. This is equivalent to what nacl currently does in naclFile.write. We do this on all of the platforms except nacl, which has its own faketime support and we're about to remove, and Windows, which would require other changes to support faketime so we're leaving alone for now. Updates #30439. Change-Id: I138a5ca63577d92d15b5437d037bd3159fa84ee7 Reviewed-on: https://go-review.googlesource.com/c/go/+/192739 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: fix duplicate commentsmicnncim2019-08-301-1/+1
| | | | | | | | | | Removed repetitions of "the" in some comments. Change-Id: I36a6f51609765076de32e1b97398c4c08743aafc GitHub-Last-Rev: 4d06aea6a787cfca40eda10845897ff149fff62c GitHub-Pull-Request: golang/go#33797 Reviewed-on: https://go-review.googlesource.com/c/go/+/191497 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
* syscall: document relationship among Errno, errors.Is and os.Err*Jonathan Amsterdam2019-08-221-0/+6
| | | | | | | | | | | | - Add doc to syscall.Errno (and syscall.ErrorString for plan9). - Mention under `syscall` in release notes. Fixes #33436. Change-Id: I032ffebaa76ed67eb9d748e7645ca73f26144ea0 Reviewed-on: https://go-review.googlesource.com/c/go/+/191337 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: remove os.ErrTimeoutDamien Neil2019-08-021-2/+0
| | | | | | | | | | | | | | It is unclear whether the current definition of os.IsTimeout is desirable or not. Drop ErrTimeout for now so we can consider adding it (or some other error) in a future release with a corrected definition. Fixes #33411 Change-Id: I8b880da7d22afc343a08339eb5f0efd1075ecafe Reviewed-on: https://go-review.googlesource.com/c/go/+/188758 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: remove os.ErrTemporaryDamien Neil2019-08-011-2/+0
| | | | | | | | | | | | | | | | | | | | As discussed in https://github.com/golang/go/issues/32463#issuecomment-506833421 the classification of deadline-based timeouts as "temporary" errors is a historical accident. I/O timeouts used to be duration-based, so they really were temporary--retrying a timed-out operation could succeed. Now that they're deadline-based, timeouts aren't temporary unless you reset the deadline. Drop ErrTemporary from Go 1.13, since its definition is wrong. We'll consider putting it back in Go 1.14 with a clear definition and deprecate net.OpError.Temporary. Fixes #32463 Change-Id: I70cda664590d8872541e17409a5780da76920891 Reviewed-on: https://go-review.googlesource.com/c/go/+/188398 Reviewed-by: Jonathan Amsterdam <jba@google.com>
* syscall: remove unused {dragonfly,illumos,solaris}64Bit constantsTobias Klauser2019-05-051-5/+2
| | | | | | | | | | | These are unused since CL 153837. illumos64Bit was added by CL 174457 but was never used. Change-Id: I34a1bd41cf70f8a07e57f93a71de3c6034fcaf7b Reviewed-on: https://go-review.googlesource.com/c/go/+/175358 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: add new GOOS=illumos, split out of GOOS=solarisJoshua M. Clulow2019-04-301-0/+1
| | | | | | | | | | | | | | | | Like GOOS=android which implies the "linux" build tag, GOOS=illumos implies the "solaris" build tag. This lets the existing ecosystem of packages still work on illumos, but still permits packages to start differentiating between solaris and illumos. Fixes #20603 Change-Id: I8f4eabf1a66060538dca15d7658c1fbc6c826622 Reviewed-on: https://go-review.googlesource.com/c/go/+/174457 Run-TryBot: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: allow empty string argument to SetsockoptStringTobias Klauser2019-04-051-1/+5
| | | | | | | | | | | | Don't panic with "index out of range" on empty string argument. Fixes golang/go#31277 Change-Id: I005f9523caec76337cb2ec87272a6be4736bce18 Reviewed-on: https://go-review.googlesource.com/c/go/+/170937 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* os: make errors.Is work with ErrPermission et al.Damien Neil2019-03-201-0/+17
| | | | | | | | | | | | | | | | | | As proposed in Issue #29934, update errors produced by the os package to work with errors.Is sentinel tests. For example, errors.Is(err, os.ErrPermission) is equivalent to os.IsPermission(err) with added unwrapping support. Move the definition for os.ErrPermission and others into the syscall package. Add an Is method to syscall.Errno and others. Add an Unwrap method to os.PathError and others. Updates #30322 Updates #29934 Change-Id: I95727d26c18a5354c720de316dff0bffc04dd926 Reviewed-on: https://go-review.googlesource.com/c/go/+/163058 Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
* syscall: add AIX operating systemClément Chigot2018-10-101-1/+1
| | | | | | | | | | | | | | | This commit adds AIX operating system to syscall package for ppc64 architecture. It also adds the file syscall_aix.go in the runtime package for syscalls needed during fork and exec. Updates: #25893 Change-Id: I301b1051b178a3efb7bbc39cdbd8e00b594d65ef Reviewed-on: https://go-review.googlesource.com/c/138720 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net, syscall: make ECONNRESET/ECONNABORTED only temporary for AcceptIan Lance Taylor2018-05-011-1/+1
| | | | | | | | | | | Updates #6163 Fixes #24808 Change-Id: I4f5c686ebf60f72f71f566199ee3e946076202bb Reviewed-on: https://go-review.googlesource.com/110439 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: support Getwd on all BSDsTobias Klauser2018-02-131-0/+10
| | | | | | | | | | | | | | | | | | | | | All supported BSDs provide the SYS___GETCWD syscall which can be used to implement syscall.Getwd. With this change os.Getwd can use a single syscall instead of falling back to the current kludge solution on the BSDs. This doesn't add any new exported functions to the frozen syscall package, only ImplementsGetwd changes to true for dragonfly, freebsd, netbsd and openbsd. As suggested by Ian, this follows CL 83755 which did the same for golang.org/x/sys/unix. Also, an entry for netbsd/arm is added to mkall.sh which was used to generate the syscall wrappers there. Change-Id: I84da1ec61a6b8625443699a63cde556b6442ad41 Reviewed-on: https://go-review.googlesource.com/84484 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: fix Send{msg,msgN}, Recvmsg and control message handling on solarisMikio Hara2016-10-031-0/+1
| | | | | | | | | | | | | | | | | | This change switches the use of socket implementation from the conventional SUS-based one to the latest POSIX-based one to make socket control message work correctly on Solaris. It looks like those two implementations, Socket over TLI/XTI and Socket, have different semantics in details but it wouldn't hurt the existing applications because the exposed syscall API doesn't support socket properties related to such a protocol independent application framework. Fixes #7402. Change-Id: I45a4e782d606bfbebe1404086c50a8c69af53461 Reviewed-on: https://go-review.googlesource.com/30171 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: single space after period.Brad Fitzpatrick2016-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* internal/race: add packageDmitry Vyukov2015-11-261-9/+10
| | | | | | | | | | | | | Factor out duplicated race thunks from sync, syscall net and fmt packages into a separate package and use it. Fixes #8593 Change-Id: I156869c50946277809f6b509463752e7f7d28cdb Reviewed-on: https://go-review.googlesource.com/14870 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Dmitry Vyukov <dvyukov@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime, syscall: add calls to msan functionsIan Lance Taylor2015-10-211-0/+6
| | | | | | | | | | | Add explicit memory sanitizer instrumentation to the runtime and syscall packages. The compiler does not instrument the runtime package. It does instrument the syscall package, but we need to add a couple of cases that it can't see. Change-Id: I2d66073f713fe67e33a6720460d2bb8f72f31394 Reviewed-on: https://go-review.googlesource.com/16164 Reviewed-by: David Crawshaw <crawshaw@golang.org>
* syscall: don't allocate when boxing common Errno values into errorsBrad Fitzpatrick2015-03-271-0/+24
| | | | | | | | | | Fixes #8859 Change-Id: If8098e6edad1f83dc35fa84f4431689e8ee97678 Reviewed-on: https://go-review.googlesource.com/6701 Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: mark ECONNRESET, ECONNABORTED as temporary network errorsRuss Cox2014-09-181-1/+1
| | | | | | | | | Fixes #6163. LGTM=adg R=golang-codereviews, adg, dvyukov CC=golang-codereviews https://golang.org/cl/141600043
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+299
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.