svn commit: r211655 - in user/imp/tbemd/usr.bin: rwall script systat tar tcopy tftp truss unifdef vmstat wtmpcvt xlint/arch/powerpc64 xlint/lint1 ypwhich

Warner Losh imp at FreeBSD.org
Sun Aug 22 21:47:35 UTC 2010


Author: imp
Date: Sun Aug 22 21:47:34 2010
New Revision: 211655
URL: http://svn.freebsd.org/changeset/base/211655

Log:
  Merge to head @211636 -- with hand tweaks [given up] hoping for the best

Added:
  user/imp/tbemd/usr.bin/truss/powerpc64-fbsd.c
     - copied unchanged from r211636, head/usr.bin/truss/powerpc64-fbsd.c
  user/imp/tbemd/usr.bin/xlint/arch/powerpc64/
     - copied from r211636, head/usr.bin/xlint/arch/powerpc64/
Deleted:
  user/imp/tbemd/usr.bin/tftp/extern.h
  user/imp/tbemd/usr.bin/tftp/tftpsubs.c
  user/imp/tbemd/usr.bin/tftp/tftpsubs.h
Modified:
  user/imp/tbemd/usr.bin/rwall/rwall.1
  user/imp/tbemd/usr.bin/script/script.c
  user/imp/tbemd/usr.bin/systat/systat.1
  user/imp/tbemd/usr.bin/systat/vmstat.c
  user/imp/tbemd/usr.bin/tar/bsdtar.1
  user/imp/tbemd/usr.bin/tar/read.c
  user/imp/tbemd/usr.bin/tar/write.c
  user/imp/tbemd/usr.bin/tcopy/Makefile
  user/imp/tbemd/usr.bin/tcopy/tcopy.c
  user/imp/tbemd/usr.bin/tftp/tftp.c
  user/imp/tbemd/usr.bin/unifdef/unifdef.1
  user/imp/tbemd/usr.bin/vmstat/vmstat.c
  user/imp/tbemd/usr.bin/wtmpcvt/wtmpcvt.c
  user/imp/tbemd/usr.bin/xlint/lint1/mem1.c
  user/imp/tbemd/usr.bin/ypwhich/ypwhich.c

Modified: user/imp/tbemd/usr.bin/rwall/rwall.1
==============================================================================
--- user/imp/tbemd/usr.bin/rwall/rwall.1	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/rwall/rwall.1	Sun Aug 22 21:47:34 2010	(r211655)
@@ -66,7 +66,7 @@ daemon has terminated on the remote host
 .It rwall: RPC: Port mapper failure - RPC: Timed out
 The remote host is not running the portmapper (see
 .Xr rpcbind 8 ) ,
-and cannot accomodate any RPC-based services.
+and cannot accommodate any RPC-based services.
 The host may be down.
 .El
 .Sh SEE ALSO

Modified: user/imp/tbemd/usr.bin/script/script.c
==============================================================================
--- user/imp/tbemd/usr.bin/script/script.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/script/script.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -63,19 +63,18 @@ static const char sccsid[] = "@(#)script
 #include <termios.h>
 #include <unistd.h>
 
-FILE	*fscript;
-int	master, slave;
-int	child;
-const char *fname;
-int	qflg, ttyflg;
-
-struct	termios tt;
-
-void	done(int) __dead2;
-void	dooutput(void);
-void	doshell(char **);
-void	fail(void);
-void	finish(void);
+static FILE *fscript;
+static int master, slave;
+static int child;
+static const char *fname;
+static int qflg, ttyflg;
+
+static struct termios tt;
+
+static void done(int) __dead2;
+static void doshell(char **);
+static void fail(void);
+static void finish(void);
 static void usage(void);
 
 int
@@ -216,7 +215,7 @@ usage(void)
 	exit(1);
 }
 
-void
+static void
 finish(void)
 {
 	int e, status;
@@ -232,7 +231,7 @@ finish(void)
 	}
 }
 
-void
+static void
 doshell(char **av)
 {
 	const char *shell;
@@ -254,14 +253,14 @@ doshell(char **av)
 	fail();
 }
 
-void
+static void
 fail(void)
 {
 	(void)kill(0, SIGTERM);
 	done(1);
 }
 
-void
+static void
 done(int eno)
 {
 	time_t tvec;

Modified: user/imp/tbemd/usr.bin/systat/systat.1
==============================================================================
--- user/imp/tbemd/usr.bin/systat/systat.1	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/systat/systat.1	Sun Aug 22 21:47:34 2010	(r211655)
@@ -225,7 +225,7 @@ Like the
 display,
 except that it displays
 .Tn IPv6
-statics.
+statistics.
 It does not display
 .Tn UDP statistics.
 .It Ic tcp

Modified: user/imp/tbemd/usr.bin/systat/vmstat.c
==============================================================================
--- user/imp/tbemd/usr.bin/systat/vmstat.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/systat/vmstat.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -254,12 +254,15 @@ initkre(void)
 					cp1++;
 				if (cp1 != cp && *cp1 == ':' &&
 				    *(cp1 + 1) == ' ') {
+					sz = strlen(cp);
 					*cp1 = '\0';
 					cp1 = cp1 + 2;
 					cp2 = strdup(cp);
-					bcopy(cp1, cp, strlen(cp1) + 1);
-					strcat(cp, " ");
-					strcat(cp, cp2);
+					bcopy(cp1, cp, sz - (cp1 - cp) + 1);
+					if (sz <= 10 + 4) {
+						strcat(cp, " ");
+						strcat(cp, cp2 + 3);
+					}
 					free(cp2);
 				}
 			}

Modified: user/imp/tbemd/usr.bin/tar/bsdtar.1
==============================================================================
--- user/imp/tbemd/usr.bin/tar/bsdtar.1	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/tar/bsdtar.1	Sun Aug 22 21:47:34 2010	(r211655)
@@ -354,9 +354,9 @@ is run as non-root.
 .It Fl Fl numeric-owner
 This is equivalent to
 .Fl Fl uname
-.Qq
+.Qq \&
 .Fl Fl gname
-.Qq .
+.Qq \& .
 On extract, it causes user and group names in the archive
 to be ignored in favor of the numeric user and group ids.
 On create, it causes user and group names to not be stored
@@ -495,7 +495,7 @@ This option is provided as a performance
 Extract files as sparse files.
 For every block on disk, check first if it contains only NULL bytes and seek
 over it otherwise.
-This works similiar to the conv=sparse option of dd.
+This works similar to the conv=sparse option of dd.
 .It Fl Fl same-owner
 (x mode only)
 Extract owner and group IDs.

Modified: user/imp/tbemd/usr.bin/tar/read.c
==============================================================================
--- user/imp/tbemd/usr.bin/tar/read.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/tar/read.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -103,6 +103,7 @@ progress_func(void *cookie)
 	struct archive *a = progress_data->archive;
 	struct archive_entry *entry = progress_data->entry;
 	uint64_t comp, uncomp;
+	int compression;
 
 	if (!need_report())
 		return;
@@ -112,9 +113,13 @@ progress_func(void *cookie)
 	if (a != NULL) {
 		comp = archive_position_compressed(a);
 		uncomp = archive_position_uncompressed(a);
+		if (comp > uncomp)
+			compression = 0;
+		else
+			compression = (int)((uncomp - comp) * 100 / uncomp);
 		fprintf(stderr,
 		    "In: %s bytes, compression %d%%;",
-		    tar_i64toa(comp), (int)((uncomp - comp) * 100 / uncomp));
+		    tar_i64toa(comp), compression);
 		fprintf(stderr, "  Out: %d files, %s bytes\n",
 		    archive_file_count(a), tar_i64toa(uncomp));
 	}

Modified: user/imp/tbemd/usr.bin/tar/write.c
==============================================================================
--- user/imp/tbemd/usr.bin/tar/write.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/tar/write.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -965,15 +965,21 @@ report_write(struct bsdtar *bsdtar, stru
     struct archive_entry *entry, int64_t progress)
 {
 	uint64_t comp, uncomp;
+	int compression;
+
 	if (bsdtar->verbose)
 		fprintf(stderr, "\n");
 	comp = archive_position_compressed(a);
 	uncomp = archive_position_uncompressed(a);
 	fprintf(stderr, "In: %d files, %s bytes;",
 	    archive_file_count(a), tar_i64toa(uncomp));
+	if (comp > uncomp)
+		compression = 0;
+	else
+		compression = (int)((uncomp - comp) * 100 / uncomp);
 	fprintf(stderr,
 	    " Out: %s bytes, compression %d%%\n",
-	    tar_i64toa(comp), (int)((uncomp - comp) * 100 / uncomp));
+	    tar_i64toa(comp), compression);
 	/* Can't have two calls to tar_i64toa() pending, so split the output. */
 	safe_fprintf(stderr, "Current: %s (%s",
 	    archive_entry_pathname(entry),

Modified: user/imp/tbemd/usr.bin/tcopy/Makefile
==============================================================================
--- user/imp/tbemd/usr.bin/tcopy/Makefile	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/tcopy/Makefile	Sun Aug 22 21:47:34 2010	(r211655)
@@ -3,6 +3,4 @@
 
 PROG=	tcopy
 
-WARNS?=	1
-
 .include <bsd.prog.mk>

Modified: user/imp/tbemd/usr.bin/tcopy/tcopy.c
==============================================================================
--- user/imp/tbemd/usr.bin/tcopy/tcopy.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/tcopy/tcopy.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -87,6 +87,7 @@ main(int argc, char *argv[])
 
 	msg = stdout;
 	guesslen = 1;
+	outp = -1;
 	while ((ch = getopt(argc, argv, "cs:vx")) != -1)
 		switch((char)ch) {
 		case 'c':
@@ -157,16 +158,16 @@ main(int argc, char *argv[])
 				if (nread >= 0)
 					goto r1;
 			}
-			err(1, "read error, file %d, record %qu", filen, record);
+			err(1, "read error, file %d, record %ju", filen, (intmax_t)record);
 		} else if (nread != lastnread) {
 			if (lastnread != 0 && lastnread != NOCOUNT) {
 				if (lastrec == 0 && nread == 0)
-					fprintf(msg, "%qu records\n", record);
+					fprintf(msg, "%ju records\n", (intmax_t)record);
 				else if (record - lastrec > 1)
-					fprintf(msg, "records %qu to %qu\n",
-					    lastrec, record);
+					fprintf(msg, "records %ju to %ju\n",
+					    (intmax_t)lastrec, (intmax_t)record);
 				else
-					fprintf(msg, "record %qu\n", lastrec);
+					fprintf(msg, "record %ju\n", (intmax_t)lastrec);
 			}
 			if (nread != 0)
 				fprintf(msg, "file %d: block size %d: ",
@@ -184,10 +185,12 @@ r1:		guesslen = 0;
 				nw = write(outp, buff, nread);
 				if (nw != nread) {
 					if (nw == -1) {
-					warn("write error, file %d, record %qu", filen, record);
+						warn("write error, file %d, record %ju", filen,
+						    (intmax_t)record);
 					} else {
-					warnx("write error, file %d, record %qu", filen, record);
-					warnx("write (%d) != read (%d)", nw, nread);
+						warnx("write error, file %d, record %ju", filen,
+						    (intmax_t)record);
+						warnx("write (%d) != read (%d)", nw, nread);
 					}
 					errx(5, "copy aborted");
 				}
@@ -200,8 +203,8 @@ r1:		guesslen = 0;
 				break;
 			}
 			fprintf(msg,
-			    "file %d: eof after %qu records: %qu bytes\n",
-			    filen, record, size);
+			    "file %d: eof after %ju records: %ju bytes\n",
+			    filen, (intmax_t)record, (intmax_t)size);
 			needeof = 1;
 			filen++;
 			tsize += size;
@@ -210,7 +213,7 @@ r1:		guesslen = 0;
 		}
 		lastnread = nread;
 	}
-	fprintf(msg, "total length: %qu bytes\n", tsize);
+	fprintf(msg, "total length: %ju bytes\n", (intmax_t)tsize);
 	(void)signal(SIGINT, oldsig);
 	if (op == COPY || op == COPYVERIFY) {
 		writeop(outp, MTWEOF);
@@ -281,11 +284,11 @@ intr(int signo __unused)
 {
 	if (record) {
 		if (record - lastrec > 1)
-			fprintf(msg, "records %qu to %qu\n", lastrec, record);
+			fprintf(msg, "records %ju to %ju\n", (intmax_t)lastrec, (intmax_t)record);
 		else
-			fprintf(msg, "record %qu\n", lastrec);
+			fprintf(msg, "record %ju\n", (intmax_t)lastrec);
 	}
-	fprintf(msg, "interrupt at file %d: record %qu\n", filen, record);
+	fprintf(msg, "interrupt at file %d: record %ju\n", filen, (intmax_t)record);
 	fprintf(msg, "total length: %ju bytes\n", (uintmax_t)(tsize + size));
 	exit(1);
 }

Modified: user/imp/tbemd/usr.bin/tftp/tftp.c
==============================================================================
--- user/imp/tbemd/usr.bin/tftp/tftp.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/tftp/tftp.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -75,7 +75,6 @@ xmitfile(int peer, char *port, int fd, c
 	struct tftphdr *rp;
 	int n, i;
 	uint16_t block;
-	uint32_t amount;
 	struct sockaddr_storage serv;	/* valid server port number */
 	char recvbuffer[MAXPKTSIZE];
 	struct tftp_stats tftp_stats;
@@ -162,7 +161,7 @@ xmitfile(int peer, char *port, int fd, c
 	tftp_send(peer, &block, &tftp_stats);
 
 	read_close();
-	if (amount > 0)
+	if (tftp_stats.amount > 0)
 		printstats("Sent", verbose, &tftp_stats);
 
 	txrx_error = 1;
@@ -229,7 +228,10 @@ recvfile(int peer, char *port, int fd, c
 		/* Otherwise it is a fatal error */
 		break;
 	}
-
+	if (i == 12) {
+		printf("Transfer timed out.\n");
+		return;
+	}
 	if (rp->th_opcode == ERROR) {
 		tftp_log(LOG_ERR, "Error code %d: %s", rp->th_code, rp->th_msg);
 		return;
@@ -240,8 +242,6 @@ recvfile(int peer, char *port, int fd, c
 		return;
 	}
 
-	stats_init(&tftp_stats);
-
 	/*
 	 * If the first packet is an OACK packet instead of an DATA packet,
 	 * handle it different.

Copied: user/imp/tbemd/usr.bin/truss/powerpc64-fbsd.c (from r211636, head/usr.bin/truss/powerpc64-fbsd.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/imp/tbemd/usr.bin/truss/powerpc64-fbsd.c	Sun Aug 22 21:47:34 2010	(r211655, copy of r211636, head/usr.bin/truss/powerpc64-fbsd.c)
@@ -0,0 +1,323 @@
+/*
+ * Copyright 2006 Peter Grehan <grehan at freebsd.org>
+ * Copyright 2005 Orlando Bassotto <orlando at break.net>
+ * Copyright 1998 Sean Eric Fagan
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static const char rcsid[] =
+  "$FreeBSD$";
+#endif /* not lint */
+
+/*
+ * FreeBSD/powerpc-specific system call handling.  This is probably the most
+ * complex part of the entire truss program, although I've got lots of
+ * it handled relatively cleanly now.  The system call names are generated
+ * automatically, thanks to /usr/src/sys/kern/syscalls.master.  The
+ * names used for the various structures are confusing, I sadly admit.
+ *
+ * This file is almost nothing more than a slightly-edited i386-fbsd.c.
+ */
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
+#include <machine/reg.h>
+#include <machine/frame.h>
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "truss.h"
+#include "syscall.h"
+#include "extern.h"
+
+static int cpid = -1;
+
+#include "syscalls.h"
+
+static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
+
+/*
+ * This is what this particular file uses to keep track of a system call.
+ * It is probably not quite sufficient -- I can probably use the same
+ * structure for the various syscall personalities, and I also probably
+ * need to nest system calls (for signal handlers).
+ *
+ * 'struct syscall' describes the system call; it may be NULL, however,
+ * if we don't know about this particular system call yet.
+ */
+static struct freebsd_syscall {
+	struct syscall *sc;
+	const char *name;
+	int number;
+	unsigned long *args;
+	int nargs;	/* number of arguments -- *not* number of words! */
+	char **s_args;	/* the printable arguments */
+} fsc;
+
+/* Clear up and free parts of the fsc structure. */
+static __inline void
+clear_fsc(void) {
+  if (fsc.args) {
+    free(fsc.args);
+  }
+  if (fsc.s_args) {
+    int i;
+    for (i = 0; i < fsc.nargs; i++)
+      if (fsc.s_args[i])
+	free(fsc.s_args[i]);
+    free(fsc.s_args);
+  }
+  memset(&fsc, 0, sizeof(fsc));
+}
+
+/*
+ * Called when a process has entered a system call.  nargs is the
+ * number of words, not number of arguments (a necessary distinction
+ * in some cases).  Note that if the STOPEVENT() code in powerpc/powerpc/trap.c
+ * is ever changed these functions need to keep up.
+ */
+
+void
+powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs) {
+  char buf[32];
+  struct reg regs;
+  void *args;
+  int syscall_num;
+  int i;
+  unsigned int regargs;
+  struct syscall *sc;
+
+  cpid = trussinfo->curthread->tid;
+
+  clear_fsc();
+  if (ptrace(PT_GETREGS, cpid, (caddr_t)&regs, 0) < 0) {
+    fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+    return;
+  }
+
+  /*
+   * FreeBSD has two special kinds of system call redirctions --
+   * SYS_syscall, and SYS___syscall.  The former is the old syscall()
+   * routine, basicly; the latter is for quad-aligned arguments.
+   */
+  regargs = NARGREG;
+  syscall_num = regs.fixreg[0];
+  args = &regs.fixreg[3];
+  if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) {
+    args = &regs.fixreg[4];
+    regargs -= 1;
+    syscall_num = regs.fixreg[3];
+  }
+
+  fsc.number = syscall_num;
+  fsc.name =
+    (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
+  if (!fsc.name) {
+    fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
+  }
+
+  if (fsc.name && (trussinfo->flags & FOLLOWFORKS)
+   && ((!strcmp(fsc.name, "fork")
+    || !strcmp(fsc.name, "rfork")
+    || !strcmp(fsc.name, "vfork"))))
+  {
+    trussinfo->curthread->in_fork = 1;
+  }
+
+  if (nargs == 0)
+    return;
+
+  fsc.args = malloc((1+nargs) * sizeof(unsigned long));
+
+  if (nargs > regargs) {
+    struct ptrace_io_desc iorequest;
+    memmove(&fsc.args[0], args, regargs * sizeof(fsc.args[0]));
+
+    iorequest.piod_op = PIOD_READ_D;
+    iorequest.piod_offs = (void *)(regs.fixreg[1] + 48);
+    iorequest.piod_addr = &fsc.args[regargs];
+    iorequest.piod_len = (nargs - regargs) * sizeof(fsc.args[0]);
+    ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
+    if (iorequest.piod_len == 0)
+       return;
+  } else {
+    memmove(&fsc.args[0], args, nargs * sizeof(fsc.args[0]));
+  }
+
+  sc = get_syscall(fsc.name);
+  if (sc) {
+    fsc.nargs = sc->nargs;
+  } else {
+#if DEBUG
+    fprintf(trussinfo->outfile, "unknown syscall %s -- setting args to %d\n",
+	   fsc.name, nargs);
+#endif
+    fsc.nargs = nargs;
+  }
+
+  fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*));
+  fsc.sc = sc;
+
+  /*
+   * At this point, we set up the system call arguments.
+   * We ignore any OUT ones, however -- those are arguments that
+   * are set by the system call, and so are probably meaningless
+   * now.  This doesn't currently support arguments that are
+   * passed in *and* out, however.
+   */
+
+  if (fsc.name) {
+
+#if DEBUG
+    fprintf(stderr, "syscall %s(", fsc.name);
+#endif
+    for (i = 0; i < fsc.nargs; i++) {
+#if DEBUG
+      fprintf(stderr, "0x%x%s",
+	      sc
+	      ? fsc.args[sc->args[i].offset]
+	      : fsc.args[i],
+	      i < (fsc.nargs - 1) ? "," : "");
+#endif
+      if (sc && !(sc->args[i].type & OUT)) {
+	fsc.s_args[i] = print_arg(&sc->args[i], fsc.args, 0, trussinfo);
+      }
+    }
+#if DEBUG
+    fprintf(stderr, ")\n");
+#endif
+  }
+
+#if DEBUG
+  fprintf(trussinfo->outfile, "\n");
+#endif
+
+  if (fsc.name && (!strcmp(fsc.name, "execve") || !strcmp(fsc.name, "exit"))) {
+
+    /* XXX
+     * This could be done in a more general
+     * manner but it still wouldn't be very pretty.
+     */
+    if (!strcmp(fsc.name, "execve")) {
+        if ((trussinfo->flags & EXECVEARGS) == 0)
+          if (fsc.s_args[1]) {
+            free(fsc.s_args[1]);
+            fsc.s_args[1] = NULL;
+          }
+        if ((trussinfo->flags & EXECVEENVS) == 0)
+          if (fsc.s_args[2]) {
+            free(fsc.s_args[2]);
+            fsc.s_args[2] = NULL;
+          }
+    }
+  }
+
+  return;
+}
+
+/*
+ * And when the system call is done, we handle it here.
+ * Currently, no attempt is made to ensure that the system calls
+ * match -- this needs to be fixed (and is, in fact, why S_SCX includes
+ * the sytem call number instead of, say, an error status).
+ */
+
+long
+powerpc_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
+{
+  struct reg regs;
+  long retval;
+  int i;
+  int errorp;
+  struct syscall *sc;
+
+  if (fsc.name == NULL)
+	return (-1);
+
+  cpid = trussinfo->curthread->tid;
+
+  if (ptrace(PT_GETREGS, cpid, (caddr_t)&regs, 0) < 0) {
+    fprintf(trussinfo->outfile, "\n");
+    return (-1);
+  }
+  retval = regs.fixreg[3];
+  errorp = !!(regs.cr & 0x10000000);
+
+  /*
+   * This code, while simpler than the initial versions I used, could
+   * stand some significant cleaning.
+   */
+
+  sc = fsc.sc;
+  if (!sc) {
+    for (i = 0; i < fsc.nargs; i++)
+      asprintf(&fsc.s_args[i], "0x%lx", fsc.args[i]);
+  } else {
+    /*
+     * Here, we only look for arguments that have OUT masked in --
+     * otherwise, they were handled in the syscall_entry function.
+     */
+    for (i = 0; i < sc->nargs; i++) {
+      char *temp;
+      if (sc->args[i].type & OUT) {
+	/*
+	 * If an error occurred, than don't bothe getting the data;
+	 * it may not be valid.
+	 */
+	if (errorp)
+	  asprintf(&temp, "0x%lx", fsc.args[sc->args[i].offset]);
+	else
+	  temp = print_arg(&sc->args[i], fsc.args, retval, trussinfo);
+	fsc.s_args[i] = temp;
+      }
+    }
+  }
+
+  if (fsc.name != NULL &&
+      (!strcmp(fsc.name, "execve") || !strcmp(fsc.name, "exit"))) {
+	trussinfo->curthread->in_syscall = 1;
+  }
+
+
+  /*
+   * It would probably be a good idea to merge the error handling,
+   * but that complicates things considerably.
+   */
+
+  print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp,
+		    retval, fsc.sc);
+  clear_fsc();
+
+  return (retval);
+}

Modified: user/imp/tbemd/usr.bin/unifdef/unifdef.1
==============================================================================
--- user/imp/tbemd/usr.bin/unifdef/unifdef.1	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/unifdef/unifdef.1	Sun Aug 22 21:47:34 2010	(r211655)
@@ -206,7 +206,7 @@ i.e., the lines that would have been rem
 are retained and vice versa.
 .Pp
 .It Fl d
-Turn on printing of degugging messages.
+Turn on printing of debugging messages.
 .Pp
 .It Fl e
 Because

Modified: user/imp/tbemd/usr.bin/vmstat/vmstat.c
==============================================================================
--- user/imp/tbemd/usr.bin/vmstat/vmstat.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/vmstat/vmstat.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -1294,16 +1294,17 @@ domemstat_zone(void)
 				    memstat_strerror(error));
 		}
 	}
-	printf("%-20s %8s  %8s  %8s  %8s  %8s  %8s\n\n", "ITEM", "SIZE",
-	    "LIMIT", "USED", "FREE", "REQUESTS", "FAILURES");
+	printf("%-20s %6s %6s %8s %8s %8s %4s %4s\n\n", "ITEM", "SIZE",
+	    "LIMIT", "USED", "FREE", "REQ", "FAIL", "SLEEP");
 	for (mtp = memstat_mtl_first(mtlp); mtp != NULL;
 	    mtp = memstat_mtl_next(mtp)) {
 		strlcpy(name, memstat_get_name(mtp), MEMTYPE_MAXNAME);
 		strcat(name, ":");
-		printf("%-20s %8llu, %8llu, %8llu, %8llu, %8llu, %8llu\n", name,
+		printf("%-20s %6llu, %6llu,%8llu,%8llu,%8llu,%4llu,%4llu\n",name,
 		    memstat_get_size(mtp), memstat_get_countlimit(mtp),
 		    memstat_get_count(mtp), memstat_get_free(mtp),
-		    memstat_get_numallocs(mtp), memstat_get_failures(mtp));
+		    memstat_get_numallocs(mtp), memstat_get_failures(mtp),
+		    memstat_get_sleeps(mtp));
 	}
 	memstat_mtl_free(mtlp);
 	printf("\n");

Modified: user/imp/tbemd/usr.bin/wtmpcvt/wtmpcvt.c
==============================================================================
--- user/imp/tbemd/usr.bin/wtmpcvt/wtmpcvt.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/wtmpcvt/wtmpcvt.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -113,10 +113,10 @@ main(int argc, char *argv[])
 	/* Open files. */
 	in = fopen(argv[1], "r");
 	if (in == NULL)
-		err(1, argv[1]);
+		err(1, "%s", argv[1]);
 	out = fopen(argv[2], "w");
 	if (out == NULL)
-		err(1, argv[2]);
+		err(1, "%s", argv[2]);
 
 	/* Process entries. */
 	while (fread(&ui, sizeof ui, 1, in) == 1) {

Modified: user/imp/tbemd/usr.bin/xlint/lint1/mem1.c
==============================================================================
--- user/imp/tbemd/usr.bin/xlint/lint1/mem1.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/xlint/lint1/mem1.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -218,7 +218,7 @@ xgetblk(mbl_t **mbp, size_t s)
 			frmblks = mb->nxt;
 		}
 		mb->ffree = mb->blk;
-		mb->nfree = mb->size;;
+		mb->nfree = mb->size;
 		mb->nxt = *mbp;
 		*mbp = mb;
 	}

Modified: user/imp/tbemd/usr.bin/ypwhich/ypwhich.c
==============================================================================
--- user/imp/tbemd/usr.bin/ypwhich/ypwhich.c	Sun Aug 22 21:47:19 2010	(r211654)
+++ user/imp/tbemd/usr.bin/ypwhich/ypwhich.c	Sun Aug 22 21:47:34 2010	(r211655)
@@ -143,11 +143,11 @@ main(int argc, char *argv[])
 	struct ypmaplist *ypml, *y;
 	struct hostent *hent;
 	struct sockaddr_in lsin;
-	int notrans, mode, getmap;
+	int notrans, mode;
 	int c, r;
 	u_int i;
 
-	getmap = notrans = mode = 0;
+	notrans = mode = 0;
 	while ((c = getopt(argc, argv, "xd:mt")) != -1)
 		switch (c) {
 		case 'x':


More information about the svn-src-user mailing list