Passing/saving file descriptors between processes

K

Kevin

Hello,

I have a main processes that opens a number of file handles, keeps
track of the opened handles, then forks and execs different programs
that utilize them (usually i dup to stdin). Often I launch more than
one instance of a given program, and that instance will use the same
handle as its co process.

However if the main process keeping track of all these handles has to
restart, I lose all the open file handles. File descriptor numbers
are meaningless on a restart, so I don't think say data dumper is
going to do me any good.

In C, it's possible to pass this information to another process with
I_SENDFD and I_RECVFD ioctls on a STREAMS pipe. So that other process
could hold onto the data, and hand it back to the main process on
restart.

However that's a hassle, and would involve some XS/Inline code.

Is there some way to save/write out the true handle reference, so that
it could be reloaded on startup?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top