Re: system call library functions

Shantonu Sen <[email protected]>
Newsgroups gmane.os.opendarwin.general
Message-ID <[email protected]>
On Nov 29, 2004, at 1:06 PM, 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?)
Yes

> Any idea what / where this function
<http://www.opensource.apple.com/darwinsource/10.3.5/Libc-320.1.3/ppc/ 
sys/getpid.s>

> is located and the data structure it's accessing?
>
[ssen@localhost]$ nm -ma -s __DATA __data /usr/lib/libSystem.B.dylib |  
grep __current_pid
a00020a8 (__DATA,__data) external __current_pid

Shantonu
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.