Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 2004 11:53:40 -0600
From:      "Jacques A. Vidrine" <nectar@FreeBSD.org>
To:        Toni Andjelkovic <toni@soth.at>
Cc:        Artis Caune <ac-lists@latnet.lv>
Subject:   Re: kernel modules programming: struct proc question
Message-ID:  <20040317175340.GA88110@madman.celabo.org>
In-Reply-To: <20040317154530.GD6576@tv.soth.at>
References:  <20040316163956.GD638@lame.novel.ru> <20040316181307.GA6576@tv.soth.at> <20040317142451.GC2506@lame.novel.ru> <opr40hacqdcpfy5d@mail.latnet.lv> <20040317154530.GD6576@tv.soth.at>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 17, 2004 at 04:45:30PM +0100, Toni Andjelkovic wrote:
> On Wed, Mar 17 2004 (17:00:02 +0200), Artis Caune wrote:
> > "pid_t" is signed int type, or am I missing something?
> 
> You are right, pid_t is __int32_t, which is signed, so "%d"
> is the correct format.

That's only correct for machines with 32-bit ints.  In any case, POSIX
only specifies that pid_t is a signed integer type... it could be any
size supported by the implementation.  For portability, you probably
want to cast to the `biggest' type and use the appropriate printf
specifier, e.g.

   printf("%ld", (long)pid_t);
or
   printf("%jd", (intmax_t)pid_t); // C99

Cheers,
-- 
Jacques Vidrine / nectar@celabo.org / jvidrine@verio.net / nectar@freebsd.org



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