Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jun 2001 19:12:08 -0700
From:      Dima Dorfman <dima@unixfreak.org>
To:        audit@freebsd.org
Subject:   Patch to fix `pstat -tn`
Message-ID:  <20010617021208.63AF83E28@bazooka.unixfreak.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010617021208.63AF83E28>