Subject: RE: code to store the path of the executable in struct proc...
To: Christos Zoulas <email@example.com>
From: De Zeurkous <firstname.lastname@example.org>
Date: 09/20/2007 22:36:27
On Thu, September 20, 2007 21:29, Christos Zoulas wrote:
> On Sep 20, 2:10pm, email@example.com (Matt Thomas) wrote:
> -- Subject: Re: code to store the path of the executable in struct proc...
> What I don't like in the code:
> 1. It is cpu inefficient; programs that fork and don't exec get penalized
> because they have to copy the string. I considered ref-counting the
> path, but that adds complexity.
Then again, the complexity concerned is pretty limited and the resulting
code reusable. *murmurs something about a struct per data type and some
> 2. It is storage inefficient; most path names are < 32 chars long and
> we store a whole MAXPATHLEN worth of string.
Easily fixed by the standard practice of using an appropriately sized
buffer, an integer to hold the size, and a check for ( len < MAXPATHLEN ).