drgn/examples/linux/ps.py
2019-03-29 01:59:53 -07:00

11 lines
263 B
Python
Executable File

"""A simplified implementation of ps(1) using drgn"""
from drgn.helpers.linux.pid import for_each_task
print('PID COMM')
for task in for_each_task(prog):
pid = task.pid.value_()
comm = task.comm.string_().decode()
print(f'{pid:<10} {comm}')