Subject: Re: Proposal: socketfrom()
To: None <tech-net@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 07/05/2007 02:38:54
> int socketfrom(int template, int domain, int type, int protocol);

> Which would return a new socket using the socket options already set
> on socket "template".  If domain, type, and protocol don't match,
> this is an error (or perhaps it would be best to omit them entirely
> and just have one argument, the template socket.

> Opinions?

Sort of like dup() but at the socket layer instead of the
open-file-table layer.  I like it, though I'd do as you suggest and
skip everything but the template socket.

I don't like Greg Woods's idea of having process-default socket
options, because I much prefer to have some way to name this collection
of options, rather than having just one set of default options for a
whole process.  Using a socket on which they have been set isn't the
best (it uses up a file descriptor relatively unnecessarily), but it's
not unreasonable, and I think it's cleaner than inventing a new kind of
API object for the purpose.  I also don't like imposing the same set of
options on sockets of all types.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B