changeset 10265:b988146c84e5

6824918 timestamp option for xxstat commands PSARC/2009/307 Time Stamp Option for xxstat Commands Phase II Contributed by Chad Mynhier <cmynhier@gmail.com>
author Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
date Wed, 05 Aug 2009 20:39:41 -0700
parents 1196af6129ec
children bbc5945eddd7
files usr/src/cmd/auditstat/Makefile usr/src/cmd/auditstat/auditstat.c usr/src/cmd/cmd-inet/usr.bin/netstat/Makefile usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c usr/src/cmd/cpc/common/cpustat.c usr/src/cmd/cpc/cpustat/Makefile usr/src/cmd/ctstat/Makefile usr/src/cmd/ctstat/ctstat.c usr/src/cmd/fm/fmstat/Makefile.com usr/src/cmd/fm/fmstat/common/fmstat.c usr/src/cmd/fs.d/nfs/nfsstat/Makefile usr/src/cmd/fs.d/nfs/nfsstat/nfsstat.c usr/src/cmd/intrstat/Makefile.com usr/src/cmd/intrstat/intrstat.c usr/src/cmd/pools/poolstat/Makefile usr/src/cmd/pools/poolstat/poolstat.c usr/src/cmd/rcap/rcapstat/Makefile usr/src/cmd/rcap/rcapstat/rcapstat.c usr/src/cmd/stat/Makefile.stat usr/src/cmd/stat/common/common.c usr/src/cmd/stat/common/statcommon.h usr/src/cmd/stat/common/timestamp.c usr/src/cmd/stat/fsstat/Makefile usr/src/cmd/stat/fsstat/fsstat.c usr/src/cmd/stat/iostat/iostat.c usr/src/cmd/stat/mpstat/mpstat.c usr/src/cmd/stat/vmstat/vmstat.c usr/src/cmd/zpool/Makefile usr/src/cmd/zpool/zpool_main.c usr/src/cmd/zpool/zpool_util.c usr/src/cmd/zpool/zpool_util.h
diffstat 31 files changed, 544 insertions(+), 193 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/auditstat/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/auditstat/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -2,9 +2,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
 #
 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 # or http://www.opensolaris.org/os/licensing.
@@ -20,25 +19,41 @@
 # CDDL HEADER END
 #
 #
-# Copyright 1992, 2002 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 PROG= auditstat
+OBJS = auditstat.o
+SRCS = $(OBJS:%.o=%.c)
 
 include ../Makefile.cmd
 include ../Makefile.cmd.bsm
 
-LDLIBS += -lbsm 
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
+SRCS += $(STAT_COMMON_SRCS)
+
+LDLIBS += -lbsm
+CPPFLAGS += -I$(STATCOMMONDIR)
 
 .KEEP_STATE:
 
 all: $(PROG)
 
-clean:
+$(PROG): $(OBJS) $(STAT_COMMON_OBJS)
+	$(LINK.c) -o $(PROG) $(OBJS) $(STAT_COMMON_OBJS) $(LDLIBS)
+	$(POST_PROCESS)
 
-lint:	lint_PROG
+%.o: $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
+clean:
+	-$(RM) $(OBJS) $(STAT_COMMON_OBJS)
+
+lint:	lint_SRCS
 
 include ../Makefile.targ
--- a/usr/src/cmd/auditstat/auditstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/auditstat/auditstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -19,11 +19,11 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#include "statcommon.h"
 
 #include <sys/types.h>
 #include <stdlib.h>
@@ -32,6 +32,12 @@
 #include <bsm/audit.h>
 #include <bsm/libbsm.h>
 #include <unistd.h>
+#include <locale.h>
+
+#if !defined(TEXT_DOMAIN)		/* Should be defined by cc -D */
+#define	TEXT_DOMAIN "SYS_TEST"		/* Use this only if it isn't */
+#endif
+
 
 /*
  * Display header every HEADER_MOD lines printed
@@ -51,6 +57,7 @@
 static int	flags;
 static int	header_mod = DFLT_HEADER_MOD;
 static int	interval;
+static uint_t timestamp_fmt = NODATE;
 
 static void	display_stats();
 static void	eauditon();
@@ -66,6 +73,9 @@
 	register int	i;
 	au_stat_t s;
 
+	(void) setlocale(LC_ALL, "");
+	(void) textdomain(TEXT_DOMAIN);
+
 	(void) setbuf(stdout, (char *)0);
 	(void) setbuf(stderr, (char *)0);
 
@@ -73,6 +83,8 @@
 
 	if (!flags) {
 		eauditon(A_GETSTAT, (caddr_t)&s, NULL);
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
 		display_stats(&s, 0);
 		exit(0);
 	}
@@ -92,6 +104,8 @@
 	/* CSTYLED */
 	for (i = 0;; i++) {
 		eauditon(A_GETSTAT, (caddr_t)&s, NULL);
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
 		display_stats(&s, i);
 		if ((flags & CFLG) && count)
 			if (i == count - 1)
@@ -126,7 +140,8 @@
 		s->as_memused / ONEK, 	&(offset[11]));
 
 	/* print a properly aligned header every HEADER_MOD lines */
-	if (header_mod && (!cnt || !(cnt % header_mod))) {
+	if (header_mod && (!cnt || ((timestamp_fmt != NODATE) ?
+	    !(cnt % (header_mod / 2)) : !(cnt % header_mod)))) {
 		(void) printf(
 			"%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s\n",
 			offset[0] - 1,			"gen",
@@ -167,7 +182,7 @@
 {
 	int	c;
 
-	while ((c = getopt(argc, argv, "c:h:i:vn")) != -1) {
+	while ((c = getopt(argc, argv, "c:h:i:vnT:")) != -1) {
 		switch (c) {
 		case 'c':
 			if (flags & CFLG)
@@ -212,6 +227,18 @@
 				usage_exit();
 			flags |= VFLG;
 			break;
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					usage_exit();
+			} else {
+				usage_exit();
+			}
+			break;
 		case '?':
 		default:
 			usage_exit();
@@ -226,7 +253,7 @@
 {
 	(void) fprintf(stderr,
 	    "auditstat: usage: auditstat [-c count] [-h lines] "
-	    "[-i interval] [-n] [-v]\n");
+	    "[-T d|u] [-i interval] [-n] [-v]\n");
 	exit(1);
 }
 
--- a/usr/src/cmd/cmd-inet/usr.bin/netstat/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/cmd-inet/usr.bin/netstat/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -19,11 +19,9 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 # Copyright (c) 1990 Mentat Inc.
 #
 # cmd/cmd-inet/usr.bin/netstat/Makefile
@@ -32,16 +30,22 @@
 
 LOCALOBJS=	netstat.o unix.o
 COMMONOBJS=	compat.o
-OBJS=		$(LOCALOBJS) $(COMMONOBJS)
 
 include ../../../Makefile.cmd
 include ../../Makefile.cmd-inet
 
 LOCALSRCS=	$(LOCALOBJS:%.o=%.c)
 COMMONSRCS=	$(CMDINETCOMMONDIR)/$(COMMONOBJS:%.o=%.c)
-SRCS=		$(LOCALSRCS) $(COMMONSRCS)
+
+STATCOMMONDIR = $(SRC)/cmd/stat/common
 
-CPPFLAGS += -DNDEBUG -I$(CMDINETCOMMONDIR)
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
+
+OBJS=		$(LOCALOBJS) $(COMMONOBJS) $(STAT_COMMON_OBJS)
+SRCS=		$(LOCALSRCS) $(COMMONSRCS) $(STAT_COMMON_SRCS)
+
+CPPFLAGS += -DNDEBUG -I$(CMDINETCOMMONDIR) -I$(STATCOMMONDIR)
 LDLIBS += -ldhcpagent -lsocket -lnsl -lkstat -ltsnet -ltsol
 
 .KEEP_STATE:
@@ -54,6 +58,10 @@
 	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
 	$(POST_PROCESS)
 
+%.o : $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
 install: all $(ROOTPROG) 
 
 clean:
--- a/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -58,6 +58,7 @@
 #include <ctype.h>
 #include <kstat.h>
 #include <assert.h>
+#include <locale.h>
 
 #include <sys/types.h>
 #include <sys/stream.h>
@@ -92,6 +93,8 @@
 #include <libtsnet.h>
 #include <tsol/label.h>
 
+#include "statcommon.h"
+
 extern void	unixpr(kstat_ctl_t *kc);
 
 #define	STR_EXPAND	4
@@ -211,7 +214,6 @@
 static void		m_report(void);
 static void		dhcp_report(char *);
 
-	void		fail(int, char *, ...);
 static	uint64_t	kstat_named_value(kstat_t *, char *);
 static	kid_t		safe_kstat_read(kstat_ctl_t *, kstat_t *, void *);
 static int		isnum(char *);
@@ -335,6 +337,12 @@
  */
 static filter_t *filters[NFILTERKEYS];
 
+static uint_t timestamp_fmt = NODATE;
+
+#if !defined(TEXT_DOMAIN)		/* Should be defined by cc -D */
+#define	TEXT_DOMAIN "SYS_TEST"		/* Use this only if it isn't */
+#endif
+
 int
 main(int argc, char **argv)
 {
@@ -368,7 +376,10 @@
 		    default_ip_str, DEFAULT_IP, INET_DEFAULT_FILE);
 	free(default_ip_str);
 
-	while ((c = getopt(argc, argv, "adimnrspMgvf:P:I:DR")) != -1) {
+	(void) setlocale(LC_ALL, "");
+	(void) textdomain(TEXT_DOMAIN);
+
+	while ((c = getopt(argc, argv, "adimnrspMgvf:P:I:DRT:")) != -1) {
 		switch ((char)c) {
 		case 'a':		/* all connections */
 			Aflag = B_TRUE;
@@ -471,6 +482,19 @@
 			Iflag_only = 0;
 			break;
 
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					usage(name);
+			} else {
+				usage(name);
+			}
+			break;
+
 		case '?':
 		default:
 			usage(name);
@@ -566,6 +590,9 @@
 	for (;;) {
 		mib_item_t *curritem = NULL; /* only for -[M]s */
 
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
+
 		/* netstat: AF_INET[6] behaviour */
 		if (family_selected(AF_INET) || family_selected(AF_INET6)) {
 			if (Sflag) {
@@ -3348,6 +3375,9 @@
 		fail(0, "dhcp_do_ipc: %s", dhcp_ipc_strerror(error));
 	}
 
+	if (timestamp_fmt != NODATE)
+		print_timestamp(timestamp_fmt);
+
 	if (!printed_one)
 		(void) printf("%s", dhcp_status_hdr_string());
 
@@ -6225,20 +6255,21 @@
 static void
 usage(char *cmdname)
 {
-	(void) fprintf(stderr, "usage: %s [-anv] [-f address_family]\n",
-	    cmdname);
+	(void) fprintf(stderr, "usage: %s [-anv] [-f address_family] "
+	    "[-T d|u]\n", cmdname);
 	(void) fprintf(stderr, "       %s [-n] [-f address_family] "
-	    "[-P protocol] [-g | -p | -s [interval [count]]]\n", cmdname);
-	(void) fprintf(stderr, "       %s -m [-v] "
+	    "[-P protocol] [-T d|u] [-g | -p | -s [interval [count]]]\n",
+	    cmdname);
+	(void) fprintf(stderr, "       %s -m [-v] [-T d|u] "
 	    "[interval [count]]\n", cmdname);
 	(void) fprintf(stderr, "       %s -i [-I interface] [-an] "
-	    "[-f address_family] [interval [count]]\n", cmdname);
+	    "[-f address_family] [-T d|u] [interval [count]]\n", cmdname);
 	(void) fprintf(stderr, "       %s -r [-anv] "
-	    "[-f address_family|filter]\n", cmdname);
-	(void) fprintf(stderr, "       %s -M [-ns] [-f address_family]\n",
-	    cmdname);
+	    "[-f address_family|filter] [-T d|u]\n", cmdname);
+	(void) fprintf(stderr, "       %s -M [-ns] [-f address_family] "
+	    "[-T d|u]\n", cmdname);
 	(void) fprintf(stderr, "       %s -D [-I interface] "
-	    "[-f address_family]\n", cmdname);
+	    "[-f address_family] [-T d|u]\n", cmdname);
 	exit(EXIT_FAILURE);
 }
 
--- a/usr/src/cmd/cpc/common/cpustat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/cpc/common/cpustat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/processor.h>
 #include <sys/pset.h>
@@ -49,6 +47,7 @@
 #include <sys/resource.h>
 
 #include "cpucmds.h"
+#include "statcommon.h"
 
 static struct options {
 	int debug;
@@ -93,6 +92,8 @@
 static int	smt = 0;	    /* If set, cpustat needs to be SMT-aware. */
 static pcinfo_t	fxinfo = { 0, "FX", NULL }; /* FX scheduler class info */
 
+static uint_t timestamp_fmt = NODATE;
+
 /*ARGSUSED*/
 static void
 cpustat_errfn(const char *fn, int subcode, const char *fmt, va_list ap)
@@ -136,8 +137,8 @@
 	if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
 		errstr = strerror(errno);
 		(void) fprintf(stderr,
-			gettext("%s: setrlimit failed - %s\n"),
-			opts->pgmname, errstr);
+		    gettext("%s: setrlimit failed - %s\n"),
+		    opts->pgmname, errstr);
 	}
 
 	if ((cpc = cpc_open(CPC_VER_CURRENT)) == NULL) {
@@ -167,7 +168,7 @@
 		return (1);
 	}
 
-	while ((c = getopt(argc, argv, "Dc:hntsp:")) != EOF && errcnt == 0)
+	while ((c = getopt(argc, argv, "Dc:hntT:sp:")) != EOF && errcnt == 0)
 		switch (c) {
 		case 'D':			/* enable debugging */
 			opts->debug++;
@@ -196,6 +197,18 @@
 		case 't':			/* print %tick */
 			opts->dotick = 1;
 			break;
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					errcnt++;
+			} else {
+				errcnt++;
+			}
+			break;
 		case 'h':			/* help */
 			opts->dohelp = 1;
 			break;
@@ -239,12 +252,14 @@
 	    (opts->nsets = cpc_setgrp_numsets(opts->master)) == 0) {
 		(void) fprintf(opts->dohelp ? stdout : stderr, gettext(
 		    "Usage:\n\t%s [-c events] [-p period] [-nstD] "
-			"[interval [count]]\n\n"
+		    "[-T d|u] [interval [count]]\n\n"
 		    "\t-c events specify processor events to be monitored\n"
 		    "\t-n\t  suppress titles\n"
 		    "\t-p period cycle through event list periodically\n"
 		    "\t-s\t  run user soaker thread for system-only events\n"
 		    "\t-t\t  include %s register\n"
+		    "\t-T d|u\t  Display a timestamp in date (d) or unix "
+		    "time_t (u)\n"
 		    "\t-D\t  enable debug mode\n"
 		    "\t-h\t  print extended usage information\n\n"
 		    "\tUse cputrack(1) to monitor per-process statistics.\n"),
@@ -347,6 +362,8 @@
 		}
 	}
 
+	if (timestamp_fmt != NODATE)
+		print_timestamp(timestamp_fmt);
 	if (ccnt > sizeof (line))
 		ccnt = sizeof (line);
 	if (ccnt > 0)
@@ -513,7 +530,7 @@
 			 * If periodic behavior was requested, rest here.
 			 */
 			if (opts->doperiod && opts->mseconds_rest > 0 &&
-				(sample_cnt % opts->nsets) == 0) {
+			    (sample_cnt % opts->nsets) == 0) {
 				/*
 				 * Stop the soaker while the tool rests.
 				 */
@@ -609,7 +626,7 @@
 	max_chip_id = sysconf(_SC_CPUID_MAX);
 	if ((chip_designees = malloc(max_chip_id * sizeof (int))) == NULL) {
 		(void) fprintf(stderr, gettext(
-			"%s: out of heap\n"), opts->pgmname);
+		    "%s: out of heap\n"), opts->pgmname);
 		return (1);
 	}
 	for (i = 0; i < max_chip_id; i++)
@@ -618,16 +635,16 @@
 	if (smt) {
 		if ((kc = kstat_open()) == NULL) {
 			(void) fprintf(stderr, gettext(
-				"%s: kstat_open() failed: %s\n"), opts->pgmname,
+			    "%s: kstat_open() failed: %s\n"), opts->pgmname,
 			    strerror(errno));
-			    return (1);
+			return (1);
 		}
 	}
 
 	if (opts->dosoaker)
 		if (priocntl(0, 0, PC_GETCID, &fxinfo) == -1) {
 			(void) fprintf(stderr, gettext(
-				"%s: couldn't get FX scheduler class: %s\n"),
+			    "%s: couldn't get FX scheduler class: %s\n"),
 			    opts->pgmname, strerror(errno));
 			return (1);
 		}
--- a/usr/src/cmd/cpc/cpustat/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/cpc/cpustat/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -19,11 +19,9 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 PROG =		cpustat
 OBJS =		$(PROG).o caps.o time.o setgrp.o strtoset.o
@@ -31,23 +29,29 @@
 
 include ../../Makefile.cmd
 
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
+SRCS += $(STAT_COMMON_SRCS)
+
 CFLAGS		+= $(CCVERBOSE) $(CTF_FLAGS)
-CPPFLAGS	+= -D_REENTRANT -I$(SRC)/lib/libcpc/common
+CPPFLAGS	+= -D_REENTRANT -I$(SRC)/lib/libcpc/common -I$(STATCOMMONDIR)
 LDLIBS +=	-lcpc -lkstat
 
 .KEEP_STATE:
 
 all:	$(PROG)
 
-$(PROG): $(OBJS)
-	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
+$(PROG): $(OBJS) $(STAT_COMMON_OBJS)
+	$(LINK.c) $(OBJS) $(STAT_COMMON_OBJS) -o $@ $(LDLIBS)
 	$(POST_PROCESS)
-	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
+	$(CTFMERGE) -L VERSION -o $@ $(OBJS) $(STAT_COMMON_OBJS)
 
 install: all $(ROOTUSRSBINPROG)
 
 clean:
-	$(RM) $(OBJS)
+	$(RM) $(OBJS) $(STAT_COMMON_OBJS)
 
 lint:	lint_SRCS
 
@@ -58,6 +62,10 @@
 	$(COMPILE.c) $<
 	$(CTFCONVERT_O)
 
+%.o:	$(STATCOMMONDIR)/%.c
+	$(COMPILE.c) $<
+	$(CTFCONVERT_O)
+
 POFILES =	../common/$(PROG).po ../common/caps.po
 POFILE =	$(PROG)_cmd.po
 
--- a/usr/src/cmd/ctstat/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/ctstat/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -2,9 +2,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
 #
 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 # or http://www.opensolaris.org/os/licensing.
@@ -20,16 +19,23 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 PROG= ctstat
+OBJS = ctstat.o
+SRCS = $(OBJS:%.o=%.c)
 
 include ../Makefile.cmd
 
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
+SRCS += $(STAT_COMMON_SRCS)
+
+CPPFLAGS += -I$(STATCOMMONDIR)
 CFLAGS += -v
 LDLIBS += -lcontract -luutil
 
@@ -37,10 +43,19 @@
 
 all: $(PROG)
 
+$(PROG): $(OBJS) $(STAT_COMMON_OBJS)
+	$(LINK.c) -o $(PROG) $(OBJS) $(STAT_COMMON_OBJS) $(LDLIBS)
+	$(POST_PROCESS)
+        
+%.o : $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
 install: all $(ROOTPROG)
 
 clean:
+	$(RM) $(OBJS) $(STAT_COMMON_OBJS)
 
-lint:	lint_PROG
+lint:	lint_SRCS
 
 include ../Makefile.targ
--- a/usr/src/cmd/ctstat/ctstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/ctstat/ctstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/ctfs.h>
 #include <stdio.h>
@@ -43,6 +41,10 @@
 #include <locale.h>
 #include <langinfo.h>
 
+#include "statcommon.h"
+
+static uint_t timestamp_fmt = NODATE;
+
 static int opt_verbose = 0;
 static int opt_showall = 0;
 
@@ -55,7 +57,7 @@
 usage(void)
 {
 	(void) fprintf(stderr, gettext("Usage: %s [-a] [-i ctidlist] "
-	    "[-t typelist] [-v] [interval [count]]\n"), uu_getpname());
+	    "[-t typelist] [-T d|u] [-v] [interval [count]]\n"), uu_getpname());
 	exit(UU_EXIT_USAGE);
 }
 
@@ -770,7 +772,7 @@
 
 	(void) uu_setpname(argv[0]);
 
-	while ((s = getopt(argc, argv, "ai:t:v")) != EOF) {
+	while ((s = getopt(argc, argv, "ai:T:t:v")) != EOF) {
 		switch (s) {
 		case 'a':
 			opt_showall = 1;
@@ -778,6 +780,18 @@
 		case 'i':
 			nids = parse_ids(optarg, (int **)&ids, nids);
 			break;
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					usage();
+			} else {
+				usage();
+			}
+			break;
 		case 't':
 			ntypes = parse_types(optarg, &types, ntypes);
 			break;
@@ -814,6 +828,8 @@
 	for (i = 0; count == 0 || i < count; i++) {
 		if (i)
 			(void) sleep(interval);
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
 		print_header();
 		if (nids && ntypes)
 			scan_all(types, ntypes, ids, nids);
--- a/usr/src/cmd/fm/fmstat/Makefile.com	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/fm/fmstat/Makefile.com	Wed Aug 05 20:39:41 2009 -0700
@@ -2,9 +2,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
 #
 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 # or http://www.opensolaris.org/os/licensing.
@@ -20,10 +19,9 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
 
 .KEEP_STATE:
 .SUFFIXES:
@@ -36,8 +34,14 @@
 PROG = fmstat
 ROOTPROG = $(ROOTUSRSBIN)/$(PROG)
 
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_LINTFILES = $(STAT_COMMON_OBJS:%.o=%.ln)
+LINTFILES += $(STAT_LINTFILES)
+
 $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
-CPPFLAGS += -I. -I../common
+CPPFLAGS += -I. -I../common -I$(STATCOMMONDIR)
 CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST)
 LDLIBS += -L$(ROOT)/usr/lib/fm -lfmd_adm
 LDFLAGS += -R/usr/lib/fm
@@ -48,9 +52,9 @@
 
 all: $(PROG)
 
-$(PROG): $(OBJS)
-	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
-	$(CTFMERGE) -L VERSION -o $@ $(OBJS)
+$(PROG): $(OBJS) $(STAT_COMMON_OBJS)
+	$(LINK.c) $(OBJS)  $(STAT_COMMON_OBJS) -o $@ $(LDLIBS)
+	$(CTFMERGE) -L VERSION -o $@ $(OBJS) $(STAT_COMMON_OBJS)
 	$(POST_PROCESS)
 
 %.o: ../common/%.c
@@ -61,12 +65,19 @@
 	$(COMPILE.c) $<
 	$(CTFCONVERT_O)
 
+%.o : $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) $<
+	$(CTFCONVERT_O)
+
 clean:
-	$(RM) $(OBJS) $(LINTFILES)
+	$(RM) $(OBJS) $(STAT_COMMON_OBJS) $(LINTFILES)
 
 clobber: clean
 	$(RM) $(PROG)
 
+%.ln: $(STATCOMMONDIR)/%.c
+	$(LINT.c) -c $<
+
 %.ln: ../common/%.c
 	$(LINT.c) -c $<
 
--- a/usr/src/cmd/fm/fmstat/common/fmstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/fm/fmstat/common/fmstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -21,12 +20,10 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <fm/fmd_adm.h>
 
 #include <strings.h>
@@ -36,6 +33,9 @@
 #include <stdio.h>
 #include <errno.h>
 #include <poll.h>
+#include <locale.h>
+
+#include "statcommon.h"
 
 #define	FMSTAT_EXIT_SUCCESS	0
 #define	FMSTAT_EXIT_ERROR	1
@@ -110,6 +110,12 @@
 	double m_pct_w;
 } *g_mods;
 
+static uint_t timestamp_fmt = NODATE;
+
+#if !defined(TEXT_DOMAIN)		/* Should be defined by cc -D */
+#define	TEXT_DOMAIN "SYS_TEST"		/* Use this only if it isn't */
+#endif
+
 static void
 vwarn(const char *format, va_list ap)
 {
@@ -672,10 +678,11 @@
 usage(FILE *fp)
 {
 	(void) fprintf(fp, "Usage: %s [-astTz] [-m module] "
-	    "[-P prog] [interval [count]]\n\n", g_pname);
+	    "[-P prog] [-d d|u] [interval [count]]\n\n", g_pname);
 
 	(void) fprintf(fp,
 	    "\t-a show all statistics, including those kept by fmd\n"
+	    "\t-d display a timestamp in date (d) or unix time_t (u)\n"
 	    "\t-m show module-specific statistics\n"
 	    "\t-P connect to alternate fmd program\n"
 	    "\t-s show module-specific serd engines\n"
@@ -707,11 +714,26 @@
 	else
 		program = FMD_ADM_PROGRAM;
 
-	while ((c = getopt(argc, argv, "am:P:stTz")) != EOF) {
+	(void) setlocale(LC_ALL, "");
+	(void) textdomain(TEXT_DOMAIN);
+
+	while ((c = getopt(argc, argv, "ad:m:P:stTz")) != EOF) {
 		switch (c) {
 		case 'a':
 			opt_a++;
 			break;
+		case 'd':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					return (usage(stderr));
+			} else {
+				return (usage(stderr));
+			}
+			break;
 		case 'm':
 			opt_m = optarg;
 			break;
@@ -768,6 +790,8 @@
 		die(NULL); /* fmd_adm_errmsg() has enough info */
 
 	while (iter < 0 || iter-- > 0) {
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
 		if (opt_s)
 			stat_mod_serd(opt_m);
 		else if (opt_T)
--- a/usr/src/cmd/fs.d/nfs/nfsstat/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/fs.d/nfs/nfsstat/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -33,6 +33,14 @@
 OBJS=	nfsstat.o $(COMMON)
 SRCS=	nfsstat.c ../lib/nfs_sec.c
 
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
+SRCS += $(STAT_COMMON_SRCS)
+OBJS += $(STAT_COMMON_OBJS)
+
+CPPFLAGS += -I$(STATCOMMONDIR)
 LDLIBS += -lkstat -lnsl
 
 $(PROG):	$(OBJS)
@@ -48,6 +56,9 @@
 nfs_sec.o:	../lib/nfs_sec.c
 		$(COMPILE.c) ../lib/nfs_sec.c
 
+%.o:    $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) $<
+
 install:	all $(ROOTPROG)
 
 lint:
--- a/usr/src/cmd/fs.d/nfs/nfsstat/nfsstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/fs.d/nfs/nfsstat/nfsstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -23,12 +23,10 @@
 /* PROTOLIB1 */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * nfsstat: Network File System statistics
  *
@@ -65,7 +63,9 @@
 #include <sys/time.h>
 #include <strings.h>
 #include <ctype.h>
+#include <locale.h>
 
+#include "statcommon.h"
 
 static kstat_ctl_t *kc = NULL;		/* libkstat cookie */
 static kstat_t *rpc_clts_client_kstat, *rpc_clts_server_kstat;
@@ -97,14 +97,13 @@
 static void req_print(kstat_t *, kstat_t *, int, int, int);
 static void req_print_v4(kstat_t *, kstat_t *, int, int);
 static void stat_print(const char *, kstat_t *, kstat_t *, int, int);
-static void kstat_sum(kstat_t *, kstat_t *, kstat_t *);
+static void nfsstat_kstat_sum(kstat_t *, kstat_t *, kstat_t *);
 static void stats_timer(int);
 static void safe_zalloc(void **, uint_t, int);
 static int safe_strtoi(char const *, char *);
 
 
-static void kstat_copy(kstat_t *, kstat_t *, int);
-static void fail(int, char *, ...);
+static void nfsstat_kstat_copy(kstat_t *, kstat_t *, int);
 static kid_t safe_kstat_read(kstat_ctl_t *, kstat_t *, void *);
 static kid_t safe_kstat_write(kstat_ctl_t *, kstat_t *, void *);
 
@@ -149,7 +148,11 @@
 static old_kstat_t old_aclproccnt_v2_kstat, old_aclproccnt_v3_kstat;
 static old_kstat_t old_aclreqcnt_v2_kstat, old_aclreqcnt_v3_kstat;
 
+static uint_t timestamp_fmt = NODATE;
 
+#if !defined(TEXT_DOMAIN)		/* Should be defined by cc -D */
+#define	TEXT_DOMAIN "SYS_TEST"		/* Use this only if it isn't */
+#endif
 
 int
 main(int argc, char *argv[])
@@ -170,7 +173,10 @@
 	count = 0;
 	go_forever = 0;
 
-	while ((c = getopt(argc, argv, "cnrsmzav:")) != EOF) {
+	(void) setlocale(LC_ALL, "");
+	(void) textdomain(TEXT_DOMAIN);
+
+	while ((c = getopt(argc, argv, "cnrsmzav:T:")) != EOF) {
 		switch (c) {
 		case 'c':
 			cflag++;
@@ -200,6 +206,18 @@
 			if ((vflag < 2) || (vflag > 4))
 				fail(0, "Invalid version number\n");
 			break;
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					usage();
+			} else {
+				usage();
+			}
+			break;
 		case '?':
 		default:
 			usage();
@@ -255,6 +273,8 @@
 		if (mflag) {
 			mi_print();
 		} else {
+			if (timestamp_fmt != NODATE)
+				print_timestamp(timestamp_fmt);
 
 			if (sflag &&
 			    (rpc_clts_server_kstat == NULL ||
@@ -619,7 +639,8 @@
 		return;
 
 	if (vflag == 0) {
-		kstat_sum(nfs_client_kstat, nfs4_client_kstat, ksum_kstat);
+		nfsstat_kstat_sum(nfs_client_kstat, nfs4_client_kstat,
+		    ksum_kstat);
 		stat_print("\nClient nfs:", ksum_kstat, &old_ksum_kstat.kst,
 		    field_width, zflag);
 	}
@@ -810,9 +831,9 @@
 			knp[i].value.ui64 = 0;
 	}
 	if (knp_old != NULL)
-		kstat_copy(req, req_old, 1);
+		nfsstat_kstat_copy(req, req_old, 1);
 	else
-		kstat_copy(req, req_old, 0);
+		nfsstat_kstat_copy(req, req_old, 0);
 }
 
 /*
@@ -918,9 +939,9 @@
 			kptr[i].value.ui64 = 0;
 	}
 	if (kptr_old != NULL)
-		kstat_copy(req, req_old, 1);
+		nfsstat_kstat_copy(req, req_old, 1);
 	else
-		kstat_copy(req, req_old, 0);
+		nfsstat_kstat_copy(req, req_old, 0);
 }
 
 static void
@@ -969,13 +990,13 @@
 	}
 
 	if (knp_old != NULL)
-		kstat_copy(req, req_old, 1);
+		nfsstat_kstat_copy(req, req_old, 1);
 	else
-		kstat_copy(req, req_old, 0);
+		nfsstat_kstat_copy(req, req_old, 0);
 }
 
 static void
-kstat_sum(kstat_t *kstat1, kstat_t *kstat2, kstat_t *sum)
+nfsstat_kstat_sum(kstat_t *kstat1, kstat_t *kstat2, kstat_t *sum)
 {
 	int i;
 	kstat_named_t *knp1, *knp2, *knpsum;
@@ -985,7 +1006,7 @@
 	knp1 = KSTAT_NAMED_PTR(kstat1);
 	knp2 = KSTAT_NAMED_PTR(kstat2);
 	if (sum->ks_data == NULL)
-		kstat_copy(kstat1, sum, 0);
+		nfsstat_kstat_copy(kstat1, sum, 0);
 	knpsum = KSTAT_NAMED_PTR(sum);
 
 	for (i = 0; i < (kstat1->ks_ndata); i++)
@@ -1297,12 +1318,12 @@
 usage(void)
 {
 	fprintf(stderr, "Usage: nfsstat [-cnrsza [-v version] "
-	    "[interval [count]]\n");
+	    "[-T d|u] [interval [count]]\n");
 	fprintf(stderr, "Usage: nfsstat -m [pathname..]\n");
 	exit(1);
 }
 
-static void
+void
 fail(int do_perror, char *message, ...)
 {
 	va_list args;
@@ -1385,7 +1406,7 @@
 }
 
 static void
-kstat_copy(kstat_t *src, kstat_t *dst, int fr)
+nfsstat_kstat_copy(kstat_t *src, kstat_t *dst, int fr)
 {
 
 	if (fr)
--- a/usr/src/cmd/intrstat/Makefile.com	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/intrstat/Makefile.com	Wed Aug 05 20:39:41 2009 -0700
@@ -29,22 +29,33 @@
 
 include ../../Makefile.cmd
 
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
+SRCS += $(STAT_COMMON_SRCS)
+
+CPPFLAGS += -I$(STATCOMMONDIR)
 CFLAGS += $(CCVERBOSE)
 CFLAGS64 += $(CCVERBOSE)
 LDLIBS += -ldtrace
 
 FILEMODE = 0555
 
-CLEANFILES += $(OBJS)
+CLEANFILES += $(OBJS) $(STAT_COMMON_OBJS)
 
 .KEEP_STATE:
 
 all: $(PROG)
 
-$(PROG): $(OBJS)
-	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
+$(PROG): $(OBJS) $(STAT_COMMON_OBJS)
+	$(LINK.c) -o $@ $(OBJS) $(STAT_COMMON_OBJS) $(LDLIBS)
 	$(POST_PROCESS) ; $(STRIP_STABS)
 
+%.o : $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
 clean:
 	-$(RM) $(CLEANFILES)
 
--- a/usr/src/cmd/intrstat/intrstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/intrstat/intrstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -34,12 +34,21 @@
 #include <strings.h>
 #include <termio.h>
 #include <signal.h>
+#include <locale.h>
+
+#include "statcommon.h"
 
 #define	INTRSTAT_COLUMN_OFFS		14
 #define	INTRSTAT_COLUMNS_PER_CPU	15
 #define	INTRSTAT_CPUS_PER_LINE(w)	\
 	(((w) - INTRSTAT_COLUMN_OFFS) / INTRSTAT_COLUMNS_PER_CPU)
-#define	INTRSTAT_OPTSTR			"x:c:C:"
+#define	INTRSTAT_OPTSTR			"x:c:C:T:"
+
+static uint_t timestamp_fmt = NODATE;
+
+#if !defined(TEXT_DOMAIN)		/* Should be defined by cc -D */
+#define	TEXT_DOMAIN "SYS_TEST"		/* Use this only if it isn't */
+#endif
 
 static dtrace_hdl_t *g_dtp;
 static int *g_present;
@@ -78,7 +87,7 @@
 {
 	(void) fprintf(stderr,
 	    "usage:  intrstat [ -C psrset | -c cpulist ]  [-x opt[=val]] "
-	    "[interval [ count]]\n");
+	    "[-T d|u] [interval [ count]]\n");
 
 	exit(EXIT_FAILURE);
 }
@@ -358,6 +367,9 @@
 	hrtime_t last, now;
 	dtrace_optval_t statustime;
 
+	(void) setlocale(LC_ALL, "");
+	(void) textdomain(TEXT_DOMAIN);
+
 	(void) sigemptyset(&act.sa_mask);
 	act.sa_flags = 0;
 	act.sa_handler = set_width;
@@ -452,6 +464,19 @@
 			break;
 		}
 
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					usage();
+			} else {
+				usage();
+			}
+			break;
+
 		default:
 			if (strchr(INTRSTAT_OPTSTR, c) == NULL)
 				usage();
@@ -580,6 +605,9 @@
 
 		g_start = g_end = 0;
 
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
+
 		do {
 			g_header = 1;
 
--- a/usr/src/cmd/pools/poolstat/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/pools/poolstat/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -2,9 +2,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
 #
 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 # or http://www.opensolaris.org/os/licensing.
@@ -20,11 +19,9 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 # cmd/pools/poolstat/Makefile
 
 PROG =		poolstat
@@ -35,30 +32,40 @@
 include ../../Makefile.cmd
 include ../Makefile.pools
 
-CFLAGS +=	-I$(POOLSCOMMONDIR) $(EXTRA_CFLAGS)
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
+SRCS += $(STAT_COMMON_SRCS)
+
+CFLAGS +=	-I$(POOLSCOMMONDIR) -I$(STATCOMMONDIR) $(EXTRA_CFLAGS)
 sparc_COPTFLAG=
 LDLIBS +=	-lpool -lkstat
 XGETFLAGS =	-a
 CLOBBERFILES += $(POFILES) 
 
-lint := LINTFLAGS += -I$(POOLSCOMMONDIR)
+lint := LINTFLAGS += -I$(POOLSCOMMONDIR) -I$(STATCOMMONDIR)
 
 .KEEP_STATE:
 
 all: $(PROG)
 
-$(PROG): $(OBJS) $(COMMON_OBJS)
-	$(LINK.c) -o $@ $(OBJS) $(COMMON_OBJS) $(LDLIBS)
+$(PROG): $(OBJS) $(COMMON_OBJS) $(STAT_COMMON_OBJS)
+	$(LINK.c) -o $@ $(OBJS) $(COMMON_OBJS) $(STAT_COMMON_OBJS) $(LDLIBS)
 	$(POST_PROCESS)
 
 %.o : $(POOLSCOMMONDIR)/%.c
 	$(COMPILE.c) -o $@ $<
 	$(POST_PROCESS_O)
 
+%.o : $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
 install: all $(ROOTPROG)
 
 clean:
-	$(RM) $(OBJS) $(COMMON_OBJS) $(POFILES)
+	$(RM) $(OBJS) $(COMMON_OBJS) $(STAT_COMMON_OBJS) $(POFILES)
 
 lint: lint_SRCS
 
--- a/usr/src/cmd/pools/poolstat/poolstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/pools/poolstat/poolstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -40,6 +40,7 @@
 #include "utils.h"
 #include "poolstat.h"
 #include "poolstat_utils.h"
+#include "statcommon.h"
 
 #ifndef	TEXT_DOMAIN
 #define	TEXT_DOMAIN	"SYS_TEST"
@@ -55,6 +56,8 @@
 
 typedef int (* formatter) (char *, int, int, poolstat_field_format_t *, char *);
 
+static uint_t timestamp_fmt = NODATE;
+
 /* available field formatters	*/
 static int default_f(char *, int, int, poolstat_field_format_t *, char *);
 static int bigno_f(char *, int, int, poolstat_field_format_t *, char *);
@@ -163,8 +166,8 @@
 {
 	(void) fprintf(stderr, gettext(
 "Usage:\n"
-"poolstat [-p pool-list] [-r rset-list] [interval [count]]\n"
-"poolstat [-p pool-list] [-o format -r rset-list] [interval [count]]\n"
+"poolstat [-p pool-list] [-r rset-list] [-T d|u] [interval [count]]\n"
+"poolstat [-p pool-list] [-o format -r rset-list] [-T d|u] [interval [count]]\n"
 "  \'pool-list\' is a space-separated list of pool IDs or names\n"
 "  \'rset-list\' is \'all\' or \'pset\'\n"
 "  \'format\' for all resource types is one or more of:\n"
@@ -211,7 +214,7 @@
 	/* Don't let buffering interfere with piped output. */
 	(void) setvbuf(stdout, NULL, _IOLBF, 0);
 
-	while ((c = getopt(argc, argv, ":p:r:o:")) != EOF) {
+	while ((c = getopt(argc, argv, ":p:r:o:T:")) != EOF) {
 		switch (c) {
 		case 'p':	/* pool name specification	*/
 			pflag++;
@@ -230,6 +233,18 @@
 				usage();
 			break;
 			}
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					usage();
+			} else {
+					usage();
+			}
+			break;
 		case ':': {
 			(void) fprintf(stderr,
 			    gettext(ERR_OPTION_ARGS), optopt);
@@ -287,6 +302,8 @@
 	/* collect and print out statistics	*/
 	while (count-- != 0) {
 		sa_update(pool_sbag, SA_REFRESH);
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
 		if (pool_sbag->sb_changed & POU_POOL)
 				(void) printf(
 				"<<State change>>\n");
--- a/usr/src/cmd/rcap/rcapstat/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/rcap/rcapstat/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -19,10 +19,9 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
 
 .KEEP_STATE:
 .SUFFIXES:
@@ -34,19 +33,25 @@
 		utils.c
 
 LINTSRCS =	$(COMMON_DIR)/utils.c \
-		rcapstat.c
+		rcapstat.c \
+		$(STAT_COMMON_SRCS)
+
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
 
 $(NOT_RELEASE_BUILD)CPPFLAGS 	+= -DDEBUG
-CPPFLAGS 			+= -I$(COMMON_DIR)
+CPPFLAGS 			+= -I$(COMMON_DIR) -I$(STATCOMMONDIR)
 LDLIBS 				+= -lumem -lzonecfg -lscf
 LDFLAGS				+= $(MAPFILE.NGB:%=-M%)
 
 LINTFLAGS			+= $(LDLIBS) -mnu
 
 PROG =				rcapstat
-OBJS =				$(SRCS:%.c=%.o) rcapd_conf.o
+OBJS =				$(SRCS:%.c=%.o) rcapd_conf.o $(STAT_COMMON_OBJS)
 
-POFILES =			$(OBJS:%.o=%.po)
+POFILES =			$(OBJS:%.o=%.po) $(STAT_COMMON_OBJS:%.o=%.po)
 POFILE =			p$(PROG).po
 
 CLOBBERFILES += 		rcapd_conf.c $(POFILES) $(POFILE)
@@ -62,10 +67,17 @@
 	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
 	$(POST_PROCESS)
 
+%.o : $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
 $(POFILE): $(POFILES)
 	$(RM) $@
 	$(CAT) $(POFILES) > $@
 
+%.po: $(STATCOMMONDIR)/%.c
+	$(COMPILE.cpp) $< > $<.i
+	$(BUILD.po)
 
 clean:
 	$(RM) $(OBJS)
--- a/usr/src/cmd/rcap/rcapstat/rcapstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/rcap/rcapstat/rcapstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdlib.h>
@@ -40,6 +38,7 @@
 #include "rcapd.h"
 #include "utils.h"
 #include "rcapd_stat.h"
+#include "statcommon.h"
 
 static char mode[RC_MODE_LEN];
 static rcapd_stat_hdr_t hdr;
@@ -47,6 +46,8 @@
 static int unformatted;
 static time_t stat_mod = 0;
 
+static uint_t timestamp_fmt = NODATE;
+
 typedef struct col {
 	rcid_t		col_id;
 	char		col_name[LC_NAME_LEN];
@@ -119,7 +120,8 @@
 usage()
 {
 	(void) fprintf(stderr,
-	    gettext("usage: rcapstat [-g] [-p | -z] [interval [count]]\n"));
+	    gettext("usage: rcapstat [-g] [-p | -z] [-T d|u] "
+	    "[interval [count]]\n"));
 	exit(E_USAGE);
 }
 
@@ -366,7 +368,7 @@
 	(void) setprogname("rcapstat");
 
 	global = unformatted = 0;
-	while ((opt = getopt(argc, argv, "gpuz")) != (int)EOF) {
+	while ((opt = getopt(argc, argv, "gpuzT:")) != (int)EOF) {
 		switch (opt) {
 		case 'g':
 			global = 1;
@@ -382,6 +384,18 @@
 			stat_type = RCIDT_ZONE;
 			zones = 1;
 			break;
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					usage();
+			} else {
+				usage();
+			}
+			break;
 		default:
 			usage();
 		}
@@ -401,6 +415,8 @@
 	while (always || count-- > 0) {
 		if (read_stats(stat_type) != E_SUCCESS)
 			return (E_ERROR);
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
 		if (!unformatted) {
 			print_stats(stat_type);
 			(void) fflush(stdout);
--- a/usr/src/cmd/stat/Makefile.stat	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/stat/Makefile.stat	Wed Aug 05 20:39:41 2009 -0700
@@ -19,15 +19,14 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 # cmd/stat/Makefile.stat
 
 STATSRC = $(SRC)/cmd/stat
 STATCOMMONDIR = $(STATSRC)/common
 
-COMMON_OBJS = acquire.o walkers.o acquire_iodevs.o dsr.o mnt.o common.o
+COMMON_OBJS = acquire.o walkers.o acquire_iodevs.o dsr.o mnt.o common.o \
+	timestamp.o
 COMMON_SRCS = $(COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
--- a/usr/src/cmd/stat/common/common.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/stat/common/common.c	Wed Aug 05 20:39:41 2009 -0700
@@ -30,13 +30,10 @@
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
-#include <langinfo.h>
 
 extern char *cmdname;
 extern int caught_cont;
 
-uint_t timestamp_fmt = NODATE;
-
 /*PRINTFLIKE2*/
 void
 fail(int do_perror, char *message, ...)
@@ -128,29 +125,3 @@
 	(void) signal(sig_number, cont_handler);
 	caught_cont = 1;
 }
-
-/*
- * Print timestamp as decimal reprentation of time_t value (-T u was specified)
- * or in date(1) format (-T d was specified).
- */
-void
-print_timestamp(void)
-{
-	time_t t = time(NULL);
-	static char *fmt = NULL;
-
-	/* We only need to retrieve this once per invocation */
-	if (fmt == NULL)
-		fmt = nl_langinfo(_DATE_FMT);
-
-	if (timestamp_fmt == UDATE) {
-		(void) printf("%ld\n", t);
-	} else if (timestamp_fmt == DDATE) {
-		char dstr[64];
-		int len;
-
-		len = strftime(dstr, sizeof (dstr), fmt, localtime(&t));
-		if (len > 0)
-			(void) printf("%s\n", dstr);
-	}
-}
--- a/usr/src/cmd/stat/common/statcommon.h	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/stat/common/statcommon.h	Wed Aug 05 20:39:41 2009 -0700
@@ -324,7 +324,7 @@
 void cont_handler(int sig_number);
 
 /* Print a timestamp in either Unix or standard format. */
-void print_timestamp(void);
+void print_timestamp(uint_t);
 
 #ifdef __cplusplus
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/stat/common/timestamp.c	Wed Aug 05 20:39:41 2009 -0700
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include "statcommon.h"
+
+#include <langinfo.h>
+
+/*
+ * Print timestamp as decimal reprentation of time_t value (-T u was specified)
+ * or in date(1) format (-T d was specified).
+ */
+void
+print_timestamp(uint_t timestamp_fmt)
+{
+	time_t t = time(NULL);
+	static char *fmt = NULL;
+
+	/* We only need to retrieve this once per invocation */
+	if (fmt == NULL)
+		fmt = nl_langinfo(_DATE_FMT);
+
+	if (timestamp_fmt == UDATE) {
+		(void) printf("%ld\n", t);
+	} else if (timestamp_fmt == DDATE) {
+		char dstr[64];
+		int len;
+
+		len = strftime(dstr, sizeof (dstr), fmt, localtime(&t));
+		if (len > 0)
+			(void) printf("%s\n", dstr);
+	}
+}
--- a/usr/src/cmd/stat/fsstat/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/stat/fsstat/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -30,8 +30,7 @@
 include $(SRC)/cmd/Makefile.cmd
 include $(SRC)/cmd/stat/Makefile.stat
 
-# Only want one object
-COMMON_OBJS = common.o
+COMMON_OBJS = common.o timestamp.o
 COMMON_SRCS = $(COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
 
 LDLIBS += -lkstat
--- a/usr/src/cmd/stat/fsstat/fsstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/stat/fsstat/fsstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -117,7 +117,7 @@
 char		*cmdname;	/* name of this command */
 int		caught_cont = 0;	/* have caught a SIGCONT */
 
-extern uint_t	timestamp_fmt;	/* print timestamp with stats */
+static uint_t	timestamp_fmt = NODATE;	/* print timestamp with stats */
 
 static int	vs_i = 0;	/* Index of current vs[] slot */
 
@@ -1001,7 +1001,7 @@
 
 	/* Initial timestamp */
 	if (timestamp_fmt != NODATE) {
-		print_timestamp();
+		print_timestamp(timestamp_fmt);
 		linesout++;
 	}
 
@@ -1062,7 +1062,7 @@
 		sleep_until(&start_n, period_n, forever, &caught_cont);
 
 		if (timestamp_fmt != NODATE) {
-			print_timestamp();
+			print_timestamp(timestamp_fmt);
 			linesout++;
 		}
 
--- a/usr/src/cmd/stat/iostat/iostat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/stat/iostat/iostat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -126,7 +126,7 @@
 static	uint_t	do_megabytes;		/* display data in MB/sec (-M) */
 static  uint_t	do_controller;		/* display controller info (-C) */
 static  uint_t	do_raw;			/* emit raw format (-r) */
-extern	uint_t	timestamp_fmt;		/* timestamp  each display (-T) */
+static	uint_t	timestamp_fmt = NODATE;	/* timestamp  each display (-T) */
 static	uint_t	do_devid;		/* -E should show devid */
 
 /*
@@ -293,6 +293,10 @@
 		if (formatter_list) {
 			format_t *tmp;
 			tmp = formatter_list;
+
+			if (timestamp_fmt != NODATE)
+				print_timestamp(timestamp_fmt);
+
 			while (tmp) {
 				(tmp->nfunc)();
 				tmp = tmp->next;
@@ -1356,9 +1360,6 @@
 		dh_len = strlen(disk_header) - 2;
 	}
 
-	if (timestamp_fmt != NODATE)
-		setup(print_timestamp);
-
 	/*
 	 * -n *and* (-E *or* -e *or* -x)
 	 */
--- a/usr/src/cmd/stat/mpstat/mpstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/stat/mpstat/mpstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -53,7 +53,7 @@
 char *cmdname = "mpstat";
 int caught_cont = 0;
 
-extern uint_t timestamp_fmt;
+static uint_t timestamp_fmt = NODATE;
 
 static int hz;
 static int display_pset = -1;
@@ -490,7 +490,7 @@
 	snapshot_cb cb = compare_cpu;
 
 	if (timestamp_fmt != NODATE)
-		print_timestamp();
+		print_timestamp(timestamp_fmt);
 
 	if (lines_until_reprint == 0 || nr_active_cpus(new) > 1) {
 		print_header(display_agg, show_set);
--- a/usr/src/cmd/stat/vmstat/vmstat.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/stat/vmstat/vmstat.c	Wed Aug 05 20:39:41 2009 -0700
@@ -31,7 +31,7 @@
 char *cmdname = "vmstat";
 int caught_cont = 0;
 
-extern uint_t timestamp_fmt;
+static uint_t timestamp_fmt = NODATE;
 
 static	int	hz;
 static	int	pagesize;
@@ -279,7 +279,7 @@
 	updates = denom(DELTA(s_sys.ss_sysinfo.updates));
 
 	if (timestamp_fmt != NODATE) {
-		print_timestamp();
+		print_timestamp(timestamp_fmt);
 		lines--;
 	}
 
--- a/usr/src/cmd/zpool/Makefile	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/zpool/Makefile	Wed Aug 05 20:39:41 2009 -0700
@@ -19,11 +19,9 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 PROG= zpool
 OBJS= zpool_main.o zpool_vdev.o zpool_iter.o zpool_util.o
@@ -33,9 +31,17 @@
 
 include ../Makefile.cmd
 
+STATCOMMONDIR = $(SRC)/cmd/stat/common
+
+STAT_COMMON_OBJS = timestamp.o
+STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
+STAT_COMMON_POFILES = $(STAT_COMMON_OBJS:%.o=%.po)
+SRCS += $(STAT_COMMON_SRCS)
+POFILES += $(STAT_COMMON_POFILES)
+
 LDLIBS += -lzfs -lnvpair -ldevid -lefi -ldiskmgt -luutil -lumem
 
-INCS += -I../../common/zfs
+INCS += -I../../common/zfs -I$(STATCOMMONDIR)
 
 CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
 $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
@@ -50,16 +56,24 @@
 
 all: $(PROG)
 
-$(PROG): $(OBJS)
-	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
+$(PROG): $(OBJS) $(STAT_COMMON_OBJS)
+	$(LINK.c) -o $@ $(OBJS) $(STAT_COMMON_OBJS) $(LDLIBS)
 	$(POST_PROCESS)
 
+%.o:    $(STATCOMMONDIR)/%.c
+	$(COMPILE.c) $<
+	$(POST_PROCESS_O)
+
 install: all $(ROOTSBINPROG) $(ROOTUSRSBINLINKS)
 
 $(POFILE): $(POFILES)
 	$(RM) $@
 	$(CAT) $(POFILES) > $@
 
+%.po: $(STATCOMMONDIR)/%.c
+	$(COMPILE.cpp) $< > $<.i
+	$(BUILD.po)
+
 clean:
 	$(RM) $(OBJS)
 
--- a/usr/src/cmd/zpool/zpool_main.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/zpool/zpool_main.c	Wed Aug 05 20:39:41 2009 -0700
@@ -50,6 +50,8 @@
 #include "zpool_util.h"
 #include "zfs_comutil.h"
 
+#include "statcommon.h"
+
 static int zpool_do_create(int, char **);
 static int zpool_do_destroy(int, char **);
 
@@ -173,6 +175,8 @@
 zpool_command_t *current_command;
 static char history_str[HIS_MAX_RECORD_LEN];
 
+static uint_t timestamp_fmt = NODATE;
+
 static const char *
 get_usage(zpool_help_t idx) {
 	switch (idx) {
@@ -203,7 +207,7 @@
 		    "\t    [-d dir | -c cachefile] [-D] [-f] [-R root] "
 		    "<pool | id> [newpool]\n"));
 	case HELP_IOSTAT:
-		return (gettext("\tiostat [-v] [pool] ... [interval "
+		return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval "
 		    "[count]]\n"));
 	case HELP_LIST:
 		return (gettext("\tlist [-H] [-o property[,...]] "
@@ -2070,8 +2074,9 @@
 }
 
 /*
- * zpool iostat [-v] [pool] ... [interval [count]]
+ * zpool iostat [-T d|u] [-v] [pool] ... [interval [count]]
  *
+ *	-T	Display a timestamp in date(1) or Unix format
  *	-v	Display statistics for individual vdevs
  *
  * This command can be tricky because we want to be able to deal with pool
@@ -2092,8 +2097,20 @@
 	iostat_cbdata_t cb;
 
 	/* check options */
-	while ((c = getopt(argc, argv, "v")) != -1) {
+	while ((c = getopt(argc, argv, "T:v")) != -1) {
 		switch (c) {
+		case 'T':
+			if (optarg) {
+				if (*optarg == 'u')
+					timestamp_fmt = UDATE;
+				else if (*optarg == 'd')
+					timestamp_fmt = DDATE;
+				else
+					usage(B_FALSE);
+			} else {
+				usage(B_FALSE);
+			}
+			break;
 		case 'v':
 			verbose = B_TRUE;
 			break;
@@ -2210,6 +2227,9 @@
 		cb.cb_namewidth = 0;
 		(void) pool_list_iter(list, B_FALSE, get_namewidth, &cb);
 
+		if (timestamp_fmt != NODATE)
+			print_timestamp(timestamp_fmt);
+
 		/*
 		 * If it's the first time, or verbose mode, print the header.
 		 */
--- a/usr/src/cmd/zpool/zpool_util.c	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/zpool/zpool_util.c	Wed Aug 05 20:39:41 2009 -0700
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <errno.h>
 #include <libgen.h>
 #include <libintl.h>
@@ -54,7 +52,7 @@
  * Same as above, but for strdup()
  */
 char *
-safe_strdup(const char *str)
+zpool_safe_strdup(const char *str)
 {
 	char *ret;
 
--- a/usr/src/cmd/zpool/zpool_util.h	Wed Aug 05 17:14:23 2009 -0700
+++ b/usr/src/cmd/zpool/zpool_util.h	Wed Aug 05 20:39:41 2009 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -37,7 +37,7 @@
  * Basic utility functions
  */
 void *safe_malloc(size_t);
-char *safe_strdup(const char *);
+char *zpool_safe_strdup(const char *);
 void zpool_no_memory(void);
 uint_t num_logs(nvlist_t *nv);