containerd / go-runc

runc bindings for Go
Apache License 2.0
162 stars 73 forks source link

allow for optional started channel to receive runc pid #69

Closed coryb closed 3 years ago

coryb commented 3 years ago

We need to be able to send signals to the runc process (not the processes running under runc), and the Monitor currently does not allow for us to learn the pid in order to signal. This PR adds an optional Started chan<- int to the CreateOpts and ExecOpts to allow for us to receive the pid just after the runc process has started.

The use-case for sending signals directly to the runc process is that we need to send a SIGWINCH for resize events when using externally managed pty pair (not using ConsoleSocket). The current hacky work-around is to use PidFile, which will populate the pid of the runc init or exec process which we can then use to parse /proc/$pid/status to find the parent-pid (ie the runc process).

More context: https://github.com/moby/buildkit/pull/1731#discussion_r506074643 cc @tonistiigi

codecov-io commented 3 years ago

Codecov Report

Merging #69 into master will increase coverage by 1.37%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #69      +/-   ##
==========================================
+ Coverage   19.17%   20.54%   +1.37%     
==========================================
  Files           7        7              
  Lines         579      589      +10     
==========================================
+ Hits          111      121      +10     
  Misses        432      432              
  Partials       36       36              
Impacted Files Coverage Δ
runc.go 20.58% <66.66%> (+2.40%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8c4be61...159c1d6. Read the comment docs.

tonistiigi commented 3 years ago

cc @estesp @AkihiroSuda