ProxMon/py/stat_flags.py
2025-01-14 00:34:50 -05:00

39 lines
2.4 KiB
Python

reverse_lookup = {
0x00000001: "PF_VCPU", # I'm a virtual CPU
0x00000002: "PF_IDLE", # I am an IDLE thread
0x00000004: "PF_EXITING", # Getting shut down
0x00000008: "PF_POSTCOREDUMP", # Coredumps should ignore this task
0x00000010: "PF_IO_WORKER", # Task is an IO worker
0x00000020: "PF_WQ_WORKER", # I'm a workqueue worker
0x00000040: "PF_FORKNOEXEC", # Forked but didn't exec
0x00000080: "PF_MCE_PROCESS", # Process policy on mce errors
0x00000100: "PF_SUPERPRIV", # Used super-user privileges
0x00000200: "PF_DUMPCORE", # Dumped core
0x00000400: "PF_SIGNALED", # Killed by a signal
0x00000800: "PF_MEMALLOC", # Allocating memory
0x00001000: "PF_NPROC_EXCEEDED", # set_user() noticed that RLIMIT_NPROC was exceeded
0x00002000: "PF_USED_MATH", # If unset the fpu must be initialized before use
0x00004000: "PF_USER_WORKER", # Kernel thread cloned from userspace thread
0x00008000: "PF_NOFREEZE", # This thread should not be frozen
0x00010000: "PF__HOLE__00010000",
0x00020000: "PF_KSWAPD", # I am kswapd
0x00040000: "PF_MEMALLOC_NOFS", # All allocation requests will inherit GFP_NOFS
0x00080000: "PF_MEMALLOC_NOIO", # All allocation requests will inherit GFP_NOIO
0x00100000: "PF_LOCAL_THROTTLE", # Throttle writes only against the bdi I write to, I am cleaning dirty pages from some other bdi.
0x00200000: "PF_KTHREAD", # I am a kernel thread
0x00400000: "PF_RANDOMIZE", # Randomize virtual address space
0x00800000: "PF__HOLE__00800000",
0x01000000: "PF__HOLE__01000000",
0x02000000: "PF__HOLE__02000000",
0x04000000: "PF_NO_SETAFFINITY", # Userland is not allowed to meddle with cpus_mask
0x08000000: "PF_MCE_EARLY", # Early kill for mce process policy
0x10000000: "PF_MEMALLOC_PIN", # Allocation context constrained to zones which allow long term pinning.
0x20000000: "PF__HOLE__20000000",
0x40000000: "PF__HOLE__40000000",
0x80000000: "PF_SUSPEND_TASK", # This thread called freeze_processes() and should not be frozen
}
def listFlags(flag):
for i in reverse_lookup.keys():
if flag & i:
print(reverse_lookup[i])