name of a process remains in system although process dies

Dear all.

I’m programming under QNX 6.2.1 and I have a problem concerning the resitered names in the system.

I perform a name_attach of one process (i.e. foo) and a new entry appears in /dev/name/local directory.

However, during the execution of the program, I reach the following situation:

  • The process dies.
  • The name remains in the directory

So, how can I remove this name from the namespace in order to clean it?

This is a wierd situation, and I don’t know why it happens, and how to fix it.

Thanks for the help in advance
Regards,
José

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.

First of all, thanks for the quick response.

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?

Thanks in advance.
Best Regards,
José

name_attach() doesnt do that, you should read the documentation for name_attach() here: qnx.com/developers/docs/mome … ttach.html

The system disposes all process resources for reuse on process termination (including names registered with name_attach() )

Check the qnx.com/developers/docs/mome … mmary.html there is a section called “Function safety”

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?

Thanks in advance.
José