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

382 Коммитов

Автор SHA1 Сообщение Дата
Tobias Klauser 3249cb6984 unix: drop incorrect Fsetxattr size return value
Fsetxattr should just return an error (like Setxattr and like Fsetxattr
is already doing on FreeBSD).

Fix for CL 128176

Updates golang/go#26832

Change-Id: Id1c1315d9eb6952128e0c0ce44b19060e0403cc0
Reviewed-on: https://go-review.googlesource.com/128495
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-08 14:12:55 +00:00
Jan Lehnardt f62c962c3e unix: add S_IRWXG and S_IRWXO to FreeBSD types
I found this during https://github.com/DataDog/datadog-agent/pull/2079

Change-Id: I51d57e7e3cedb8b23e720bc03f38504dc0ad063d
GitHub-Last-Rev: 4e1c193db8
GitHub-Pull-Request: golang/sys#13
Reviewed-on: https://go-review.googlesource.com/126620
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-08 13:53:31 +00:00
Tobias Klauser acbc56fc70 unix: add F*xattr on Linux
Add Fgetxattr, Flistxattr, Fremovexattr and Fsetxattr on Linux.

Updates golang/go#26832

Change-Id: Ia79915e91a928188c6c985ef301d5445f630b19c
Reviewed-on: https://go-review.googlesource.com/128176
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-07 16:23:57 +00:00
Matt Layher 90887a55d6 unix: add IFLA_INFO_KIND on Linux
Change-Id: Ib31ac102a973690d0391626102e1646c8dd387cb
Reviewed-on: https://go-review.googlesource.com/128315
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-07 15:54:10 +00:00
Tobias Klauser 0718ef2ef2 unix: remove *xattr from list of unimplemented syscalls on FreeBSD
These are all implemented on FreeBSD.

Change-Id: I5f3558c19d7540e08cfa77a06fffd80a9c80f1f3
Reviewed-on: https://go-review.googlesource.com/128175
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-07 14:11:23 +00:00
Tobias Klauser 2be389f392 unix: add Renameat2 on Linux
Renameat2 is Linux-specific and allows to pass an additional flags
argument to the renameat syscall. Also add the corresponding RENAME_*
flag mask values.

Change-Id: Ib4baa46fdd0b07ccd0988ac624862ce69d5c3ad5
Reviewed-on: https://go-review.googlesource.com/127763
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-06 19:25:00 +00:00
Mark Pulford 34b17bdb43 unix: fix OpenBSD codegen to include F_OK
F_OK is used with access(2), but it was removed for openbsd/amd64 when
generated code was updated to OpenBSD 6.3 in 7f59abf3.

Fixes golang/go#26593

Change-Id: I4a542506b1045f0c860bb3137c4d81149a5e1cae
Reviewed-on: https://go-review.googlesource.com/126635
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-08-06 08:24:29 +00:00
Brad Fitzpatrick 0ffbfd41fb unix, windows: add type aliases to std syscall for Signal, Errno, SysProcAttr
To simplify the pkg syscall docs.

Change-Id: I3ed0bfc59564ada280141c4662a56e141d197e1f
Reviewed-on: https://go-review.googlesource.com/127656
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-02 20:32:16 +00:00
Casey Callendrello 3dc4335d56 unix: add Linux network namespace constants
This adds the NETNSA constants from net_namespace.h, used for creating
and querying network namespace IDs.

Fixes golang/go#26330
Change-Id: I786c4c4771be3eddc4fdb830a52e128aa1a2b9fd
Reviewed-on: https://go-review.googlesource.com/124436
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-01 22:11:39 +00:00
Ian Lance Taylor bd9dbc187b unix: support Faccessat flags argument
The Linux kernel faccessat system call does not take a flags parameter.
The flag parameter to the C library faccessat function is implemented in C.
The unix.Faccessat function takes a flags parameter. In older releases
we have passed the flags parameter to the kernel, which ignored it.
In CL 119495 we started returning an error if any flags were set.
That seems clearly better than ignoring them, but it turns out that some
code was using the flags. The code was previously subtly broken.
Now it is obviously broken. That is better, but we can do better still:
we can implement the flags as the C library does. That is what this CL does.

Change-Id: I02d4bb981ebd39eb35e47c6e5281f85eaea68016
Reviewed-on: https://go-review.googlesource.com/126516
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-27 23:04:15 +00:00
Brad Fitzpatrick e3f9388ec6 unix: add Linux blkpg_ioctl_arg and blkpg_partition types
For manipulating Linux partitions with the BLKPG ioctl.

Change-Id: I2196038ccfc39ecd6926817c3b310d0837220095
Reviewed-on: https://go-review.googlesource.com/125642
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-27 22:55:06 +00:00
David Wimmer c4d1ff19d3 unix: implement pipe() on linux/mips
Change the Pipe() function to use the pipe() syscall (which has a unique
calling convention on linux/mips) instead of using pipe2(). This allows
it to work on kernels <2.6.27 when pipe2() was introduced.

Change-Id: I088886e66b594232869d8b88c6e1a630c76188a3
Reviewed-on: https://go-review.googlesource.com/126176
Reviewed-by: Vladimir Stefanovic <vladimir.stefanovic@mips.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-27 19:22:02 +00:00
Brad Fitzpatrick e072cadbbd unix: document IoctlSetWinsize and IoctlSetTermios and fix pointer lifetime
Change-Id: I42e59149e58bd928d9beb2c6665ce186b377d2a1
Reviewed-on: https://go-review.googlesource.com/125640
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-24 21:28:12 +00:00
Alexander Menzhinsky 1b2967e3c2 unix: implement RFCOMM sockets on Linux
Add the SockaddrRFCOMM type and the ability to accept BTPROTO_L2CAP and BTPROTO_RFCOMM protocol sockets.

Fixes golang/go#22211

Change-Id: I580b526c5392b90663499af0f2ebe6f55b1f8154
Reviewed-on: https://go-review.googlesource.com/122457
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-07-09 06:02:33 +00:00
Tobias Klauser 7b495ad4e7 unix: update Dockerfile to Go 1.11beta1
This way we'll get the correct generated code comments.

Change-Id: I273cd16dcce99b49b6df0b86fc191b3ff5d7167a
Reviewed-on: https://go-review.googlesource.com/122458
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-09 05:52:51 +00:00
Tobias Klauser ce36f3865e unix: regenerate syscall wrappers for linux/ppc64{,le}
Somehow they were not included in CL 119495. No functional change,
faccessat was just moved.

Change-Id: I954a37109ff2287de14cdf657bd309cae96671de
Reviewed-on: https://go-review.googlesource.com/122297
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-06 06:23:52 +00:00
Ian Lance Taylor 7138fd3d9d unix: do not return non-nil error for 0 errno in FcntlInt
Fixes golang/go#26078

Change-Id: Ie5a8c7028a755bc7a8d56abc4736a5f61ef91ce5
Reviewed-on: https://go-review.googlesource.com/121175
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-27 14:26:11 +00:00
Tobias Klauser c4afb3effa unix: fix TestUtimesNanoAt for filesystems with 1-second resolution time stamps
Some file systems don't support sub-second time stamp resolution. Handle
these correctly by only checking nanoseconds in case Mtim.Nsec is zero.

Fixes golang/go#26034

Change-Id: I1ab400b8e09b5cfdac6b70a33f676770a48180b1
Reviewed-on: https://go-review.googlesource.com/120816
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: jimmy frasche <soapboxcicero@gmail.com>
2018-06-26 15:59:39 +00:00
Tobias Klauser a200a19cb9 unix: don't check atime in TestUtimesNanoAt
If the underlying filesystem doesn't support atime or was mounted with the
noatime mount option, TestUtimesNanoAt fails when comparing atime:

--- FAIL: TestUtimesNanoAt (0.00s)
	syscall_linux_test.go:144: UtimesNanoAt: wrong atime: {1111 0}
	syscall_linux_test.go:147: UtimesNanoAt: wrong mtime: {3333 0}
FAIL
FAIL	golang.org/x/sys/unix	0.376s

Fix it by dropping the atime comparison, it's enough to verify UtimesNanoAt
working correctly by comparing mtime.

Fixes golang/go#26034

Change-Id: Id868f9d4c6a856a99ae930a46bfe91bd64ca8570
Reviewed-on: https://go-review.googlesource.com/120562
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-25 16:25:22 +00:00
Tobias Klauser 63fc586f45 unix: use private copy of ustat_t on Linux
The ustat syscall has been deprecated on Linux for a long time and the
upcoming glibc 2.28 will remove ustat.h and it can no longer be used to
to generate the Ustat_t wrapper type. Since Linux still provides the
syscall, let's not break this functionality and add a private copy of
struct ustat so Ustat_t can still be generated.

Updates golang/go#25990

Change-Id: I74cf405ce6df92da36f1ee900ab6d98997d8f994
Reviewed-on: https://go-review.googlesource.com/120295
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-22 08:20:34 +00:00
Thanabodee Charoenpiriyakij ad87a3a340 unix: check faccessat flags parameter on Linux
Currently Linux faccessat(2) syscall implementation doesn't support the
flags parameter. As per discuss in golang/go#25845, permit the same flags
as glibc [1].

[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/faccessat.c;h=ea42b2303ff4b2d2d6548ea04376fb265f773436;hb=HEAD

Fixes golang/go#25845

Change-Id: I390ba14b2816283399472f3572967b19d0a36042
Reviewed-on: https://go-review.googlesource.com/119495
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-20 13:35:08 +00:00
Tobias Klauser fc8bd948cf unix: don't use deprecated syscalls on linux/arm64
On linux/arm64 we used to manually define syscall numbers for some
deprecated syscalls. Most of them are unused by now anyhow. Convert the
remaining syscall wrappers using them to implement the respective
functionality using a non-deprecated syscall (in the same way glibc does
it):

- Implement EpollCreate using EpollCreate1 and additionally check
  that the passed size argument is larger than 0.
- Implement Futimesat and utimes using utimensat. Also change futimesat
  on the other geese to take a string instead of *byte and let the
  generated wrapper do the BytePtrFromString conversion.
- Return ENOSYS from Ustat. The ustat syscall has been deprecated for a
  long time in favor of fstatfs and statfs. Even glibc will deprecate
  ustat in the upcoming 2.28 release [1].

[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=d51fa09544f03899b7ff5a80569db088c3c23c28;hb=HEAD#l90

Change-Id: I7ea38a3cd394b0875f17443b14e107fd9c70350d
Reviewed-on: https://go-review.googlesource.com/119655
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-19 16:09:47 +00:00
Tobias Klauser f24d3d461d unix: add Faccessat on Solaris
Change-Id: Ie720f7c4d496e67f2a81de379374c2ec1f95bb96
Reviewed-on: https://go-review.googlesource.com/119556
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-19 13:15:59 +00:00
Tobias Klauser 9e6071e1da unix: follow convention for generated code comment
Follow the convertion (https://golang.org/s/generatedcode) for generated
code.

Change-Id: I27899b24366d5c0d2c5574b5eaf3d7e0babc8909
Reviewed-on: https://go-review.googlesource.com/118820
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 13:37:17 +00:00
Michael Stapelberg 56ede360ec unix: add rtc defines and types
Change-Id: I280fc3b2cd3402c40f2840d152bac2fa288f48a0
Reviewed-on: https://go-review.googlesource.com/118661
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-13 17:11:35 +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 f4b713d596 unix: add Faccessat on OpenBSD
Change-Id: I4e3101b4689e8e94fbae6634975d10c8bb6b8a31
Reviewed-on: https://go-review.googlesource.com/118616
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-13 14:36:30 +00:00
Matt Layher a9e25c09b9 unix: update Dockerfile to Ubuntu 18.04, Linux 4.17, and Go 1.10.3
The code has been regenerated using the updated software versions.

Change-Id: Ic2af968d4d8cbf3ab31e5bca1d6640642eb7115a
Reviewed-on: https://go-review.googlesource.com/118255
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-06-12 14:22:14 +00:00
Tobias Klauser 24c297a8f3 unix: support compiling with gccgo on linux/386
Implement socketcall and rawsocketcall in addition to seek (already
introduced in CL 100076) to support compiling with gccgo on linux/386

Change-Id: Iaa51aa159a4743ae0e394f541ff196e2d28aa27f
Reviewed-on: https://go-review.googlesource.com/117697
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-11 07:33:41 +00:00
Tobias Klauser 7c1e4f34a3 unix: drop use function stub for gccgo
The calls to use were removed in CL 36715.

Change-Id: I9f664d57e2595e932d702fdf6318d377e93e428a
Reviewed-on: https://go-review.googlesource.com/117455
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-10 12:29:00 +00:00
Tobias Klauser c11f84a56e unix: don't check atime in TestStatx
On some builders TestStatx occassionally fails when comparing atime
between Statx and Stat/Lstat.

--- FAIL: TestStatx (0.00s)
	syscall_linux_test.go:365: Statx: returned stat atime does not match Lstat

Fix it by dropping the atime comparison, it's enough to verify Statx
working correctly by comparing ctime and mtime. Also, not all
filesystems support atime.

Change-Id: I7da68bd20b9b21274c4993aa2c4241395d2c933a
Reviewed-on: https://go-review.googlesource.com/114616
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-25 14:28:21 +00:00
Tobias Klauser d4cedef346 unix: make Nfgenmsg a type definition
CL 114518 introduced Nfgenmsg as a type alias which breaks the build on
Go <= 1.9. Fix it by making Nfgenmsg a type like all others in
x/sys/unix

Updates golang/go#25561
Fixes golang/go#25563

Change-Id: I9950be857e34e7e3ca79c71fced9663a0cac9b63
Reviewed-on: https://go-review.googlesource.com/114596
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-25 12:34:33 +00:00
Michael Stapelberg 31355384c8 unix: add nftables defines and types
Change-Id: I55efe06ec81e891ec3872405ba75c7eb9ce4e635
Reviewed-on: https://go-review.googlesource.com/114518
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-25 06:20:15 +00:00
Tobias Klauser b269ba27ed unix: fix TestXattr on android
Like on linux, lsetxattr on symlinks returns EPERM.

Change-Id: I6dfc59484e1826872af54579dd6ec02705c816da
Reviewed-on: https://go-review.googlesource.com/114535
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-24 22:17:17 +00:00
Tobias Klauser 04b83988a0 unix: fix or skip failing tests on android and iOS
The mkfifo syscall is disallowed on android and iOS. sched_setaffinity
is disallowed on android. Skip all tests which use them.

/usr/bin does not exist on android. Use /system/bin in TestGetwd
instead, like TestChdirAndGetwd in the os package.

Like linux, android does not support Fchmodat with flags != 0. Adjust
TestFchmodat accordingly.

TestDevices might stat some device files which are not accessible, skip
those.

iOS cannot exec subprocesses, thus skip TestPassFD.

Fixes golang/go#25535

Change-Id: Ic764b9152f0a7b703ad4f47fdb1a9a5e94718154
Reviewed-on: https://go-review.googlesource.com/114395
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-24 13:58:53 +00:00
Tobias Klauser e2c7578ad1 unix: delete TestDevices for *BSD and Darwin
Instead, add a small test verify Major, Minor and Mkdev using arbitrary
numbers.

Leave TestDevices on Linux as its major/minor numbers are guaranteed
stable.

Updates golang/go#25528
Updates golang/go#25535

Change-Id: Ic105211660d80f9b3508ca9d518e9fac3b7e3beb
Reviewed-on: https://go-review.googlesource.com/114396
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-24 12:53:35 +00:00
Tobias Klauser 77b0e43150 unix: add symlink-safe *xattr functions on darwin
Updates golang/go#14456

Change-Id: I04632ef1d302e938a2cc373eb90f600f01404380
Reviewed-on: https://go-review.googlesource.com/114198
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-23 21:11:48 +00:00
Hana Kim f3b0f5faf5 unix: skip TestStatx if the operation is not permitted
Fixes golang/go#25529

Change-Id: Ifb7060106608fab0c87ce4596c9f16c14bde6205
Reviewed-on: https://go-review.googlesource.com/114093
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-23 20:51:00 +00:00
Hana Kim 028bb33fd0 unix: delete TestDevices test for Solaris
The test uses hardcoded numbers specific to one Solaris variant or
version. It's not guaranteed that they are stable over time or
across variants.

Fixes golang/go#25528

Change-Id: I148bd4d8264b802f07a2e886b99e76a40824af35
Reviewed-on: https://go-review.googlesource.com/114092
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-23 20:44:46 +00:00
Tobias Klauser 88eb85aaee unix: add tests for *xattr functions
Based on the tests in github.com/pkg/xattr

Change-Id: I3af73ad538877da042602708248063c218260a2e
Reviewed-on: https://go-review.googlesource.com/114135
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-22 22:42:04 +00:00
irfan sharif 0b6bef9960 unix: add {get,set,remove,list}xattr on darwin
It's only when dest is set to NULL that the OS X implementations of
getxattr() and listxattr() return the current sizes of the named
attributes. An empty byte array is not sufficient. To maintain the same
behaviour as the linux implementation, we wrap around the system calls
and pass in NULL when dest is empty.

The parameters for the OS X implementation of setxattr() vary slightly
compared to the linux system call, specifically the 'position'
parameter:

 linux:
     int setxattr(
         const char *path,
         const char *name,
         const void *value,
         size_t size,
         int flags
     );

 darwin:
     int setxattr(
         const char *path,
         const char *name,
         void *value,
         size_t size,
         u_int32_t position,
         int options
     );

'position' specifies the offset within the extended attribute. In the
current implementation, only the resource fork extended attribute makes
use of this argument. For all others, position is reserved.  We simply
default to setting it to zero.  If that's needed by the package user, a
function with a different name needs to be implemented instead.

Similarly for removexattr(), we wrap around and explicitly zero out the
options provided. We do so for interoperability with the linux variant.
If options are needed by the package user, a function with a different
name needs to be implemented instead.

Fixes golang/go#14456

Change-Id: I2581e1fa8dc9324bced7fda7f8ada10fe2ede3f5
Reviewed-on: https://go-review.googlesource.com/113995
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-22 21:16:09 +00:00
Filippo Valsorda 7f59abf37b unix: update openbsd/amd64 to OpenBSD 6.3
Change-Id: I0a16c77437e4ed68cc19eda41bb9b64ab4376fd0
Reviewed-on: https://go-review.googlesource.com/114075
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-05-22 14:59:51 +00:00
Tobias Klauser 89da893103 unix: exclude AUDIT_RECORD_MAGIC constant on darwin
CL 112696 changed mkerrors.sh to add filesystem magic constants on
linux. This leads to the unrelated AUDIT_RECORD_MAGIC constant being
added on darwin. Avoid this by explicity excluding it in mkerrors.sh.

Change-Id: I5a73797e5e9a1a92cb39f96f360fdb48982a7741
Reviewed-on: https://go-review.googlesource.com/114095
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-22 13:13:21 +00:00
Tobias Klauser 7c87d13f8e unix: add tpacket types and constants on Linux
Change-Id: I4f2fd8a7c899403f545d8dc73fec2ebbb0b322c0
Reviewed-on: https://go-review.googlesource.com/113035
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-14 14:36:08 +00:00
Brad Fitzpatrick d0faeb5398 unix: fix TestSCMCredentials to not fail when root
Fixes golang/go#25354

Change-Id: Ic74005ed26792a78354ffe76f567e9a009eabe9a
Reviewed-on: https://go-review.googlesource.com/112738
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-05-11 16:50:53 +00:00
Tobias Klauser 9950ad118b unix: add statfs and filesystem magic constants on Linux
Fixes golang/go#25341

Change-Id: I79cb4c77b771e005eb27d4e495ac6a7491e2e66e
Reviewed-on: https://go-review.googlesource.com/112696
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-11 13:39:06 +00:00
Hana (Hyang-Ah) Kim 64746a42f3 unix: address vet's finding of wrong argument size
From https://storage.googleapis.com/go-build-log/ebe363d0/misc-vet-vetall_b459ec91.log

cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:16: [amd64] Syscall: wrong argument size 64; expected $...-56
cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:19: [amd64] Syscall6: wrong argument size 88; expected $...-80
cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:22: [amd64] Syscall9: wrong argument size 112; expected $...-104
cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:25: [amd64] RawSyscall: wrong argument size 64; expected $...-56
cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:28: [amd64] RawSyscall6: wrong argument size 88; expected $...-80

Change-Id: I5c2264154e819a124aade5d18d261b7934b0090a
Reviewed-on: https://go-review.googlesource.com/112556
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-09 20:58:23 +00:00
Tobias Klauser 6f686a352d unix: add ErrnoName and SignalName
Add ErrnoName and SignalName to get errno and signal name strings from
syscall.Errno and syscall.Signal values, respectively.

This repurposes the errors and signals vars (because they are not used
within x/sys/unix currently) and turns them into slices of struct,
containing errno/signal number, name and description. ErrnoName and
SignalName can then be trivially implemented using sort.Search.

Renaming errors to errorList additionaly allows to avoid package aliases
for the errors package.

Fixes golang/go#25134

Change-Id: Ie195872793f44c437f0f175ccfaa13a2546338c5
Reviewed-on: https://go-review.googlesource.com/110875
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-04 06:42:12 +00:00
Tobias Klauser f67ecc163a unix: use Fstatat for Stat on linux/amd64
The stat syscall is disallowed by Android's seccomp policy on
linux/amd64. Use the fstatat syscall with AT_FDCWD and zero flags to
achieve the same behavior.

CL 109835 did the same for package syscall.

Change-Id: Iaa7d0dbf17ade4803f59b4361973ce627bcb65b4
Reviewed-on: https://go-review.googlesource.com/110061
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-30 07:01:21 +00:00
Jason A. Donenfeld cbbc999da3 unix: use pselect on amd64 to satisfy Android
This is yet another syscall that needs to be changed around for
Android's seccomp. We already do this in MIPS64 and ARM64, but
apparently forgot about AMD64.

Change-Id: I42c8a4653a55d4714dacfaf7add14012f428c992
Reviewed-on: https://go-review.googlesource.com/109835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-27 15:18:31 +00:00