Yes, you can use PR_SET_NAMEin the first argument, and the name as the second argument to set the name of the calling thread (or process). prctlreturns 0on success. Remember, it depends on where you call it prctl. If you call it inside your process, it will change the name of this process and all threads belonging to it. If you call it inside a specific thread, it will only change the name of that thread.
Example:
int s;
s = prctl(PR_SET_NAME,"myProcess\0",NULL,NULL,NULL);
Now, if you are running your process on Linux, enter:
top
or
ps
To see the name attached to your process id.
source
share