drgn/examples/linux/ps.py
Omar Sandoval 8b264f8823 Update copyright headers to Facebook and add missing headers
drgn was originally my side project, but for awhile now it's also been
my work project. Update the copyright headers to reflect this, and add a
copyright header to various files that were missing it.
2020-05-15 15:13:02 -07:00

14 lines
351 B
Python
Executable File

# Copyright (c) Facebook, Inc. and its affiliates.
# SPDX-License-Identifier: GPL-3.0+
"""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}")