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.
Fixesgolang/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>
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>
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>
This CL is a copy of CL 106275 (see CL 106275 for details).
It introduces CertInfo, CertTrustListInfo and CertRevocationCrlInfo
types. It uses pointers to new types instead of uintptr in CertContext,
CertSimpleChain and CertRevocationInfo.
CertRevocationInfo, CertChainPolicyPara and CertChainPolicyStatus types
have uintptr field that can be pointer to many different things
(according to Windows API). So this CL introduces Pointer type to be
used for those cases.
Fixesgolang/go#25797
Change-Id: I7797ddc6daf3e67b7eab69ab9fbf4d51650f8b6a
Reviewed-on: https://go-review.googlesource.com/118797
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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>
It uses __get_cpuid_count, provided by cpuid.h.
The xgetbv is implemented after its counterpart in cpu_x86.s.
Change-Id: I97624d7da67ab4ec3c9a53b0bfc4dfcdf7d12c87
Reviewed-on: https://go-review.googlesource.com/116155
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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>
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.
Fixesgolang/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>
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.
Fixesgolang/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>
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>
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.
Fixesgolang/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>
This CL introduces a new cpu package for CPU/platform feature detection.
The cpu package is basically a copy of `internal/cpu` of the standard library.
Revision: bf86aec25972f3a100c3aa58a6abcbcc35bdea49
This CL does not export ARM64 and PPC64 feature detection since at the moment
ARM64/PPC64 requires standard library support.
Updates golang/go#24843
Change-Id: I11bc1ca60b116e902c941b5887c00870dbb1f899
Reviewed-on: https://go-review.googlesource.com/107015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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>
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>
By simply rearranging the logic, we avoid the overhead of a superfluous
call to getsockopt. For, if p is already non empty, there's no point
in having to check if we need to attach dummy payload. This has
performance benefits when using send/recvmsg for high speed
communications.
Change-Id: If47ab5322464aad8e6d2603a369e95327223211f
Reviewed-on: https://go-review.googlesource.com/108337
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>