From owner-cvs-src@FreeBSD.ORG Fri Mar 3 11:05:59 2006 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3616D16A420; Fri, 3 Mar 2006 11:05:59 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8726843D45; Fri, 3 Mar 2006 11:05:58 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87]) by mailout2.pacific.net.au (Postfix) with ESMTP id 309216FCF2; Fri, 3 Mar 2006 22:05:57 +1100 (EST) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy2.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id k23B5r4p009466; Fri, 3 Mar 2006 22:05:54 +1100 Date: Fri, 3 Mar 2006 22:05:52 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Ruslan Ermilov In-Reply-To: <20060303081527.GA61607@ip.net.ua> Message-ID: <20060303214914.L4391@delplex.bde.org> References: <200601281413.k0SEDHA3035607@repoman.freebsd.org> <20060303024309.GC943@flame.pc> <20060303081527.GA61607@ip.net.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Giorgos Keramidas , cvs-src@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/libutil pidfile.3 X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2006 11:05:59 -0000 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 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