From owner-svn-src-head@FreeBSD.ORG Thu Jan 6 21:27:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D507106566C; Thu, 6 Jan 2011 21:27:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E2FCF8FC12; Thu, 6 Jan 2011 21:27:06 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id A63CF46B3B; Thu, 6 Jan 2011 16:27:06 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AE96F8A009; Thu, 6 Jan 2011 16:27:05 -0500 (EST) From: John Baldwin To: Alexander Best Date: Thu, 6 Jan 2011 16:18:39 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20101102; KDE/4.4.5; amd64; ; ) References: <201101041413.p04EDA4f038360@svn.freebsd.org> <20110106211017.GA46874@freebsd.org> In-Reply-To: <20110106211017.GA46874@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201101061618.39695.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 06 Jan 2011 16:27:05 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx 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:27:07 -0000 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. :) -- John Baldwin