(cpu, data, size)
| 140 | |
| 141 | # process event |
| 142 | def print_event(cpu, data, size): |
| 143 | event = ct.cast(data, ct.POINTER(Data)).contents |
| 144 | |
| 145 | # protection flags |
| 146 | r = "R" if event.prot & PROT_READ else "-" |
| 147 | w = "W" if event.prot & PROT_WRITE else "-" |
| 148 | x = "E" if event.prot & PROT_EXEC else "-" |
| 149 | prot = r + w + x |
| 150 | |
| 151 | # map flags |
| 152 | s = "S" if event.flags & MAP_SHARED else "-" |
| 153 | p = "P" if event.flags & MAP_PRIVATE else "-" |
| 154 | f = "F" if event.flags & MAP_FIXED else "-" |
| 155 | a = "A" if event.flags & MAP_ANON else "-" |
| 156 | flags = s + p + f + a |
| 157 | |
| 158 | if args.time: |
| 159 | print("%-8s " % strftime("%H:%M:%S"), end="") |
| 160 | print("%-6d %-14.14s %-4s %-5s %-8d %-8d %s" % (event.pid, |
| 161 | event.comm, prot, flags, event.off / 1024, event.len / 1024, |
| 162 | event.path)) |
| 163 | |
| 164 | # initialize BPF |
| 165 | b = BPF(text=bpf_text) |
nothing calls this directly
no outgoing calls
no test coverage detected