From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Fri, 18 Feb 2011 14:45:41 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.38-rc4-19+; KDE/4.5.5; x86_64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201102181445.41877.dexen.devries@gmail.com> Subject: Re: [9fans] Modern development language for Plan 9, WAS: Re: RESOLVED: recoving important header file rudely Topicbox-Message-UUID: b0417b72-ead6-11e9-9d60-3106f5b1d025 On Friday, February 18, 2011 02:29:54 pm erik quanstrom wrote: > so this is a complete waste of time if forks > getpids. > and THREAD_GETMEM must allocate memory. so > the first call isn't exactly cheep. aren't they optimizing > for bad programming? >=20 > not only that, ... from getpid(2) >=20 > NOTES > Since glibc version 2.3.4, the glibc wrapper function for=20 > getpid() caches PIDs, so as to avoid additional system calls when a > process calls getpid() repeatedly. Normally this caching is invisible, > but its correct operation relies on support in the wrapper > functions for fork(2), vfork(2), and clone(2): if an application bypasses= =20 > the glibc wrappers for these system calls by using syscall(2), then a > call to getpid() in the child will return the wrong value (to be=20 > precise: it will return the PID of the parent process). See also > clone(2) for dis- which boggles my mind: why would getpid() need to be optimized for in the f= irst=20 place? Konqueror 4.5.5 (browser) calls it once per short session (few tabs) =46irefox 4 (browser) calls it about once per tab openssh calls it once or twice per session bash calls it once lsof, find do not call it at all. what does call getpid() often? @_@ anyway, it looks a bit like library lock-in to me: ``your app better perfor= m=20 _every_ syscall through glibc, or else'' -- or else strange things may happ= en,=20 eh? =2D-=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] > how does a C compiler get to be that big? what is all that code doing? iterators, string objects, and a full set of C macros that ensure boundary conditions and improve interfaces. ron minnich, in response to Charles Forsyth http://9fans.net/archive/2011/02/90