-
Masatake YAMATO authored
In preparation for the forthcoming -Y/--decode-pids=comm option. Load the content of /proc/$pid/comm to `comm', a newly introduced member of struct tcb. The loading is done when A. a tcb is initialized, B. execve or execveat is called, and C. prctl(PR_SET_NAME,...) is called. Limitation: this change is not enough for handling the case that someone writes a value to /proc/$pid/comm directly. (e.g. running echo "foo" > /proc/$pid/comm) * src/defs.h (struct tcb): New member `comm'. (enum pid_decoding_flags): Add PID_DECODING_COMM as a new flag. (PROC_COMM_LEN): New macro. (maybe_load_task_comm): New function declaration. * src/strace.c (strip_trailing_newlines): New function. (load_task_comm): New function loading the contents of /proc/$pid/comm into struct tcb.comm. (maybe_load_pid_comm): New function. (alloctcb): Call it for initializing the `comm' member. * src/syscall.c: Include <linux/prctl.h>. (syscall_exiting_decode): Call maybe_load_task_comm(). * src/sysent.h...
19277b86