Merge pull request #5375 from samuelkarp/freebsd-runtime
freebsd: runtime support
This commit is contained in:
		| @@ -133,11 +133,13 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ | |||||||
| func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) { | func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) { | ||||||
| 	log.G(ctx).Info("cleaning up dead shim") | 	log.G(ctx).Info("cleaning up dead shim") | ||||||
|  |  | ||||||
| 	// Windows cannot delete the current working directory while an | 	// On Windows and FreeBSD, the current working directory of the shim should | ||||||
| 	// executable is in use with it. For the cleanup case we invoke with the | 	// not be the bundle path during the delete operation.  Instead, we invoke | ||||||
| 	// default work dir and forward the bundle path on the cmdline. | 	// with the default work dir and forward the bundle path on the cmdline. | ||||||
|  | 	// Windows cannot delete the current working directory while an executable | ||||||
|  | 	// is in use with it. On FreeBSD, fork/exec can fail. | ||||||
| 	var bundlePath string | 	var bundlePath string | ||||||
| 	if gruntime.GOOS != "windows" { | 	if gruntime.GOOS != "windows" && gruntime.GOOS != "freebsd" { | ||||||
| 		bundlePath = b.bundle.Path | 		bundlePath = b.bundle.Path | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -160,6 +162,7 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) { | |||||||
| 	cmd.Stdout = out | 	cmd.Stdout = out | ||||||
| 	cmd.Stderr = errb | 	cmd.Stderr = errb | ||||||
| 	if err := cmd.Run(); err != nil { | 	if err := cmd.Run(); err != nil { | ||||||
|  | 		log.G(ctx).WithField("cmd", cmd).WithError(err).Error("failed to delete") | ||||||
| 		return nil, errors.Wrapf(err, "%s", errb.String()) | 		return nil, errors.Wrapf(err, "%s", errb.String()) | ||||||
| 	} | 	} | ||||||
| 	s := errb.String() | 	s := errb.String() | ||||||
|   | |||||||
							
								
								
									
										35
									
								
								services/tasks/local_freebsd.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								services/tasks/local_freebsd.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | |||||||
|  | // +build freebsd | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |    Copyright The containerd Authors. | ||||||
|  |  | ||||||
|  |    Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  |    you may not use this file except in compliance with the License. | ||||||
|  |    You may obtain a copy of the License at | ||||||
|  |  | ||||||
|  |        http://www.apache.org/licenses/LICENSE-2.0 | ||||||
|  |  | ||||||
|  |    Unless required by applicable law or agreed to in writing, software | ||||||
|  |    distributed under the License is distributed on an "AS IS" BASIS, | ||||||
|  |    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
|  |    See the License for the specific language governing permissions and | ||||||
|  |    limitations under the License. | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | package tasks | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"github.com/containerd/containerd/plugin" | ||||||
|  | 	"github.com/containerd/containerd/runtime" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | var tasksServiceRequires = []plugin.Type{ | ||||||
|  | 	plugin.RuntimePluginV2, | ||||||
|  | 	plugin.MetadataPlugin, | ||||||
|  | 	plugin.TaskMonitorPlugin, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // loadV1Runtimes on FreeBSD returns an empty map. There are no v1 runtimes | ||||||
|  | func loadV1Runtimes(ic *plugin.InitContext) (map[string]runtime.PlatformRuntime, error) { | ||||||
|  | 	return make(map[string]runtime.PlatformRuntime), nil | ||||||
|  | } | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| // +build !windows | // +build !windows,!freebsd | ||||||
|  |  | ||||||
| /* | /* | ||||||
|    Copyright The containerd Authors. |    Copyright The containerd Authors. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Akihiro Suda
					Akihiro Suda