]> Cypherpunks repositories - gostls13.git/commit
internal/syscall/unix: fix PosixFallocate error check on freebsd
authorTobias Klauser <tklauser@distanz.ch>
Wed, 5 Apr 2023 11:16:58 +0000 (13:16 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 5 Apr 2023 14:17:36 +0000 (14:17 +0000)
commita156e02c16c1e0e71ba0477a27734b8d38f41cf7
tree9b6f3462cd57e06b88e432d019c35f6c262b4868
parent508f445a28b08ed8c881572652c47139e669c19d
internal/syscall/unix: fix PosixFallocate error check on freebsd

The posix_fallocate syscall returns the result in r1 rather than in
errno:

> If successful, posix_fallocate() returns zero. It returns an error on failure, without
> setting errno.

Source: https://man.freebsd.org/cgi/man.cgi?query=posix_fallocate&sektion=2&n=1

Adjust the PosixFallocate wrappers on freebsd to account for that.

Also, CL 479715 used the same syscall wrapper for 386 and arm. However,
on arm the syscall argument order is different. The wrapper was
generated using mksyscall.go from the golang.org/x/sys/unix package,
adjusting the r1 check correspondingly.

Fixes #59352

Change-Id: I9a4e8e4546237010bc5e730c4988a2a476264cf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/481621
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/link/internal/ld/fallocate_test.go
src/cmd/link/internal/ld/outbuf_freebsd.go
src/internal/syscall/unix/at_sysnum_freebsd.go
src/internal/syscall/unix/fallocate_freebsd_32bit.go [deleted file]
src/internal/syscall/unix/fallocate_freebsd_386.go [new file with mode: 0644]
src/internal/syscall/unix/fallocate_freebsd_64bit.go
src/internal/syscall/unix/fallocate_freebsd_arm.go [new file with mode: 0644]