4 ms·
Is this an actual separate case? How are top level shells invoked? Isn't this just a specific call to execve?
by leni536 9y ago
Is this an actual separate case? How are top level shells invoked? Isn't this just a specific call to execve?
- emmelaich 9y agoYeah, not a separate case but good to mention.
- gumby 9y agoI am not sure I understand your question. Of course /bin/login calls some version of exec. However /bin/login formats arg[0] differently. You can see this in ps. I suppose most people don't talk to /bin/login any more unless they ssh someplace.
- felipelemos 9y agoAfter Systemd/Linux we don't have /bin/login anymore.
- dfox 9y agoIt is good example that argv[0] is just another normal argument that is passed by the caller of execve() and does not necessarily have to be related to the actual filename of program executed in any way.
- TeMPOraL 9y agoNot sure if it still works that way, but years ago I used to overwrite the argv[0] param with my own data to change how the process appears on lists such as one shown by the 'w' utility.
- GauntletWizard 9y agoYep. There's a tool in djb's daemontools that uses this behavior - https://cr.yp.to/daemontools/readproctitle.html https://cr.yp.to/daemontools/readproctitle.html . It's kinda a pathological case, but it's a kinda cool way to assure that you can get some data from your processes, even on a totally horked system, as well as being fairly convenient from an old-school administration perspective (giving the ability to see what errors a program has encountered with just ps or top; Already likely to be the first commands run when something's wrong.)