Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Apr 2002 00:40:03 -0700 (PDT)
From:      "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/36950: Add -n to renice(8)
Message-ID:  <200204100740.g3A7e3590514@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/36950; it has been noted by GNATS.

From: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To: Peter Avalos <pavalos@theshell.com>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: standards/36950: Add -n to renice(8)
Date: Wed, 10 Apr 2002 17:10:37 +1000

 On Wed, Apr 10, 2002 at 04:16:02AM -0000, Peter Avalos wrote:
 
 > >Number:         36950
 > >Category:       standards
 > >Synopsis:       Add -n to renice(8)
 
 > Index: renice.8
 > ===================================================================
 
 > +.Sh STANDARDS
 > +The
 > +.Nm
 > +utility conforms to
 > +.St -p1003.1-2001
 > +Note: Specifying
 > +.Ar nice_value
 > +is deprecated, but it is accepted due to its historical significance.
 
 The comment about historical behaviour probably belongs in a COMPATIBILITY
 section.
 
 > Index: renice.c
 > ===================================================================
 
 > -static const char copyright[] =
 > +static char copyright[] =
 
 I believe this should stay const. You could consider using the __COPYRIGHT
 macro, but \n's in its argument don't work properly.
 
 > +	prio = strtol(*argv, &endptr, 10);
 > +	if (*endptr ||
 
 Should check whether endptr == *argv. renice '' should not be allowed.
 
 > +	    ((prio == LONG_MAX || prio == LONG_MIN) && errno == ERANGE))
 > +		errx(EX_DATAERR, "Invalid input: %s", *argv);
 
 prio is an int so might not ever be able to take value LONG_{MIN,MAX}.
 
 -n should be accepted with its argument joined to it, for example -n4 as
 well as -n 4. Solaris accepts this and the standard specifies it. NetBSD
 has got it wrong.
 
 > +	/*
 > +	 * Accept -g, -p, -u, or a number. If it's a number, default
 > +	 * to -p (PRIO_PROCESS).
 > +	 */
 > +	if (strcmp(*argv, "-g") == 0) {
 > +		which = PRIO_PGRP;
 > +		argc--, argv++;
 > +	} else if (strcmp(*argv, "-u") == 0) {
 > +		which = PRIO_USER;
 > +		argc--, argv++;
 > +	} else if (strcmp(*argv, "-p") == 0)
 > +		argc--, argv++;
 > +
 
 Handling these in the loop is the traditional BSD, and SUSv2 behaviour. Worth
 noting in the COMPATIBILITY section of the manual page that this syntax isn't
 allowed anymore if you choose to remove it.
 
 > +		/* If argv is not a number, then we should be PRIO_USER. */
 
 No, non-numeric arguments are invalid unless preceeded by -u.
 
 > -	exit(errs != 0);
 > +	exit(errs);
 
 Existing code was better; knowing how many requests failed is not useful,
 and it could wrap back around to 0 (success) or other strange things.
 
 > -	printf("%d: old priority %d, new priority %d\n", who, oldprio, prio);
 > +	printf("%d: old nice_value %d, new nice_value %d\n", who, oldprio, prio);
 
 This should just be removed alltogether - SUSv3 specifies that standard
 output is not used at all, despite this being traditional behaviour.
 
 
 Tim

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




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