Subject: Proposal: socketfrom()
To: None <tech-net@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-net
Date: 07/05/2007 01:38:05
I have an application that makes outbound TCP connections at a very high
rate, so high that the overhead of additional system calls to set socket
options considerably impacts performance.

I could partially address this by adding a system call that sets multiple
socket options at once (which, I think, would be a better API than
setsockopt() anyway) but that gets rid of _all but one_ system call to
set up the socket before connect(); I want to get rid of them all.

I'd like to make it possible to set options on one "template" or "master"
socket and then have them inherited by children, as listen()/accept() make
possible for the other direction.  I'm thinking of something along the lines
of this:

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?

-- 
  Thor Lancelot Simon	                                     tls@rek.tjls.com

  "The inconsistency is startling, though admittedly, if consistency is to
   be abandoned or transcended, there is no problem."	      - Noam Chomsky