Date: Thu, 6 Jan 2011 16:18:39 -0500 From: John Baldwin <jhb@freebsd.org> To: Alexander Best <arundel@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov <kib@freebsd.org>, Garrett Cooper <gcooper@freebsd.org> Subject: Re: svn commit: r216955 - head/usr.sbin/rtprio Message-ID: <201101061618.39695.jhb@freebsd.org> In-Reply-To: <20110106211017.GA46874@freebsd.org> References: <201101041413.p04EDA4f038360@svn.freebsd.org> <AANLkTimDTq-JXF4gm9KUfo5eJaEXKaRF-CYiycFwdZML@mail.gmail.com> <20110106211017.GA46874@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <arundel@freebsd.org>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101061618.39695.jhb>
