add libseccomp version to `runc --version`

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2020-08-04 15:07:22 +09:00
parent 1d85333ad8
commit 6249136a29
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A
3 changed files with 15 additions and 1 deletions

View File

@ -266,3 +266,8 @@ func parseStatusFile(path string) (map[string]string, error) {
return status, nil
}
// Version returns major, minor, and micro.
func Version() (uint, uint, uint) {
return libseccomp.GetLibraryVersion()
}

View File

@ -22,3 +22,8 @@ func InitSeccomp(config *configs.Seccomp) error {
func IsEnabled() bool {
return false
}
// Version returns major, minor, and micro.
func Version() (uint, uint, uint) {
return 0, 0, 0
}

View File

@ -8,7 +8,7 @@ import (
"strings"
"github.com/opencontainers/runc/libcontainer/logs"
"github.com/opencontainers/runc/libcontainer/seccomp"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
@ -64,6 +64,10 @@ func main() {
}
v = append(v, fmt.Sprintf("spec: %s", specs.Version))
v = append(v, fmt.Sprintf("go: %s", runtime.Version()))
if seccomp.IsEnabled() {
major, minor, micro := seccomp.Version()
v = append(v, fmt.Sprintf("libseccomp: %d.%d.%d", major, minor, micro))
}
app.Version = strings.Join(v, "\n")
xdgRuntimeDir := ""