Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2003 11:07:21 -0600
From:      "Jacques A. Vidrine" <nectar@FreeBSD.org>
To:        Martin Blapp <mb@imp.ch>
Cc:        Martin Blapp <mbr@FreeBSD.org>, src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/contrib/isc-dhcp/client dhclient.c
Message-ID:  <20030324170721.GD1911@madman.celabo.org>
In-Reply-To: <20030324170856.O21003@cvs.imp.ch>
References:  <200303232329.h2NNTaI5089971@repoman.freebsd.org> <20030324160604.GB1911@madman.celabo.org> <20030324170856.O21003@cvs.imp.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 24, 2003 at 05:35:49PM +0100, Martin Blapp wrote:
> 
> Hi,
> 
> > Are you sure that all values of pid_t can be represented in a signed
> > int?
> 
> sys/alpha/include/ansi.h:#define        _BSD_PID_T_     int                     /* process [group] */
> sys/i386/include/ansi.h:#define _BSD_PID_T_     int                     /* process [group] */
> sys/sys/types.h:typedef _BSD_PID_T_     pid_t;          /* process id */

So we hope that never changes? :-)  On -CURRENT, apparently pid_t is
always int32_t.  But, %d is `int' and I'm not sure that `int' is
always 32 bits and will be forever.

> > +       pid_t oldpid;
> > !                       e = fscanf(pidfd, "%d", &oldpid);
> >
> > I'd probably opt to do the fscanf with an unsigned long, and then cast
> > the value to (pid_t).  *shrug*
> 
> or use a unsigned int for it ? Will we have to change this for later ?

Why int rather than long?  When doing I/O, use the widest standard
types available and then see if the result fits in your target.
(Don't ask me how to check the range in portable way :-)

Cheers,
-- 
Jacques A. Vidrine <nectar@celabo.org>          http://www.celabo.org/
NTT/Verio SME          .     FreeBSD UNIX     .       Heimdal Kerberos
jvidrine@verio.net     .  nectar@FreeBSD.org  .          nectar@kth.se

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030324170721.GD1911>