在 AIX 7 上,我有一个进程,其名称出现在 ps 输出中的方括号之间:
PID TTY TIME CMD
7798784 pts/2 0:00 [myproc]
9044154 pts/2 0:00 ps
10485770 pts/2 0:00 bash
我发现覆盖argv[0][0]
会导致这样的结果。还有其他原因可能导致这个结果吗?
答案1
根据man ps
:
Under the -f flag, ps tries to determine the current command name and arguments both of which may be changed asynchronously by
the process. These are then displayed. Failing this, the command name as it would appear without the option -f, is written in square brackets.
这确实意味着系统无法识别命令和参数(可能是因为它在执行过程中发生变化),然后显示输出,就像没有该选项时显示的那样-f
。