On a Linux system a C process is started on boot, which creates a fork of itself. It is not a kernal process or something. In most cases a ps -ef show both processes as expecxted, but sometimes it looks like the following:
1258 root 0:00 myproc
1259 root 0:00 [myproc]
i.e. one of the processes surrounded by brackets. According to ps:
If the arguments cannot be located (usually because it has not been set,
as is the case of system processes and/or kernel threads) the command name
is printed within square brackets.
I do not understand what it means when the 'arguments cannot be located'. The process is started always exactly the same, and the fork is always created in the exact same way. How can it happen, that sometimes 'the arguments cannot be located' and sometimes they can?
In addition, the process is always started without any arguments...
Questions I have:
- What do those brackets really mean? Does the process run at all when
/proc/{pid}/cmdlineis empty? - Why do I get those brackets sometimes and not always?
- How/Where to fix this problem?
Additional information:
- The process is always started without any arguments! Just the name of the command
myproc. - The main process seems to run always correct (no brackets around name, executable in
/proc/x/cmdline). - The child process sometimes has its name in brackets.
- The content of
/proc/child-pid/cmdlineof a correct running child process ismyproc. - The content of
/proc/child-pid/cmdlineof an incorrect running child process is empty! - Again: same code, different child processes!