Date: Fri, 3 Mar 2006 22:05:52 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Ruslan Ermilov <ru@freebsd.org> Cc: Giorgos Keramidas <keramida@ceid.upatras.gr>, cvs-src@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek <pjd@freebsd.org>, cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/libutil pidfile.3 Message-ID: <20060303214914.L4391@delplex.bde.org> In-Reply-To: <20060303081527.GA61607@ip.net.ua> References: <200601281413.k0SEDHA3035607@repoman.freebsd.org> <20060303024309.GC943@flame.pc> <20060303081527.GA61607@ip.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 3 Mar 2006, Ruslan Ermilov wrote: > On Fri, Mar 03, 2006 at 04:43:09AM +0200, Giorgos Keramidas wrote: >> On 2006-01-28 14:13, Pawel Jakub Dawidek <pjd@FreeBSD.org> wrote: >>> pjd 2006-01-28 14:13:15 UTC >>> >>> FreeBSD src repository >>> >>> Modified files: >>> lib/libutil pidfile.3 >>> Log: >>> ... >>> - Cast pid_t to int. >> ... >> Doesn't it make more sense to cast pid_t to intmax_t, or is it by >> definition always <= int? >> > POSIX only requires that "blksize_t, pid_t, and ssize_t shall be signed > integer types." I always cast pid_t to long for printing. This was correct before C99 broke the promise that long was the longest signed integer type. In practice, PID_MAX is 30000 in 4.4BSD, so casting to int was enough even on systems with 16-bit ints. FreeBSD changed PID_MAX to 99999 on 13 Nov 1998, but FreeBSD never supported any systems with 16-bit ints, so casting to int has always worked on FreeBSD. It is just unportable. pidfile.3 has other bad examples on the same line that the pid_t wasn't cast on. It capitalizes the first word in syslog messages and terminates error messages with a ".". Error messages are conventionally never punctuated like this. My /var/log/messages currently has 4641 lines and only 96 of the lines are terminated with a ".". These lines are for 32 copies of the same 3 kernel messages %%% Copyright (c) 1992-2004 The FreeBSD Project. The Regents of the University of California. All rights reserved. Preloaded elf kernel "kernel" at 0xc06a4c00. %%% Punctuating the copright message is OK since it is a multiline one with almost real sentences, but puncting the "Preloaded" messages is just a style bug. All other bot messages in my /var/log/messages are missing this bug. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060303214914.L4391>