MCPcopy Index your code
hub / github.com/subtrace/subtrace / GetEffectiveCaps

Function GetEffectiveCaps

cmd/version/caps_linux.go:68–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66}
67
68func GetEffectiveCaps() string {
69 effectiveCaps := "unknown"
70 hdr := unix.CapUserHeader{Version: unix.LINUX_CAPABILITY_VERSION_3}
71 var data [2]unix.CapUserData
72 if err := unix.Capget(&hdr, &data[0]); err == nil {
73 mask := (uint64(data[1].Effective) << 32) | (uint64(data[0].Effective) << 0)
74 effectiveCaps = fmt.Sprintf("0x%016x", mask)
75 for shift, name := range capNames {
76 if mask&(1<<shift) != 0 {
77 effectiveCaps += fmt.Sprintf(" +%s", name)
78 } else {
79 effectiveCaps += fmt.Sprintf(" -%s", name)
80 }
81 }
82 }
83
84 return effectiveCaps
85}

Callers 1

FullFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected