From owner-cvs-src@FreeBSD.ORG Fri Mar 3 12:40:28 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 7F2DF16A422; Fri, 3 Mar 2006 12:40:28 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7799243D46; Fri, 3 Mar 2006 12:40:26 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from flame.pc (aris.bedc.ondsl.gr [62.103.39.226]) (authenticated bits=128) by igloo.linux.gr (8.13.5/8.13.5/Debian-3) with ESMTP id k23Ce8lL006858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 3 Mar 2006 14:40:12 +0200 Received: from flame.pc (flame [127.0.0.1]) by flame.pc (8.13.4/8.13.4) with ESMTP id k23CdSjB007596; Fri, 3 Mar 2006 14:39:28 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by flame.pc (8.13.4/8.13.4/Submit) id k23CdQVU007595; Fri, 3 Mar 2006 14:39:26 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Fri, 3 Mar 2006 14:39:26 +0200 From: Giorgos Keramidas To: Ruslan Ermilov , Bruce Evans Message-ID: <20060303123925.GA7471@flame.pc> References: <200601281413.k0SEDHA3035607@repoman.freebsd.org> <20060303024309.GC943@flame.pc> <20060303081527.GA61607@ip.net.ua> <20060303214914.L4391@delplex.bde.org> <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 Content-Disposition: inline In-Reply-To: <20060303214914.L4391@delplex.bde.org> <20060303081527.GA61607@ip.net.ua> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.371, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.83, BAYES_00 -2.60, DNS_FROM_RFC_ABUSE 0.20) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr Cc: 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 12:40:28 -0000 On 2006-03-03 10:15, 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: >>> Modified files: >>> lib/libutil pidfile.3 >>> Log: >>> [...] >>> - Cast pid_t to int. >> >> Hi Pawel, >> >> 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." Right. I got so far, but asked to make sure I didn't miss anything important elsewhere. Thanks Ruslan :) On 2006-03-03 22:05, Bruce Evans wrote: > 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. Which sucks a bit, but is not something we can change now :( > 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. Which is exactly why I was a bit worried seeing this documented in the manpages. I'm ok with using unportable constructs in places where there is no portable equivalent, but documenting stuff that users will start copying as authoritative ``because I saw it in this and that FreeBSD manpage'' is probably not ok. Any objections for changing `int' to `intmax_t' or, at least, `long' in the manpage examples?