From owner-svn-src-head@FreeBSD.ORG Thu Jan 6 21:42:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 2F4431065672; Thu, 6 Jan 2011 21:42:43 +0000 (UTC) Date: Thu, 6 Jan 2011 21:42:43 +0000 From: Alexander Best To: John Baldwin Message-ID: <20110106214243.GA51802@freebsd.org> References: <201101041413.p04EDA4f038360@svn.freebsd.org> <20110106211017.GA46874@freebsd.org> <201101061618.39695.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201101061618.39695.jhb@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov , Garrett Cooper Subject: Re: svn commit: r216955 - head/usr.sbin/rtprio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jan 2011 21:42:43 -0000 On Thu Jan 6 11, John Baldwin wrote: > On Thursday, January 06, 2011 4:10:17 pm Alexander Best wrote: > > On Thu Jan 6 11, Garrett Cooper wrote: > > > On Thu, Jan 6, 2011 at 12:41 PM, Alexander Best > wrote: > > > > > > ... > > > > > > > this causes problems when pid is -0: > > > > > > > > [id|rt]prio -t -0 and [id|rt]prio 10 -0 will try to run "0" via > execvp(). > > > > beforehand however this will also trigger rtprio(). > > > > > > > > a better solution would be to do: > > > > > > > > if (argv[2][0] == '-') { > > > > proc = parseint(argv[2] + 1, "pid"); > > > > if (rtprio(RTP_SET, proc, &rtp) != 0) > > > > err(1, "RTP_SET"); > > > > } else { > > > > execvp(argv[2], &argv[2]); > > > > err(1, "%s", argv[2]); > > > > } > > > > > > How did you get a pid of -0? > > > > pid 0 stands for the current process. see rptio(2). > > Note that that usage is rather pointless since it means you apply rtprio to > the 'rtprio' process that is about to exit. :) yeah but at least it makes the usage of -X consistent. ;) also consider the following: the current shell has idle priority and you want to run rtprio in normal priority. then rtprio -t -0 would be a neat way of doing rtprio -t rtprio. ;) wel...not quite, because the priotity gets set to "NORMAL" when rtprio is almost finished running. ;) i admit using -0 for setting rtpio's own priority isn't very useful, but the rtprio(1) manual states: Pid of 0 means "the current process". ...so it better work. ;) cheers. alex > > -- > John Baldwin -- a13x