Cleanup of fd/coid

Hi:

I have some queries regarding the cleanup of file descriptors (or
connection ids) by a resource manager handling those connections.

  1. If a process terminates, without close()ing all open fds, is an
    _IO_CLOSE message still generated and sent to the resouorce manager?

  2. How does a resource manager (say a filesystem resource manager) get
    notified about a process crashing, while still having open fds (which
    might have locks).

  3. What is the status of such coids, on a crash?

Help would be greatly appreciated.

-Rommel

Rommel Dongre <rdongre@pillardata.com> wrote:

Hi:

I have some queries regarding the cleanup of file descriptors (or
connection ids) by a resource manager handling those connections.

  1. If a process terminates, without close()ing all open fds, is an
    _IO_CLOSE message still generated and sent to the resouorce manager?

  2. How does a resource manager (say a filesystem resource manager) get
    notified about a process crashing, while still having open fds (which
    might have locks).

  3. What is the status of such coids, on a crash?

Everything will be closed up when the process exits - the kernel will
detach them if the process does not. There is another case - what happens
when a process dies that is blocking on your resmgr? The resmgr channel
is created with the flag _NTO_CHF_UNBLOCK. This means when a client would
normally unblock it isn’t and you get an unblock pluse (iofunc_unblock)
which allows you to clean-up and unblock the client normally.
Then it unblocks and continues on doing whatever caused it to unblock.

Take a look at the flags in the help for ChannelCreate(). And the call
to ChannelCreate() in lib/c/dispatch/dispatch.c. (it is on cvs.qnx.com).

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/