On Sat, 2004-10-16 at 14:37 +0930, Glen Turner wrote:
> Robert Collins wrote:
> > On Fri, 2004-10-15 at 15:33 +1000, Michael Kraus wrote:
> >
> >>I'm developing a database application that  uses the inserting processes
> >>pid. Problem is that I'm wondering how big this pid should be?
> > 
> > 
> > sizeof(pid_t) IIRC. Its system specific.
> 
> Technically, PID is also signed since
>    pid_t f;
>    f = fork();
> can return -1 on error.
> 
> Personally I'd go with a signed 32bit integer, since that is what
> the GNU C library uses for pid_t. And its really the C library's
> definition, rather than the kernel's, which counts.
> 
> Any kernel in it's right mind is going to avoid negative PIDs as
> that isn't the user's expectation; I note the Amos' message saying
> that the Linux kernel currently allows PID values 1 to 4,194,303.

This kindof misses the point. pid_t is *hardware and software* platform
specific. The libc typedef on your platform is the only one that matters
- and its not the same everywhere.

Going with 32bit signed int may make sense if Michaels platform uses
that for pid_t, on all the machines doing inserts, consistently. But its
highly likely that whatever intended use the pid field in the database
has, its in appropriate. (Why is left as an exercise for the reader).

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to