From owner-freebsd-stable@FreeBSD.ORG Mon Apr 9 05:51:25 2012 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 341021065670; Mon, 9 Apr 2012 05:51:25 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 84A578FC08; Mon, 9 Apr 2012 05:51:24 +0000 (UTC) Received: by bkcjc3 with SMTP id jc3so4012600bkc.13 for ; Sun, 08 Apr 2012 22:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=61wxJDGDJOYSi0ivuFSxATeE14rKujSmG9LmqUWDAxA=; b=FwwW7XLhAm1OFqlTy5QevqdKNePd8y9VyDbrTCTTrCKyoQaN85Sj+QJX74WJUxOoNF ePsZUaWAR6Jj9KClQVKxlkwnJ8zmxjWhauT4Mo4Sez8Jx74p1mD/eNdZoT30dZYLwQxg kUzkFIeCZ0ftPMFPFknfulcuvoK90oFAOjvgU2IQq2hUpLWYvpgUs9IH6edIAY8To0bZ RT7OIFsloD1XNxfWROk8xsk/ZMyi1p0AbOlPxwCDSteYBnjc//WFfmr97wh9nhsgFXd9 JA/HJGzGKa6l9ZMU+ZUk7nn5fj9YqqXHK7GfV0vPvHbZpWb/3jeyQ1mxdq780ZQYKq4R /CFA== Received: by 10.204.156.196 with SMTP id y4mr2630968bkw.119.1333950678353; Sun, 08 Apr 2012 22:51:18 -0700 (PDT) Received: from localhost ([188.230.122.226]) by mx.google.com with ESMTPS id f11sm17203423bkw.6.2012.04.08.22.51.15 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 08 Apr 2012 22:51:16 -0700 (PDT) From: Mikolaj Golub To: Jason Hellenthal Organization: TOA Ukraine References: <201204061632.q36GWTT2017212@svn.freebsd.org> <20120408211218.GA62178@DataIX.net> Sender: Mikolaj Golub Date: Mon, 09 Apr 2012 08:51:13 +0300 In-Reply-To: <20120408211218.GA62178@DataIX.net> (Jason Hellenthal's message of "Sun, 8 Apr 2012 17:12:18 -0400") Message-ID: <861unxqwq6.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: stable@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r233953 - stable/8/usr.bin/procstat X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2012 05:51:25 -0000 On Sun, 8 Apr 2012 17:12:18 -0400 Jason Hellenthal wrote: JH> This commit in action does not seem to be doing the correct thing even JH> though it does report an error when kern.proc.pathname is not known. JH> Running procstat -a -b produces: JH> [...] JH> 1848 ksh 803500 /bin/ksh JH> procstat: sysctl: kern.proc.pathname: 2208: No such file or directory Plese note, the error was generated by kern.proc.pathname sysctl, not kern.proc.osrel. I suppose it is because /bin/ksh binary had been reinstalled and 1848 ran the old binary. My commit has not touched the kern.proc.pathname part and the same bahavior was before the change. JH> 2210 ksh 803500 /bin/ksh JH> [...] JH> While procstat -a produces: JH> [...] JH> 1848 1846 1848 1848 1848 1 jhellenthal wait FreeBSD ELF32 ksh JH> 2208 1814 2208 2208 0 1 jhellenthal select FreeBSD ELF32 xterm JH> 2210 2208 2210 2210 2210 1 jhellenthal wait FreeBSD ELF32 ksh JH> [...] JH> If process 2208 can be seen during (procstat -a) I do not see a reason JH> to bailout and print an error when (-b) is used. Just print the JH> orrelease as (0) and print the rest of the information that should be JH> seen... JH> Could someone have a closer look at this? JH> On Fri, Apr 06, 2012 at 04:32:29PM +0000, Mikolaj Golub wrote: >> Author: trociny >> Date: Fri Apr 6 16:32:29 2012 >> New Revision: 233953 >> URL: http://svn.freebsd.org/changeset/base/233953 >> >> Log: >> MFC r233390: >> >> When displaying binary information show also osreldate. >> >> Suggested by: kib >> >> Modified: >> stable/8/usr.bin/procstat/procstat.1 >> stable/8/usr.bin/procstat/procstat_bin.c >> Directory Properties: >> stable/8/usr.bin/procstat/ (props changed) >> >> Modified: stable/8/usr.bin/procstat/procstat.1 >> ============================================================================== >> --- stable/8/usr.bin/procstat/procstat.1 Fri Apr 6 16:31:29 2012 (r233952) >> +++ stable/8/usr.bin/procstat/procstat.1 Fri Apr 6 16:32:29 2012 (r233953) >> @@ -25,7 +25,7 @@ >> .\" >> .\" $FreeBSD$ >> .\" >> -.Dd March 7, 2010 >> +.Dd March 23, 2012 >> .Dt PROCSTAT 1 >> .Os >> .Sh NAME >> @@ -98,6 +98,8 @@ Display the process ID, command, and pat >> process ID >> .It COMM >> command >> +.It OSREL >> +osreldate for process binary >> .It PATH >> path to process binary (if available) >> .El >> >> Modified: stable/8/usr.bin/procstat/procstat_bin.c >> ============================================================================== >> --- stable/8/usr.bin/procstat/procstat_bin.c Fri Apr 6 16:31:29 2012 (r233952) >> +++ stable/8/usr.bin/procstat/procstat_bin.c Fri Apr 6 16:32:29 2012 (r233953) >> @@ -42,11 +42,11 @@ void >> procstat_bin(pid_t pid, struct kinfo_proc *kipp) >> { >> char pathname[PATH_MAX]; >> - int error, name[4]; >> + int error, osrel, name[4]; >> size_t len; >> >> if (!hflag) >> - printf("%5s %-16s %-53s\n", "PID", "COMM", "PATH"); >> + printf("%5s %-16s %8s %s\n", "PID", "COMM", "OSREL", "PATH"); >> >> name[0] = CTL_KERN; >> name[1] = KERN_PROC; >> @@ -64,7 +64,19 @@ procstat_bin(pid_t pid, struct kinfo_pro >> if (len == 0 || strlen(pathname) == 0) >> strcpy(pathname, "-"); >> >> + name[2] = KERN_PROC_OSREL; >> + >> + len = sizeof(osrel); >> + error = sysctl(name, 4, &osrel, &len, NULL, 0); >> + if (error < 0 && errno != ESRCH) { >> + warn("sysctl: kern.proc.osrel: %d", pid); >> + return; >> + } >> + if (error < 0) >> + return; >> + >> printf("%5d ", pid); >> printf("%-16s ", kipp->ki_comm); >> + printf("%8d ", osrel); >> printf("%s\n", pathname); >> } >> _______________________________________________ >> svn-src-stable-8@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 >> To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" JH> -- JH> ;s =; -- Mikolaj Golub