How can I get the process name in C? The same name, which is in /proc/$pid/status. I do not want to parse that file. Is there any programmatic way of doing this
If you cannot access argv[] in main(), because you are implementing a library, you can have a look at my answer on a similar question here.
It basically boils down into giving you access to argc, argv[] and envp[] outside of main(). Then you could, as others have already correctly suggested, use argv[0] to retrieve the process name.