Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vminitd/Sources/vmexec/vmexec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extension App {
// lookup executable
let path = Path.findPath(currentEnv) ?? Path.getCurrentPath()
guard let resolvedExecutable = Path.lookPath(process.args[0], path: path) else {
throw App.Failure(message: "Failed to find target executable \(process.args[0])")
throw App.Failure(message: "failed to find target executable \(process.args[0])")
}

let executable = strdup(resolvedExecutable.path())
Expand Down
6 changes: 3 additions & 3 deletions vminitd/Sources/vminitd/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ struct Application {

log.logLevel = .debug

log.info("vminitd booting...")
log.info("vminitd booting")
let eg = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
let server = Initd(log: log, group: eg)

do {
log.info("serve vminitd api")
log.info("serving vminitd API")
try await server.serve(port: vsockPort)
log.info("vminitd api returned...")
log.info("vminitd API returned")
} catch {
log.error("vminitd boot error \(error)")
exit(1)
Expand Down
14 changes: 7 additions & 7 deletions vminitd/Sources/vminitd/ManagedProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ final class ManagedProcess: Sendable {

var io: IO
if stdio.terminal {
log.info("setting up terminal IO")
log.info("setting up terminal I/O")
let attrs = Command.Attrs(setsid: false, setctty: false)
process.attrs = attrs
io = try TerminalIO(
Expand All @@ -138,7 +138,7 @@ final class ManagedProcess: Sendable {
)
}

log.info("starting io")
log.info("starting I/O")

// Setup IO early. We expect the host to be listening already.
try io.start(process: &process)
Expand Down Expand Up @@ -176,7 +176,7 @@ extension ManagedProcess {

let size = MemoryLayout<Int32>.size
guard let piddata = try syncPipe.fileHandleForReading.read(upToCount: size) else {
throw ContainerizationError(.internalError, message: "no pid data from sync pipe")
throw ContainerizationError(.internalError, message: "no PID data from sync pipe")
}

guard piddata.count == size else {
Expand Down Expand Up @@ -210,7 +210,7 @@ extension ManagedProcess {

if self.terminal {
log.info(
"wait for pty fd",
"wait for PTY FD",
metadata: [
"id": "\(id)"
])
Expand All @@ -219,14 +219,14 @@ extension ManagedProcess {
guard let ptyFd = try self.syncPipe.fileHandleForReading.read(upToCount: size) else {
throw ContainerizationError(
.internalError,
message: "no pty data from sync pipe"
message: "no PTY data from sync pipe"
)
}
let fd = ptyFd.withUnsafeBytes { ptr in
ptr.load(as: Int32.self)
}
log.info(
"received pty fd from container, attaching",
"received PTY FD from container, attaching",
metadata: [
"id": "\(id)"
])
Expand Down Expand Up @@ -263,7 +263,7 @@ extension ManagedProcess {
do {
try $0.io.close()
} catch {
self.log.error("failed to close io for process: \(error)")
self.log.error("failed to close I/O for process: \(error)")
}

for waiter in $0.waiters {
Expand Down
3 changes: 2 additions & 1 deletion vminitd/Sources/vminitd/Server+GRPC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ extension Initd: Com_Apple_Containerization_Sandbox_V3_SandboxContextAsyncProvid
"stdin": "Port: \(request.stdin)",
"stdout": "Port: \(request.stdout)",
"stderr": "Port: \(request.stderr)",
"configuration": "\(request.configuration.count)",
])

if !request.hasContainerID {
Expand Down Expand Up @@ -508,7 +509,7 @@ extension Initd: Com_Apple_Containerization_Sandbox_V3_SandboxContextAsyncProvid
if error is GRPCStatus {
throw error
}
throw GRPCStatus(code: .internalError, message: "create managed process: \(error)")
throw GRPCStatus(code: .internalError, message: "createProcess: \(error)")
}
}

Expand Down
7 changes: 4 additions & 3 deletions vminitd/Sources/vminitd/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ final class Initd: Sendable {
await ProcessSupervisor.default.setLog(self.log)
await ProcessSupervisor.default.ready()

log.debug(
"booting grpc server on vsock",
log.info(
"booting gRPC server on vsock",
metadata: [
"port": "\(port)"
])
Expand All @@ -105,7 +105,7 @@ final class Initd: Sendable {
serviceProviders: [self])
).get()
log.info(
"grpc api serving on vsock",
"gRPC API serving on vsock",
metadata: [
"port": "\(port)"
])
Expand All @@ -114,6 +114,7 @@ final class Initd: Sendable {
try await server.onClose.get()
}
try await group.next()
log.info("closing gRPC server")
group.cancelAll()
}
}
Expand Down