From owner-freebsd-audit Sat Jun 16 19:12:11 2001 Delivered-To: freebsd-audit@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id AFFEA37B405 for ; Sat, 16 Jun 2001 19:12:08 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id 63AF83E28 for ; Sat, 16 Jun 2001 19:12:08 -0700 (PDT) To: audit@freebsd.org Subject: Patch to fix `pstat -tn` Date: Sat, 16 Jun 2001 19:12:08 -0700 From: Dima Dorfman Message-Id: <20010617021208.63AF83E28@bazooka.unixfreak.org> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The attached patch fixes `pstat -tn` to do what the man page says it should do, rather than just print '0'. I'm not sure when this was broken (or if it ever worked at all), but the fix is relatively simple. Please review. Thanks, Dima Dorfman dima@unixfreak.org Index: pstat.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/pstat/pstat.c,v retrieving revision 1.58 diff -u -c -r1.58 pstat.c *** pstat.c 2001/06/17 02:01:43 1.58 --- pstat.c 2001/06/17 02:10:19 *************** *** 854,864 **** int i, j; pid_t pgid; char *name, state[20]; if (usenumflag || tp->t_dev == 0 || ! (name = devname(tp->t_dev, S_IFCHR)) == NULL) ! (void)printf("%7d ", line); ! else (void)printf("%7s ", name); (void)printf("%2d %3d ", tp->t_rawq.c_cc, tp->t_canq.c_cc); (void)printf("%3d %5d %5d %4d %3d %7d ", tp->t_outq.c_cc, --- 854,869 ---- int i, j; pid_t pgid; char *name, state[20]; + char *tb; if (usenumflag || tp->t_dev == 0 || ! (name = devname(tp->t_dev, S_IFCHR)) == NULL) { ! i = asprintf(&tb, "%d,%d", major(tp->t_dev), minor(tp->t_dev)); ! if (i == -1) ! err(1, "asprintf"); ! (void)printf("%7s ", tb); ! free(tb); ! } else (void)printf("%7s ", name); (void)printf("%2d %3d ", tp->t_rawq.c_cc, tp->t_canq.c_cc); (void)printf("%3d %5d %5d %4d %3d %7d ", tp->t_outq.c_cc, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message