[omniORB] Need to know about omniORBs file descriptor allocation
Sai-Lai Lo
S.Lo@orl.co.uk
24 Apr 1998 12:47:06 +0100
Jan Lessner <jan@c-lab.de> writes:
> For savely spawning processes from an omniORB server on Solaris, I need
> information over omniORB's file descriptor allocation (the fds must
> explicitely be closed before exec). In omniORB 2.2 I added an
> appropriate callback function for that ,informing me about allocation
> and deallocation of fds in strand_server::run and
> tcpsock_rendezvouser::run. But since many things concerning connection
> management have changed in omniORB 2.5, I'm afraid I need a hint where
> to put callbacks like that now. I don't find the old functions any more
> and I'm lost in the source code. It will take me ages to find out by
> myself, so I'd appriciate a little help from anyone who is familiar with
> this issue.
>
Jan,
Instead of adding callback functions, I suggest you export a fd_set, in
omniORB namespace perhaps, to let your application determine what file
descriptors are in use at the moment.
Something like this:
class omniORB {
public:
static fd_set fds; // choose a better name
};
In tcpSocketMTfactory.cc:
fd_set omniORB::fds; // Initialise this with FD_ZERO(&omniORB::fds);
// in ORB_init().
static omni_mutex fds_lock;
And redefine CLOSESOCKET:
#define CLOSESOCKET(sock) do { omni_mutex_lock sync(fds_lock); \
FD_CLR(sock,&omniORB::fds); \
} while(0)
And define a new macro:
#define REGISTERSOCKET(sock) do { omni_mutex_lock sync(fds_lock); \
FD_SET(sock,&omniORB::fds); \
} while(0)
And add a call to REGISTERSOCKET(sock) after the calls to socket() returns
with a valid socket, there is only 3 calls to socket() in
tcpSocketMTfactory.cc.
After your apps fork, just test for FD_ISSET() in omniORB::fds.
That is all you need to do I think.
Sai-Lai
--
Dr. Sai-Lai Lo | Research Scientist
|
E-mail: S.Lo@orl.co.uk | Olivetti & Oracle Research Lab
| 24a Trumpington Street
Tel: +44 223 343000 | Cambridge CB2 1QA
Fax: +44 223 313542 | ENGLAND