This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Duplicating Unix Domain Sockets


Allright.  So I have two solutions.
(And tell me if I should direct this to the folks at cygwin-devel)

#1
Make cygwin be able to implement the Ancillary data as in 4.3+BSD as
described in section 15.3.3 in Advanced Programming in the Unix
Environment.

To implement this, I would tag all messages sent on Unix domain sockets
with a tag like this:
struct tag {
	int adatalen; // Length of ancillary data
	int rdatalen; // Length of real data
}

Then when you receive it your first read the tag and if there is ancillary
data read it and do what you need to do (convert the info into an fd) and
then read the rdatalen.  If there is more rdatalen than the length of
buffer sent to you, you return what you can, and remember how much is
left.

This is obviously a big task, and opinions would be quite welcome.

#2
Just add a function that says, create_fd_from_handle_plus were I can
pass in all the parameters that the sending process could send, and so
that the same file descriptor gets created.  The problem with this is that
getting the info from one process to another (IPC?) is up to the
programmer.

As you can tell I really want to pass file descriptors between cygwin
processes.  I think from a networking standpoint it's useful.  Now for all
I know somebody else has done this already (possibly doing something
easier), please let me know.

Thanks,
David


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]