openssh-agent polling

David Leonard David.Leonard at quest.com
Thu Sep 13 16:00:22 EST 2007


Damien Miller wrote:
> On Wed, 12 Sep 2007, Alan Jenkins wrote:
>
>   
>> This may be a stupid question - but why does ssh-agent fork off a 
>> child and then exec the subcommand in the *parent* process?  It forces 
>> the agent in the child process to poll the parent, so it can exit when 
>> the parent finishes.  If the agent was the parent process, it could 
>> use wait() instead.  I'm sure there's some reason.
>>
>> It'd be nice to take ssh-agent off the list of polling processes you 
>> get with powertop[1], however far down it is.
>>     
>
> I don't understand what you mean by polling - once started, ssh-agent
> spends all its time sitting in select() waiting for requests.
>   

There is a 10 second parent polling behaviour which is probably what
powertop is seeing.. select is using a timeout being the minimum of the
poll time (10sec) or the next time a key expires. ssh-agent starts its 
command in the parent process probably so that you can get something
useful from $! returned in your startup script, and to avoid the
situation where ssh-agent could get an untrappable signal and leaves the
underlying command running. The man page is slightly misleading when it
says:  "If a commandline is given, this is executed as a subprocess of
the agent."

I can't see a clean, portable way of getting rid of the poll. On linux,
maybe you use inotify or /proc or something??

d


-- 
David Leonard
Resource Central software engineer
Quest Software; 303 Adelaide St, Brisbane, Australia; www.quest.com
Phone: (US) +1 801 655 2755  (AU) +61 7 3023 5133 





More information about the openssh-unix-dev mailing list