Subject: Re: Proposal: socketfrom()
To: Greg A. Woods <woods@planix.com>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-net
Date: 07/05/2007 08:14:34
On Jul 4, 2007, at 11:05 PM, Greg A. Woods wrote:

> At Thu, 5 Jul 2007 01:38:05 -0400, Thor Lancelot Simon wrote:
> Subject: Proposal: socketfrom()
>>
>> 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);
>
> That might be easier to implement inside the kernel, but wouldn't it  
> be
> better from a clean API design point of view to have something like a:
>
> 	set
> 	setsockopt_default(int level,
> 			   int optname,
> 			   const void *optval,
> 			   socklen_t optlen);
>
> Which would set the default option(s) for all new sockets created by  
> the
> process until the next call to it?

Not a great API, IMO, for many apps.  What if you have connections  
using several different AFs / protocols within an app -- surely most  
of the options won't be applicable across AFs...


>
>
> (options would be set back to the system defaults across exec, and
> perhaps also when called with all params zeros except "level")



>
>
> -- 
> 						Greg A. Woods
>
> H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <woods@robohack.ca 
> >
> Planix, Inc. <woods@planix.com>       Secrets of the Weird <woods@weird.com 
> >

-- thorpej