mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
The descriptor-passing change reached for syscall.FcntlInt, which exists in x/sys/unix and not in Darwin's syscall package, so every build on a Mac has failed since it landed. The last tag builds; main does not, which is the shape that gets noticed late. x/sys/unix is already required, so this adds nothing but the import. Co-authored-by: Hanzo Dev <[email protected]>
30 lines
1000 B
Go
30 lines
1000 B
Go
//go:build darwin
|
|
|
|
package zip
|
|
|
|
import (
|
|
"os"
|
|
"runtime"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// recvFlags carries no MSG_CMSG_CLOEXEC because Darwin has none. The flag is
|
|
// set immediately after instead, which leaves the fork window Linux closes —
|
|
// stated here rather than hidden, because it is a property of the platform and
|
|
// not something this package can fix.
|
|
const recvFlags = 0
|
|
|
|
// setCloexec marks a received descriptor close-on-exec.
|
|
//
|
|
// Through x/sys/unix rather than syscall: FcntlInt is not in Darwin's syscall
|
|
// package, so the file this replaces did not compile on a Mac at all — main has
|
|
// been unbuildable there since the descriptor-passing change landed, while the
|
|
// last tag builds. unix is already a dependency, so this adds nothing.
|
|
func setCloexec(fd int) {
|
|
_, _ = unix.FcntlInt(uintptr(fd), unix.F_SETFD, unix.FD_CLOEXEC)
|
|
}
|
|
|
|
// runtimeKeepFiles holds the files alive until the syscall has copied them.
|
|
func runtimeKeepFiles(files []*os.File) { runtime.KeepAlive(files) }
|