Skip to content

Commit f473aaf

Browse files
committed
prepare for CZ wrappers
Signed-off-by: Elijah Wright <git@elijahs.space>
1 parent 1065604 commit f473aaf

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

vminitd/Sources/vminitd/TerminalIO.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ import Foundation
1919
import Logging
2020
import SendableProperty
2121

22-
#if canImport(Musl)
23-
import Musl
24-
private let _syscall = Musl.syscall
25-
#elseif canImport(Darwin)
26-
import Darwin
27-
private let _syscall = Darwin.syscall
28-
#endif
29-
3022
final class TerminalIO: ManagedProcess.IO & Sendable {
3123
@SendableProperty
3224
private var parent: Terminal? = nil
@@ -61,12 +53,12 @@ final class TerminalIO: ManagedProcess.IO & Sendable {
6153

6254
func attach(pid: Int32, fd: Int32) throws {
6355
#if os(Linux)
64-
let containerFd = _syscall(Int(SYS_pidfd_open), pid, 0)
56+
let containerFd = CZ_pidfd_open(pid, 0)
6557
guard containerFd != -1 else {
6658
throw POSIXError.fromErrno()
6759
}
6860

69-
let hostFd = _syscall(Int(CZ_pidfd_getfd), containerFd, fd, 0)
61+
let hostFd = CZ_pidfd_getfd(containerFd, fd, 0)
7062
guard Foundation.close(Int32(containerFd)) == 0 else {
7163
self.log?.error("failed to close pidfd: \(POSIXError.fromErrno())")
7264
}

0 commit comments

Comments
 (0)