Subject: Re: CVS commit: src/sys
To: Bill Stouder-Studenmund <wrstuden@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-userlevel
Date: 06/24/2007 15:47:33
On Sun, Jun 24, 2007 at 11:30:10AM -0700, Bill Stouder-Studenmund wrote:
> 
> Performance:
> 
> Earlier in the thread, it was mentioned that we get better performance if
> we skip an unneeded malloc()/free() in the system callroutines. I agree.  
> However we introduce a number of isses. So.... How often do we call these
> routines? I thought a process calls setgroups() only once, and getgroups()  
> a hand full of times over its lifetime. I don't think that a malloc()/
> free() would really hurt us. And if it does, we can revisit. :-)

It seems to me (and in fact I maintain a libc that does this) that there
are a number of system calls whose result can be known to libc without
bothering to talk to the kernel.  The obvious ones are getpid(), getppid(),
and so forth but getgroups() ought to fall into this category too after
the first call, and barring any use of certain intermediate syscalls.

This would cause problems for applications that mixed hand-coded syscalls
and libc, but I'm not so sure I care, unless there's a security issue --
and I do not see one, though I'd be glad to be educated if there is.

Thor