Fix freebsd build
This brings freebsd in line with Darwin, ie it builds, but some parts may not yet be fully functional. There is now a WIP `runc` port for FreeBSD at https://github.com/clovertrail/runc/tree/1501-SupportOnFreeBSD so should be able to test further. Signed-off-by: Justin Cormack <justin@specialbusservice.com>
This commit is contained in:
parent
c7e31f1c5e
commit
8be05eb237
@ -1,4 +1,4 @@
|
|||||||
// +build !linux,!windows,!darwin
|
// +build freebsd
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The containerd Authors.
|
Copyright The containerd Authors.
|
||||||
@ -39,5 +39,8 @@ func setupSignals() (chan os.Signal, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newServer() (*ttrpc.Server, error) {
|
func newServer() (*ttrpc.Server, error) {
|
||||||
return ttrpc.NewServer(ttrpc.WithServerHandshaker(ttrpc.UnixSocketRequireSameUser()))
|
// for freebsd, we omit the socket credentials because these syscalls are
|
||||||
|
// slightly different. since we don't have freebsd support yet, this can be
|
||||||
|
// implemented later and the build can continue without issue.
|
||||||
|
return ttrpc.NewServer()
|
||||||
}
|
}
|
40
cmd/containerd-stress/rlimit_freebsd.go
Normal file
40
cmd/containerd-stress/rlimit_freebsd.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// +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 main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func setRlimit() error {
|
||||||
|
rlimit := int64(100000)
|
||||||
|
if rlimit > 0 {
|
||||||
|
var limit syscall.Rlimit
|
||||||
|
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if limit.Cur < rlimit {
|
||||||
|
limit.Cur = rlimit
|
||||||
|
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
// +build !windows
|
// +build !windows,!freebsd
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The containerd Authors.
|
Copyright The containerd Authors.
|
||||||
|
29
runtime/v2/shim/shim_freebsd.go
Normal file
29
runtime/v2/shim/shim_freebsd.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// +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 shim
|
||||||
|
|
||||||
|
import "github.com/containerd/ttrpc"
|
||||||
|
|
||||||
|
func newServer() (*ttrpc.Server, error) {
|
||||||
|
return ttrpc.NewServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func subreaper() error {
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user