Граф коммитов

36 Коммитов

Автор SHA1 Сообщение Дата
Tobias Klauser af8b642124 unix: use pipe2 syscall in Pipe on NetBSD
The pipe2 syscall is part of NetBSD since version 6.0 and thus exists in
all officially supported versions (6.0 through 6.1 and 7.0+).

Follows CL 94035 which did the same for package syscall.

Change-Id: Icfa7dfb13788c9a7425c641d0233b109e8c79e7f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/370794
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
2021-12-10 11:16:14 +00:00
Russ Cox 9a76102bfb all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I01667f826428426a39c84717d02efa25fa44553c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/294490
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Russ Cox <rsc@golang.org>
2021-02-20 05:07:31 +00:00
Tobias Klauser 9555bcde0c unix: add Pipe2 on netbsd
Re-submit after CL 283593 broke the dragonfly builders.

Change-Id: Ifdeb7642be32f5d3d3862aacdff90a0da4886365
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283599
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-18 08:51:08 +00:00
Tobias Klauser 4bcb84eeeb Revert "unix: add Pipe2 on netbsd"
This reverts CL 283593.

Reason for revert: breaks DragonflyBSD builders and was submitted during code freeze.

Change-Id: I784f58ae56f7259d5176921d7a61070e0ac7cb52
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283597
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-13 18:17:07 +00:00
Tobias Klauser 3196cb8d8e unix: add Pipe2 on netbsd
Also move TestPipe2 into a separate file, enabling it for all platforms
where Pipe2 is available.

Change-Id: I1a31e9563f5f60ef0e994abc1db57b7f1c58fe88
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283593
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-01-13 11:20:37 +00:00
Tobias Klauser a1369afcda unix: add flags argument in //sys comments for Fstatvfs1 and Statvfs1 on netbsd
Otherwise, these functions would not be generated correctly. Follow-up
for CL 209637.

Also regenerate the zsyscall_netbsd_*.go files, causing the definition
of sysctl to move.

Change-Id: I829e8c94a69b6aeb251b46bc4762f2a7bbc45a8e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212460
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2020-01-03 14:33:44 +00:00
Tobias Klauser c96a22e43c unix: add Dup3 on netbsd and openbsd
Change-Id: Id871d3d211d6d5896e41b673c7bfe3a1d8e756a6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212461
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-02 14:19:24 +00:00
Tobias Klauser abf886d6f5 unix: unify definition of func fcntl
For linux and *bsd, implement func fcntl in fcntl.go instead of
generating it. Implement it using fcntl64Syscall, so SYS_FCNTL64 is used
on 32-bit linux.

For aix, darwin and solaris continue generate func fcntl as before.

Change-Id: I3750b88d1ee5573daaee2b75c369f723fde8834a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212337
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-23 22:40:30 +00:00
Tobias Klauser ce4227a45e unix: add Statvfs and Fstatvfs on NetBSD
NetBSD replaced statfs with statvfs in NetBSD 3.0. statfs is derived
from BSD4.4, while NetBSD (and Solaris) implement statvfs from POSIX
instead.

Generated and tested on NetBSD 8.0 (amd64). Also tested on NetBSD 7.0 (amd64).

Change-Id: I53738b77815d04c7774a6455b4a31cd4e9571f7b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/209637
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-12-04 07:23:24 +00:00
Tobias Klauser 2aa67d56cd unix: fix Select to return number of ready fds on Darwin and *BSD
Make Select's signature on Darwin and the BSDs match the one on Linux
and return the number of ready file descriptors.

Fixes golang/go#34458

Change-Id: Ia618ce34ff754f2b731d7f913cab840d7948579c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196802
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-24 06:27:00 +00:00
Yuval Pavel Zholkover 15dcb6c006 unix: fix Getdirentries emulation using Getdents on netbsd, openbsd
Call Seek if basep is not nil to read the current dir offset.
Return EIO error if the offset doesn't fit into a 32-bit uintptr.
Make Getdents public.

Update golang/go#32498

Change-Id: Idfbc48d3fc3a6cc8a979242681e8882d39998285
Reviewed-on: https://go-review.googlesource.com/c/sys/+/182319
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-06-16 12:48:12 +00:00
Visweswara R 4ed8d59d0b unix: replace "mksyscall.pl" script with a Go program
Port mksyscall.pl Perl script to mksyscall.go.
mkall scripts are modified to run mksyscall.go.
Running ./mkall.sh does not generate any git diff besides
the command name in comments of generated files.

Updates golang/go#27779

Change-Id: I8c6eb852e6821f4a91dc03cc042d8d343f1bcf66
Reviewed-on: https://go-review.googlesource.com/c/150217
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-28 09:27:32 +00:00
Tobias Klauser f7626d0b15 unix: add remaining *at functions on netbsd
Add Fchownat, Linkat, Mkdirat, Mkfifoat, Mknodat, Openat, Readlinkat,
Renameat, Symlinkat and Unlinkat.

Change-Id: Id498b2f1a99f281599bc226a0c50a13172e36e4f
Reviewed-on: https://go-review.googlesource.com/c/145818
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-30 14:20:55 +00:00
Tobias Klauser 9ff3f177ec unix: add Openat on netbsd
Change-Id: Ie37958307e8bf6d5fd47caa7ab5b1c209d0cca00
Reviewed-on: https://go-review.googlesource.com/c/144977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-26 20:36:11 +00:00
Tobias Klauser f0d5e33068 unix: add *xattr functions on NetBSD
Reuse the functions added for FreeBSD.

Change-Id: Icf5bf65c82f91147659947f6ea296dd2555724a0
Reviewed-on: https://go-review.googlesource.com/128256
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-10 07:02:07 +00:00
Tobias Klauser 8ee9f3e146 unix: add Faccessat on NetBSD
Change-Id: I7005494cbb955804c9f5bbcecf148fd77808a0b9
Reviewed-on: https://go-review.googlesource.com/118615
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 14:54:33 +00:00
Tobias Klauser ee8db001f5 unix: add Fadvise on NetBSD
Change-Id: I7b32bbbfc73e8e05898bd640e9e92a183c72b92b
Reviewed-on: https://go-review.googlesource.com/101935
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-21 18:38:08 +00:00
Tobias Klauser dd203b86c4 unix: add Fchmodat on NetBSD
Change-Id: I63889a9e4eb2c9d8846fa6e47f8c74f54ff7ede8
Reviewed-on: https://go-review.googlesource.com/101575
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-21 07:41:17 +00:00
Tobias Klauser 932fb2287b unix: add Fstatat on NetBSD
Change-Id: Id2ae518a5f6abfdae56398a3ef7f205267057257
Reviewed-on: https://go-review.googlesource.com/100616
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-14 13:46:50 +00:00
Tobias Klauser 1d2aa6dbde unix: add Getcwd to support Getwd on all BSDs
All BSDs provide the SYS___GETCWD syscall which can be used to implement
Getwd.

Also add a test based on TestChdirAndGetwd from os/os_test.go

Change-Id: I243eae3e02a40e92afad317eb1f8a28b6032c131
Reviewed-on: https://go-review.googlesource.com/83755
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-14 07:29:55 +00:00
Tobias Klauser d4266bc12a unix: add ioctl functions on NetBSD
Add IoctlGetInt/IoctlSetInt, IoctlGetTermios/IoctlSetTermios and
IoctlGetWinsize/IoctlSetWinsize on NetBSD. These are similar to the
already existing implementations on Linux, Darwin and Solaris.

Change-Id: I6c38d946b9f461c8e4c6c5e044aaff9b37e4b02f
Reviewed-on: https://go-review.googlesource.com/76171
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-06 15:25:25 +00:00
Tobias Klauser af4555b109 unix: move Poll implementation for BSDs into syscall_bsd.go
Now that all BSD flavors support Poll, move the common implementation
into syscall_bsd.go

Change-Id: Id62a6163d41ef24e33f96540b661002b095a2fa1
Reviewed-on: https://go-review.googlesource.com/74290
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-31 08:18:28 +00:00
Tobias Klauser 0649f9fe46 unix: add Poll function on NetBSD
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: I61ec50c5ea7d6db43f7688ed925d6ed26a6bbc3a
Reviewed-on: https://go-review.googlesource.com/73650
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-27 07:17:55 +00:00
Tobias Klauser 43e60d72a8 unix: unify memory functions on BSD
Make Madvice, Mlock, Mlockall, Mprotect, Msync, Munlock and Munlockall
available equally on all BSD flavors. NetBSD was previously lacking
SYS_MSYNC, so add it.

Reorder the //sys function prototype alphabetically and clean up already
implemented syscalls everywhere.

Also add tests for Mprotect, Msync and Madvice - now that they're
available on all unix platforms.

Fixes golang/go#18513

Change-Id: I0eb502d72c7e991f191fb96225ef04e8297d8b8d
Reviewed-on: https://go-review.googlesource.com/56172
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-17 23:46:08 +00:00
Tobias Klauser 2d3e384235 unix: add utimensat and use it for UtimesNano on BSD
Follow golang.org/cl/55130 and add the utimensat syscall on *BSD. Use it
in UtimesNano and UtimesNanoAt (which is added on *BSD, akin to the
already existing implementation on Linux and Solaris).

Also add AT_FDCWD and AT_SYMLINK_NOFOLLOW where they are missing. These
might be used with UtimesNanoAt.

In order to be able to generate the syscalls, also add two missing
$GOOS_$GOARCH patterns to mkall.sh. As a side effect, some additional
syscalls are added for openbsd/arm.

Change-Id: I85351098002209f8454ec328cef0cfe9d12c5214
Reviewed-on: https://go-review.googlesource.com/55071
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-14 19:17:52 +00:00
Sameer Ajmani aaabbdc969 x/sys/unix: remove the "use" function and its calls.
Update mksyscall*.pl to skip generating calls to "use".
Make build tag handling match what's used in the syscall package.

See issue https://golang.org/issue/16607
and CL https://golang.org/cl/36616

Change-Id: I2d2e823fe1846d2110c07eb1bf976852706ecf60
Reviewed-on: https://go-review.googlesource.com/36715
Run-TryBot: Sameer Ajmani <sameer@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-10 16:30:38 +00:00
Mikio Hara f78f5183ff unix: fix missing use of use function in sysctl
Updates golang/go#13372.

Change-Id: Idfd5001f4ad7bc80a4283df1c310f97612eba85c
Reviewed-on: https://go-review.googlesource.com/23124
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-15 20:56:54 +00:00
Shenghou Ma 379497e3ff unix: add explicit build tags
Change-Id: I62774b8ee0c1a7cc1a3b7009ca860e3fd64a6564
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/10182
Reviewed-by: Rob Pike <r@golang.org>
2015-05-18 19:15:57 +00:00
Brad Fitzpatrick 71c96e4240 unix: don't allocate putting common errno values in error interfaces
From main repo: https://go-review.googlesource.com/#/c/6701/3

Fixes golang/go#10266

Change-Id: I141fefe7f317edcea19b588b1569fa8772237f56
Reviewed-on: https://go-review.googlesource.com/8190
Reviewed-by: Rob Pike <r@golang.org>
2015-03-27 16:15:35 +00:00
Ian Lance Taylor 5829c74886 unix: change Dup,Dup2,Dup3 to use Syscall, not RawSyscall
This avoids hanging when a Go program uses a FUSE filesystem and the
dup system call has to close a file descriptor.  When dup uses
RawSyscall then the goroutine calling dup will occupy a scheduler slot
(a p structure) during the call, and may block waiting for some other
goroutine to respond to the close call on the FUSE filesystem.
Changing to Syscall avoids the problem.  This makes Dup a tiny bit
slower but is quite unlikely to make a difference for any real
programs.

Update golang/go#10202.

Change-Id: I590c5c9a04e0a1281a85dc553c7592fa83949ac7
Reviewed-on: https://go-review.googlesource.com/8056
Reviewed-by: Rob Pike <r@golang.org>
2015-03-26 17:59:35 +00:00
William Orr 853bdd547a unix: add mlock/munlock/mlockall/munlockall/mprotect to *BSD
Change-Id: I01c5dd902bbc349b860600ec2b3d556e2dc406c9
Reviewed-on: https://go-review.googlesource.com/1921
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-06 02:05:08 +00:00
Dave Cheney bd7f565490 x/sys/unix: regenerate zsyscall_* files
Fixes build breakage due to missing syscall import.

LGTM=adg, r
R=r, adg
CC=golang-codereviews
https://golang.org/cl/162650044
2014-11-10 11:48:04 +00:00
Rob Pike c1f6f8bcc5 go.sys/unix: use "use" in syscall interface
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/144980043
2014-09-16 13:36:53 -07:00
Rob Pike dc3c21c62b go.sys/unix: use syscall.Errno for errors
If we use a local type, it won't compare properly with errors from
the rest of the standard library. Errors are the one type from syscall
that propagates through the system, so it's important to have only
one type for them.

Ditto for syscall.Signal.

LGTM=dave
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/123490043
2014-08-15 09:57:24 -07:00
Rob Pike 8442dd2c63 go.sys: update package names
Semi-automatic migration from package syscall to package {plan9,windows,unix}.
No builds attempted yet, but this gets a lot of noise behind us so subsequent
CLs will be more concise and easier to follow.
Subsequent CLs will have semantic content.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/121520043
2014-08-11 15:58:26 -07:00
Rob Pike 20acc5cf31 go.sys: copy files from syscall package to go.sys/{plan9,windows,unix}
This CL copies to each package of go.sys the files from syscall it will need.
Different directories have different files, but these:
        mkall.sh
        str.go
        syscall.go
        mksyscall.pl
        race.go
        race0.go
        syscall_test.go
are copied to all three.
No changes yet, these are just copies. They are not ready to use yet:
package names are wrong, for starters. But this clean copy will make
it easier to follow the changes as the packages are enabled.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/126960043
2014-08-11 14:48:46 -07:00