Commit Graph

5 Commits

Author SHA1 Message Date
Jason A. Donenfeld
f89234f9a2 unix: __sysctl is sysctl on darwin
While the other BSDs use __sysctl as the name, Darwin now uses sysctl,
without the leading underscores, and considers __sysctl to be "private".
Using __sysctl leads to App Store rejections, and Go's syscall package
already uses the proper syscall. So this commit changes Darwin's syscall
to use it too here, while reverting a recent commit that removed it all
together on arm and arm64.

This reverts CL 194097.

Fixes golang/go#35103
Updates golang/go#34133
Updates golang/go#35101

Change-Id: Ic72d5e7a435b99fe62c533b77b2c3790590f4c9e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202837
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-23 15:13:26 +00:00
Tobias Klauser
3421d5a6bb unix: avoid __getdirentries64 on darwin
Getdirentries is implemented with the __getdirentries64 function
in libSystem.dylib on darwin/{386,amd64}. That function can't be used in
an app store application.

Implement Getdirentries using the underlying
fdopendir/readdir_r/closedir for Go 1.13. The simulation isn't faithful,
and could be slow, but it should handle common cases.

For Go 1.12, fall back to raw syscalls since syscall.syscallPtr needed
to use fdopendir from libSystem.dylib is not available.

Follow CL 168479 and CL 170892 which did the same for syscall in the
stdlib.

Tested on darwin/amd64 with Go 1.11, Go 1.12 and Go 1.13

Fixes golang/go#34400

Change-Id: I631382aaea9ee7e0c4ed09e06ad5427efc620769
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196478
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-02 06:39:06 +00:00
Keith Randall
9fbf701fc3 unix: reverse default for 1.11/1.12 split
Make 1.11 the explicitly named case, and 1.12 the default.

Change-Id: Ic3674860eb9e8a5bb1cf1da12c5ac583cc0b0633
Reviewed-on: https://go-review.googlesource.com/c/155397
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-21 06:53:00 +00:00
Keith Randall
4dcd0b7660 unix: remove raw syscall from Getfsstat
Use libc version instead.

Update golang/go#17490

Change-Id: Ibcedccb9715961904d12fc85f69a7139b6c26658
Reviewed-on: https://go-review.googlesource.com/c/154660
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-20 18:18:36 +00:00
Keith Randall
45d26eb94b unix: convert Darwin syscalls from raw to libSystem
Call into libSystem (Darwin's libc equivalent) to do system calls.
Raw syscalls are not a supported ABI on Darwin, they want us to use
libSystem calls instead.

The stdlib has already been converted to this new regime.  This
package is vendored into the stdlib, so we need to fix it also, then
vendor it in again.

Because this package isn't tied to a Go release, we need to keep the
old code around and use the new code only for 1.12 and up.

Update golang/go#17490

Change-Id: Idbcacff096b5bfeac871aa75dfd971570ac93322
Reviewed-on: https://go-review.googlesource.com/c/154179
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-20 18:13:18 +00:00