The name will be removed when the process completely dies. Perhaps the process is a zombie or is in the debugger ? Also, if you have inadvertendly started multiple copies of the program, QNXs unioning, will make it appear as if the name did not go away.
In my case, the process dies and no zombie appears (at least when I use pidin command). I am not runing it through the debugger either.
I use the name_attach to avoid multiple occurrences of one process.
So, for my processes, the souorce code follows these steps:
1.- Use name_attach to create a new entry in the namespace. If name_attach returns NULL that means the process is already running and the execution of the new occurence is stopped.
2.- When the process dies name_detach is called to remove the name from the namespace.
I have realise that the name_detach function is not secure within signal handlers functions. What does this thing really mean?
On the other hand, I have coded other processes by registering to the namespace with name_attach, and without calling name_detach, the OS has removed their names when they die.
Could it be possible that the process name remains registered although the process is dead?
What I would really like to know is how to remove these “ghost” names once the process is killed.
Is there any situation where the process dies and its name remains in the namespace?
Maybe I am wrong, but if you try to call “name_attach” with a name that already exists, the call returns NULL and the errno is set to 17 (File exists!).
Concerning the signal safety, thanks for the doc reference. I had already read it but I didn’t remember it. So, from my knowledge, I can use name_dettach inside a signal handler if this is the last function executed by the process (I use a signal handler to catch the signal and finish the process properly).
I just tried name_attach() on an already existing name and indeed it fails with errno 17 (File exist),
looks like the documentation doesnt mention this behaviour.
Regarding this problem I have tried several ways to solve this problem, and I am wondering if the name could remain in the namespace (/dev/name/local) if there is an open channel althoug the process dies?
Does anyone know anything about this possible wierd behaviour?