Re: system call library functions

Rob Braun <[email protected]>
Newsgroups gmane.os.opendarwin.general
Message-ID <[email protected]>
On Mon, Nov 29, 2004 at 01:06:05PM -0800, Dow Street wrote:
> All,
> 
> I am writing some benchmarking code for OS X 10.3.5.  When using 
> getpid() to measure the overhead of a system call, I find the overhead 
> to be much less than expected (1-3 clicks on the MPC 7447a TBR).  When 
> making the call using syscall(20), however, the measurement is as 
> expected (~33 clicks on the TBR).  Is getpid actually using a library 
> function which retrieves the PID from a user space data structure 
> (without entry into the kernel?)  Any idea what / where this function 
> is located and the data structure it's accessing?

getpid() caches the value, and updates it when needed (using fork(), etc).
All syscalls are wrappers in Libc.

Rob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.