MCPcopy Create free account
hub / github.com/prometheus/procfs / parsePermissions

Function parsePermissions

proc_maps.go:113–135  ·  view source on GitHub ↗

parsePermissions parses a token and returns any that are set.

(s string)

Source from the content-addressed store, hash-verified

111
112// parsePermissions parses a token and returns any that are set.
113func parsePermissions(s string) (*ProcMapPermissions, error) {
114 if len(s) < 4 {
115 return nil, fmt.Errorf("%w: invalid permissions token", ErrFileParse)
116 }
117
118 perms := ProcMapPermissions{}
119 for _, ch := range s {
120 switch ch {
121 case 'r':
122 perms.Read = true
123 case 'w':
124 perms.Write = true
125 case 'x':
126 perms.Execute = true
127 case 'p':
128 perms.Private = true
129 case 's':
130 perms.Shared = true
131 }
132 }
133
134 return &perms, nil
135}
136
137// parseProcMap will attempt to parse a single line within a proc/[pid]/maps
138// buffer.

Callers 1

parseProcMapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…