MCPcopy
hub / github.com/opencontainers/runc / notifyHost

Function notifyHost

notify_socket.go:156–171  ·  view source on GitHub ↗

notifyHost tells the host (usually systemd) that the container reported READY. Also sends MAINPID and BARRIER.

(client *net.UnixConn, ready []byte, pid1 int)

Source from the content-addressed store, hash-verified

154// notifyHost tells the host (usually systemd) that the container reported READY.
155// Also sends MAINPID and BARRIER.
156func notifyHost(client *net.UnixConn, ready []byte, pid1 int) error {
157 _, err := client.Write(append(ready, '\n'))
158 if err != nil {
159 return err
160 }
161
162 // now we can inform systemd to use pid1 as the pid to monitor
163 newPid := "MAINPID=" + strconv.Itoa(pid1)
164 _, err = client.Write([]byte(newPid + "\n"))
165 if err != nil {
166 return err
167 }
168
169 // wait for systemd to acknowledge the communication
170 return sdNotifyBarrier(client)
171}
172
173// errUnexpectedRead is reported when actual data was read from the pipe used
174// to synchronize with systemd. Usually, that pipe is only closed.

Callers 2

TestNotifyHostFunction · 0.85
runMethod · 0.85

Calls 2

sdNotifyBarrierFunction · 0.85
WriteMethod · 0.80

Tested by 1

TestNotifyHostFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…