mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
This is just a refactoring, but the intention of this `struct` is to add other useful options for the program build, such as the list of expected "hottest" syscalls by frequency. The interface is a bit awkward, because of the need for two entry points (one which didn't have any way to set the default actions), and because the zero value of `linux.BPFAction` is a valid (and common) "default action": killing the program (`linux.SECCOMP_RET_KILL_THREAD`). We also can't use `*linux.BPFAction`, as `linux.SECCOMP_RET_*` are constants. So the struct fields use functions that "resolve" to an action. This reads fairly well in the call sites (`DefaultAction: Return(action)`), at the cost of slightly convoluted logic in `seccomp.go`. PiperOrigin-RevId: 581477348