Subject: RE: code to store the path of the executable in struct proc...
To: Christos Zoulas <christos@zoulas.com>
From: De Zeurkous <zeurkous@nichten.info>
List: tech-kern
Date: 09/20/2007 22:36:27
Haai,

On Thu, September 20, 2007 21:29, Christos Zoulas wrote:
> On Sep 20,  2:10pm, matt@3am-software.com (Matt Thomas) wrote:
> -- Subject: Re: code to store the path of the executable in struct proc...
>
>[snip]
>
> What I don't like in the code:
>[snip]
> 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
access functions*

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

>[snip]

Baai,

De Zeurkous
-----------

Friggin' Machines!

>
> christos
>