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

23 Коммитов

Автор SHA1 Сообщение Дата
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 13fcbd661c unix: add Getdents on FreeBSD
Fixes golang/go#16137

Change-Id: I0b7ebb71b95de3c262242ddb4032da5f470f5643
Reviewed-on: https://go-review.googlesource.com/80535
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-30 01:39:27 +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 92ac112afc unix: add Poll function on FreeBSD
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: I56ee0124a04c64e3ea51a1653901f2f4277983e6
Reviewed-on: https://go-review.googlesource.com/73370
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-25 15:18:35 +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
Tobias Klauser e312636bda unix: add ioctl functions on FreeBSD
Add IoctlGetInt/IoctlSetInt, IoctlGetTermios/IoctlSetTermios and
IoctlGetWinsize/IoctlSetWinsize on FreeBSD. These are similar to the
already existing implementations on Linux, Darwin and Solaris.

Generated on FreeBSD 10.11-RELEASE.

Change-Id: I79b273032cfeb719ec5550ac15635fd9f3231469
Reviewed-on: https://go-review.googlesource.com/52710
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-02 14:19:12 +00:00
Tobias Klauser b892924b68 unix: add *at functions (POSIX.1-2008) on FreeBSD
Add the Faccessat, Fchmodat, Fchownat, Linkat, Mkdirat, Readlinkat,
Renameat, Symlinkat and Unlinkat functions (to conform to POSIX.1-2008)
and also add the missing AT_* constants.

Generated on FreeBSD 10.11-RELEASE for freebsd/amd64 and freebsd/386.

Change-Id: I1aea155d5375cfd6b38662018ccb5b834151b982
Reviewed-on: https://go-review.googlesource.com/52070
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-01 02:10:45 +00:00
Tobias Klauser 0f826bdd13 unix: re-enable Capsicum on FreeBSD 386
Capsicum support was added by https://golang.org/cl/47290, but only for
amd64. This broke the freebsd/386 build which was subsequently fixed by
http://golang.org/cl/51270. However, even with this fix the tests still
fail to build due to the missing Capsicum functions and types.

Fix the build/test on freebsd/386 for real by re-running mkall.sh on
FreeBSD 11.1-RELEASE (inside VirtualBox) to get all the Capsicum
functions and types.

Some zerrors constants were removed or converted to enums in the FreeBSD
headers. Manually move them to a dedicated file. Do the same for amd64,
where these constants were removed by accident in
https://golang.org/cl/47290.

Updates golang/go#21136

Change-Id: I54fe2c4567674b07dedad677756369a43a1f0ef6
Reviewed-on: https://go-review.googlesource.com/51570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-28 17:44:21 +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 46ba3e7a19 unix: re-run mksyscall on freebsd and linux after previous merge
The previous cherry-pick merge of fadvice from Gerrit added the
fadvise system calls, but from before the errno CL, which went in
concurrently.

Change-Id: I6f01e020bfe2930a8ea2fdbe4998ab9e2669ce14
Reviewed-on: https://go-review.googlesource.com/8199
Reviewed-by: Rob Pike <r@golang.org>
2015-03-27 17:05:09 +00:00
Eric ea745763b1 unix: Added posix_fadvise support for Linux and FreeBSD
Support includes 386, amd64, and arm for both Linux and FreeBSD.
FreeBSD changes courtesy Dave Chapeskie <dchapeskie@gmail.com>

Change-Id: I89dc18533d7178e74ae6c442a2e6272c9bd9692c
Reviewed-on: https://go-review.googlesource.com/8055
Reviewed-by: Rob Pike <r@golang.org>
2015-03-27 16:47:22 +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
William Orr ac22431096 go.sys/unix: add support for *xattr functions on FreeBSD
Add wrappers that provide Linux-y behavior around the FreeBSD extattr(2)
functions. This allows certain packages, like the fuse package to run
under FreeBSD.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/147850043
2014-10-08 07:29:25 -07: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