C - Change process name simple examples
Based on this stackoverflow answer (by hexchain)
Using Docker
docker build -t pstest .
docker run --rm -it pstest
Local Binary
make
./pstest
Initial ps output:
91985 pts/11 00:00:00 pstest
pthread_setname_np
91985 pts/11 00:00:00 setname
prctl
91985 pts/11 00:00:00 prctl
argv[0]
Compile pstest
manually from source
# Minimum compile command:
gcc pstest.c -o pstest -pthread
# Recommended compile command:
gcc pstest.c -o pstest -O2 -Wall -Wextra -Werror -Wno-unused -Wno-unused-result -std=gnu99 -pthread -D_GNU_SOURCE