vendor: update go-runc to reduce gc pressure
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
		| @@ -1,5 +1,5 @@ | |||||||
| github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 | github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 | ||||||
| github.com/containerd/go-runc ed1cbe1fc31f5fb2359d3a54b6330d1a097858b7 | github.com/containerd/go-runc 4f6e87ae043f859a38255247b49c9abc262d002f | ||||||
| github.com/containerd/console 84eeaae905fa414d03e07bcd6c8d3f19e7cf180e | github.com/containerd/console 84eeaae905fa414d03e07bcd6c8d3f19e7cf180e | ||||||
| github.com/containerd/cgroups 29da22c6171a4316169f9205ab6c49f59b5b852f | github.com/containerd/cgroups 29da22c6171a4316169f9205ab6c49f59b5b852f | ||||||
| github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788 | github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788 | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								vendor/github.com/containerd/go-runc/runc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/containerd/go-runc/runc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,7 +1,6 @@ | |||||||
| package runc | package runc | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"bytes" |  | ||||||
| 	"context" | 	"context" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
| @@ -532,7 +531,9 @@ func (r *Runc) Restore(context context.Context, id, bundle string, opts *Restore | |||||||
|  |  | ||||||
| // Update updates the current container with the provided resource spec | // Update updates the current container with the provided resource spec | ||||||
| func (r *Runc) Update(context context.Context, id string, resources *specs.LinuxResources) error { | func (r *Runc) Update(context context.Context, id string, resources *specs.LinuxResources) error { | ||||||
| 	buf := bytes.NewBuffer(nil) | 	buf := getBuf() | ||||||
|  | 	defer putBuf(buf) | ||||||
|  |  | ||||||
| 	if err := json.NewEncoder(buf).Encode(resources); err != nil { | 	if err := json.NewEncoder(buf).Encode(resources); err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| @@ -638,11 +639,12 @@ func (r *Runc) runOrError(cmd *exec.Cmd) error { | |||||||
| } | } | ||||||
|  |  | ||||||
| func cmdOutput(cmd *exec.Cmd, combined bool) ([]byte, error) { | func cmdOutput(cmd *exec.Cmd, combined bool) ([]byte, error) { | ||||||
| 	var b bytes.Buffer | 	b := getBuf() | ||||||
|  | 	defer putBuf(b) | ||||||
|  |  | ||||||
| 	cmd.Stdout = &b | 	cmd.Stdout = b | ||||||
| 	if combined { | 	if combined { | ||||||
| 		cmd.Stderr = &b | 		cmd.Stderr = b | ||||||
| 	} | 	} | ||||||
| 	ec, err := Monitor.Start(cmd) | 	ec, err := Monitor.Start(cmd) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								vendor/github.com/containerd/go-runc/utils.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/github.com/containerd/go-runc/utils.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,8 +1,10 @@ | |||||||
| package runc | package runc | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
|  | 	"bytes" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"strconv" | 	"strconv" | ||||||
|  | 	"sync" | ||||||
| 	"syscall" | 	"syscall" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -26,3 +28,18 @@ func exitStatus(status syscall.WaitStatus) int { | |||||||
| 	} | 	} | ||||||
| 	return status.ExitStatus() | 	return status.ExitStatus() | ||||||
| } | } | ||||||
|  |  | ||||||
|  | var bytesBufferPool = sync.Pool{ | ||||||
|  | 	New: func() interface{} { | ||||||
|  | 		return bytes.NewBuffer(nil) | ||||||
|  | 	}, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func getBuf() *bytes.Buffer { | ||||||
|  | 	return bytesBufferPool.Get().(*bytes.Buffer) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func putBuf(b *bytes.Buffer) { | ||||||
|  | 	b.Reset() | ||||||
|  | 	bytesBufferPool.Put(b) | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stephen J Day
					Stephen J Day