func writeProfileConfig()

in cmd/seccomp-profiler/main.go [376:400]


func writeProfileConfig(w io.Writer, syscalls []string) error {
	type Config struct {
		Seccomp seccomp.Policy `yaml:"seccomp"`
	}

	config := Config{
		Seccomp: seccomp.Policy{
			DefaultAction: seccomp.ActionErrno,
			Syscalls: []seccomp.SyscallGroup{
				{
					Action: seccomp.ActionAllow,
					Names:  syscalls,
				},
			},
		},
	}

	data, err := yaml.Marshal(config)
	if err != nil {
		return err
	}

	fmt.Fprintln(w, string(data))
	return nil
}