summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/Makefile47
-rw-r--r--usr.bin/Makefile.amd645
-rw-r--r--usr.bin/Makefile.i3865
-rw-r--r--usr.bin/Makefile.ia641
-rw-r--r--usr.bin/Makefile.powerpc1
-rw-r--r--usr.bin/Makefile.sparc641
-rw-r--r--usr.bin/ar/ar.h2
-rw-r--r--usr.bin/at/parsetime.c62
-rw-r--r--usr.bin/at/privs.h32
-rw-r--r--usr.bin/atf/Makefile34
-rw-r--r--usr.bin/atf/Makefile.inc8
-rw-r--r--usr.bin/atf/atf-config/Makefile42
-rw-r--r--usr.bin/atf/atf-report/Makefile42
-rw-r--r--usr.bin/atf/atf-run/Makefile44
-rw-r--r--usr.bin/atf/atf-sh/Makefile47
-rw-r--r--usr.bin/atf/atf-version/Makefile52
-rw-r--r--usr.bin/bmake/Makefile212
-rw-r--r--usr.bin/bmake/Makefile.inc14
-rw-r--r--usr.bin/bmake/config.h316
-rw-r--r--usr.bin/bmake/unit-tests/Makefile103
-rw-r--r--usr.bin/calendar/calendar.12
-rw-r--r--usr.bin/calendar/calendar.c4
-rw-r--r--usr.bin/calendar/calendars/calendar.freebsd6
-rw-r--r--usr.bin/calendar/dates.c11
-rw-r--r--usr.bin/calendar/day.c2
-rw-r--r--usr.bin/calendar/io.c6
-rw-r--r--usr.bin/chat/chat.8733
-rw-r--r--usr.bin/chat/chat.c53
-rw-r--r--usr.bin/cksum/extern.h3
-rw-r--r--usr.bin/clang/Makefile4
-rw-r--r--usr.bin/clang/bugpoint/bugpoint.1511
-rw-r--r--usr.bin/clang/clang-tblgen/Makefile3
-rw-r--r--usr.bin/clang/clang.prog.mk8
-rw-r--r--usr.bin/clang/clang/Makefile18
-rw-r--r--usr.bin/clang/clang/clang.111
-rw-r--r--usr.bin/clang/llc/Makefile17
-rw-r--r--usr.bin/clang/llc/llc.1483
-rw-r--r--usr.bin/clang/lli/lli.1572
-rw-r--r--usr.bin/clang/llvm-ar/llvm-ar.1791
-rw-r--r--usr.bin/clang/llvm-as/llvm-as.1245
-rw-r--r--usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1675
-rw-r--r--usr.bin/clang/llvm-diff/llvm-diff.1208
-rw-r--r--usr.bin/clang/llvm-dis/Makefile1
-rw-r--r--usr.bin/clang/llvm-dis/llvm-dis.1241
-rw-r--r--usr.bin/clang/llvm-extract/Makefile2
-rw-r--r--usr.bin/clang/llvm-extract/llvm-extract.1293
-rw-r--r--usr.bin/clang/llvm-ld/Makefile27
-rw-r--r--usr.bin/clang/llvm-ld/llvm-ld.1319
-rw-r--r--usr.bin/clang/llvm-link/Makefile1
-rw-r--r--usr.bin/clang/llvm-link/llvm-link.1281
-rw-r--r--usr.bin/clang/llvm-mc/Makefile17
-rw-r--r--usr.bin/clang/llvm-nm/llvm-nm.1398
-rw-r--r--usr.bin/clang/llvm-objdump/Makefile20
-rw-r--r--usr.bin/clang/llvm-prof/Makefile1
-rw-r--r--usr.bin/clang/llvm-prof/llvm-prof.1225
-rw-r--r--usr.bin/clang/llvm-ranlib/llvm-ranlib.1235
-rw-r--r--usr.bin/clang/llvm-rtdyld/Makefile18
-rw-r--r--usr.bin/clang/llvm-stub/Makefile9
-rw-r--r--usr.bin/clang/opt/opt.1409
-rw-r--r--usr.bin/clang/tblgen/Makefile5
-rw-r--r--usr.bin/clang/tblgen/tblgen.1413
-rw-r--r--usr.bin/cpio/Makefile4
-rw-r--r--usr.bin/cpio/test/Makefile11
-rw-r--r--usr.bin/csup/lister.c2
-rw-r--r--usr.bin/csup/proto.c16
-rw-r--r--usr.bin/ctlstat/ctlstat.c2
-rw-r--r--usr.bin/cut/cut.110
-rw-r--r--usr.bin/cut/cut.c6
-rw-r--r--usr.bin/du/du.114
-rw-r--r--usr.bin/du/du.c8
-rw-r--r--usr.bin/elfdump/elfdump.c111
-rw-r--r--usr.bin/fetch/Makefile7
-rw-r--r--usr.bin/fetch/fetch.c82
-rw-r--r--usr.bin/find/extern.h4
-rw-r--r--usr.bin/find/find.176
-rw-r--r--usr.bin/find/find.c8
-rw-r--r--usr.bin/find/function.c19
-rw-r--r--usr.bin/find/ls.c2
-rw-r--r--usr.bin/find/main.c3
-rw-r--r--usr.bin/find/option.c4
-rw-r--r--usr.bin/finger/finger.12
-rw-r--r--usr.bin/finger/finger.c3
-rw-r--r--usr.bin/gencat/gencat.c2
-rw-r--r--usr.bin/getent/getent.c34
-rw-r--r--usr.bin/grep/grep.c7
-rw-r--r--usr.bin/grep/regex/xmalloc.c4
-rw-r--r--usr.bin/gzip/zmore.12
-rw-r--r--usr.bin/gzip/zuncompress.c7
-rw-r--r--usr.bin/kdump/kdump.16
-rw-r--r--usr.bin/kdump/kdump.c22
-rw-r--r--usr.bin/kdump/mksubr50
-rw-r--r--usr.bin/killall/killall.16
-rw-r--r--usr.bin/killall/killall.c40
-rw-r--r--usr.bin/ktrdump/ktrdump.c4
-rw-r--r--usr.bin/last/last.12
-rw-r--r--usr.bin/last/last.c20
-rw-r--r--usr.bin/less/defines.h12
-rw-r--r--usr.bin/lex/NEWS2
-rw-r--r--usr.bin/lock/lock.c37
-rw-r--r--usr.bin/logger/logger.c6
-rw-r--r--usr.bin/login/login.12
-rw-r--r--usr.bin/m4/Makefile2
-rw-r--r--usr.bin/m4/expr.c2
-rw-r--r--usr.bin/m4/extern.h1
-rw-r--r--usr.bin/m4/gnum4.c2
-rw-r--r--usr.bin/m4/lib/ohash_init.32
-rw-r--r--usr.bin/m4/m4.12
-rw-r--r--usr.bin/m4/main.c2
-rw-r--r--usr.bin/m4/parser.y9
-rw-r--r--usr.bin/mail/util.c2
-rw-r--r--usr.bin/make/var.c3
-rw-r--r--usr.bin/makewhatis/makewhatis.c2
-rw-r--r--usr.bin/man/man.conf.57
-rw-r--r--usr.bin/mandoc/Makefile22
-rw-r--r--usr.bin/minigzip/Makefile2
-rw-r--r--usr.bin/mkcsmapper/lex.l3
-rw-r--r--usr.bin/mkesdb/ldef.h1
-rw-r--r--usr.bin/mkesdb/lex.l3
-rw-r--r--usr.bin/mktemp/mktemp.18
-rw-r--r--usr.bin/mktemp/mktemp.c7
-rw-r--r--usr.bin/msgs/msgs.c83
-rw-r--r--usr.bin/ncal/ncal.c172
-rw-r--r--usr.bin/ncplist/ncplist.12
-rw-r--r--usr.bin/netstat/Makefile4
-rw-r--r--usr.bin/netstat/if.c37
-rw-r--r--usr.bin/netstat/inet.c5
-rw-r--r--usr.bin/netstat/mbuf.c22
-rw-r--r--usr.bin/netstat/route.c2
-rw-r--r--usr.bin/netstat/sctp.c4
-rw-r--r--usr.bin/nfsstat/nfsstat.c3
-rw-r--r--usr.bin/passwd/passwd.12
-rw-r--r--usr.bin/printf/printf.c14
-rw-r--r--usr.bin/procstat/procstat.18
-rw-r--r--usr.bin/procstat/procstat_auxv.c6
-rw-r--r--usr.bin/procstat/procstat_files.c1
-rw-r--r--usr.bin/procstat/procstat_rlimit.c4
-rw-r--r--usr.bin/procstat/procstat_vm.c6
-rw-r--r--usr.bin/rctl/rctl.814
-rw-r--r--usr.bin/rlogin/rlogin.12
-rw-r--r--usr.bin/rlogin/rlogin.c98
-rw-r--r--usr.bin/rpcgen/rpc_main.c2
-rw-r--r--usr.bin/rpcgen/rpc_svcout.c2
-rw-r--r--usr.bin/rpcgen/rpc_util.c4
-rw-r--r--usr.bin/rpcinfo/rpcinfo.c16
-rw-r--r--usr.bin/rsh/rsh.12
-rw-r--r--usr.bin/script/script.134
-rw-r--r--usr.bin/script/script.c266
-rw-r--r--usr.bin/sockstat/sockstat.c3
-rw-r--r--usr.bin/sort/Makefile14
-rw-r--r--usr.bin/sort/bwstring.c32
-rw-r--r--usr.bin/sort/bwstring.h2
-rw-r--r--usr.bin/sort/coll.c49
-rw-r--r--usr.bin/sort/coll.h10
-rw-r--r--usr.bin/sort/file.c66
-rw-r--r--usr.bin/sort/file.h7
-rw-r--r--usr.bin/sort/radixsort.c14
-rw-r--r--usr.bin/sort/sort.1.in8
-rw-r--r--usr.bin/sort/sort.c18
-rw-r--r--usr.bin/sort/sort.h4
-rw-r--r--usr.bin/ssh-copy-id/Makefile6
-rw-r--r--usr.bin/ssh-copy-id/ssh-copy-id.180
-rwxr-xr-xusr.bin/ssh-copy-id/ssh-copy-id.sh105
-rw-r--r--usr.bin/stat/stat.c4
-rw-r--r--usr.bin/stdbuf/Makefile2
-rw-r--r--usr.bin/systat/cmds.c39
-rw-r--r--usr.bin/systat/extern.h5
-rw-r--r--usr.bin/systat/icmp.c2
-rw-r--r--usr.bin/systat/icmp6.c2
-rw-r--r--usr.bin/systat/ifstat.c3
-rw-r--r--usr.bin/systat/ip.c2
-rw-r--r--usr.bin/systat/ip6.c2
-rw-r--r--usr.bin/systat/keyboard.c184
-rw-r--r--usr.bin/systat/main.c15
-rw-r--r--usr.bin/systat/systat.13
-rw-r--r--usr.bin/systat/tcp.c2
-rw-r--r--usr.bin/talk/talk.12
-rw-r--r--usr.bin/tar/Makefile8
-rw-r--r--usr.bin/tar/test/Makefile8
-rw-r--r--usr.bin/tftp/main.c4
-rw-r--r--usr.bin/time/time.c6
-rw-r--r--usr.bin/top/machine.c84
-rw-r--r--usr.bin/top/top.local.125
-rw-r--r--usr.bin/touch/touch.142
-rw-r--r--usr.bin/touch/touch.c58
-rw-r--r--usr.bin/truss/amd64-fbsd.c418
-rw-r--r--usr.bin/truss/amd64-fbsd32.c420
-rw-r--r--usr.bin/truss/amd64-linux32.c396
-rw-r--r--usr.bin/truss/extern.h2
-rw-r--r--usr.bin/truss/i386-fbsd.c407
-rw-r--r--usr.bin/truss/i386-linux.c393
-rw-r--r--usr.bin/truss/ia64-fbsd.c367
-rw-r--r--usr.bin/truss/main.c78
-rw-r--r--usr.bin/truss/mips-fbsd.c449
-rw-r--r--usr.bin/truss/powerpc-fbsd.c438
-rw-r--r--usr.bin/truss/powerpc64-fbsd.c406
-rw-r--r--usr.bin/truss/setup.c91
-rw-r--r--usr.bin/truss/sparc64-fbsd.c443
-rw-r--r--usr.bin/truss/syscall.h6
-rw-r--r--usr.bin/truss/syscalls.c257
-rw-r--r--usr.bin/truss/truss.h40
-rw-r--r--usr.bin/tset/extern.h3
-rw-r--r--usr.bin/tset/map.c9
-rw-r--r--usr.bin/tset/term.c2
-rw-r--r--usr.bin/unzip/unzip.12
-rw-r--r--usr.bin/usbhidctl/usbhidctl.12
-rw-r--r--usr.bin/users/users.12
-rw-r--r--usr.bin/uuencode/uuencode.12
-rw-r--r--usr.bin/w/w.12
-rw-r--r--usr.bin/w/w.c2
-rw-r--r--usr.bin/wall/wall.c3
-rw-r--r--usr.bin/who/who.12
-rw-r--r--usr.bin/xinstall/xinstall.c25
-rw-r--r--usr.bin/xlint/Makefile.inc2
-rw-r--r--usr.bin/xlint/lint1/makeman7
-rw-r--r--usr.bin/yes/yes.12
215 files changed, 8379 insertions, 7126 deletions
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 6f60756..17aafa8 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -12,6 +12,7 @@
SUBDIR= alias \
apply \
asa \
+ ${_atf} \
awk \
banner \
basename \
@@ -68,7 +69,7 @@ SUBDIR= alias \
ipcs \
join \
jot \
- kdump \
+ ${_kdump} \
keylogin \
keylogout \
killall \
@@ -96,6 +97,7 @@ SUBDIR= alias \
m4 \
${_makewhatis} \
${_man} \
+ mandoc \
mesg \
minigzip \
ministat \
@@ -144,6 +146,7 @@ SUBDIR= alias \
sockstat \
sort \
split \
+ ssh-copy-id \
stat \
stdbuf \
su \
@@ -163,7 +166,7 @@ SUBDIR= alias \
tr \
true \
truncate \
- truss \
+ ${_truss} \
tset \
tsort \
tty \
@@ -204,12 +207,12 @@ SUBDIR= alias \
SUBDIR+= at
.endif
-.if ${MK_ATM} != "no"
-SUBDIR+= atm
+.if ${MK_ATF} != "no"
+_atf= atf
.endif
-.if ${MK_MAN_UTILS} != "no"
-SUBDIR+= catman
+.if ${MK_ATM} != "no"
+SUBDIR+= atm
.endif
.if ${MK_BIND_UTILS} != "no"
@@ -235,6 +238,10 @@ SUBDIR+= calendar
_clang= clang
.endif
+.if ${MK_GROFF} != "no"
+SUBDIR+= vgrind
+.endif
+
.if ${MK_HESIOD} != "no"
SUBDIR+= hesinfo
.endif
@@ -245,15 +252,13 @@ _mkcsmapper= mkcsmapper
_mkesdb= mkesdb
.endif
-.if ${MK_GROFF} != "no"
-SUBDIR+= vgrind
+.if ${MK_KDUMP} != "no"
+SUBDIR+= kdump
+SUBDIR+= truss
.endif
-.if ${MK_OPENSSL} != "no"
-SUBDIR+= bc
-SUBDIR+= chkey
-SUBDIR+= dc
-SUBDIR+= newkey
+.if ${MK_KERBEROS_SUPPORT} != "no"
+SUBDIR+= compile_et
.endif
.if ${MK_LIBTHR} != "no"
@@ -264,10 +269,6 @@ SUBDIR+= csup
SUBDIR+= locate
.endif
-.if ${MK_KERBEROS_SUPPORT} != "no"
-SUBDIR+= compile_et
-.endif
-
# XXX msgs?
.if ${MK_MAIL} != "no"
SUBDIR+= biff
@@ -277,10 +278,15 @@ SUBDIR+= msgs
.endif
.if ${MK_MAKE} != "no"
+.if ${MK_BMAKE} != "no"
+SUBDIR+= bmake
+.else
SUBDIR+= make
.endif
+.endif
.if ${MK_MAN_UTILS} != "no"
+SUBDIR+= catman
_makewhatis= makewhatis
_man= man
.endif
@@ -295,6 +301,13 @@ SUBDIR+= ypmatch
SUBDIR+= ypwhich
.endif
+.if ${MK_OPENSSL} != "no"
+SUBDIR+= bc
+SUBDIR+= chkey
+SUBDIR+= dc
+SUBDIR+= newkey
+.endif
+
.if ${MK_QUOTAS} != "no"
SUBDIR+= quota
.endif
diff --git a/usr.bin/Makefile.amd64 b/usr.bin/Makefile.amd64
index 2eba205..b720e3d 100644
--- a/usr.bin/Makefile.amd64
+++ b/usr.bin/Makefile.amd64
@@ -1,7 +1,2 @@
# $FreeBSD$
-.if ${MK_NCP} != "no"
-SUBDIR+= ncplist
-SUBDIR+= ncplogin
-.endif
-SUBDIR+= smbutil
diff --git a/usr.bin/Makefile.i386 b/usr.bin/Makefile.i386
index 2eba205..b720e3d 100644
--- a/usr.bin/Makefile.i386
+++ b/usr.bin/Makefile.i386
@@ -1,7 +1,2 @@
# $FreeBSD$
-.if ${MK_NCP} != "no"
-SUBDIR+= ncplist
-SUBDIR+= ncplogin
-.endif
-SUBDIR+= smbutil
diff --git a/usr.bin/Makefile.ia64 b/usr.bin/Makefile.ia64
index fee2fb0..b720e3d 100644
--- a/usr.bin/Makefile.ia64
+++ b/usr.bin/Makefile.ia64
@@ -1,3 +1,2 @@
# $FreeBSD$
-SUBDIR+= smbutil
diff --git a/usr.bin/Makefile.powerpc b/usr.bin/Makefile.powerpc
index fee2fb0..b720e3d 100644
--- a/usr.bin/Makefile.powerpc
+++ b/usr.bin/Makefile.powerpc
@@ -1,3 +1,2 @@
# $FreeBSD$
-SUBDIR+= smbutil
diff --git a/usr.bin/Makefile.sparc64 b/usr.bin/Makefile.sparc64
index fee2fb0..b720e3d 100644
--- a/usr.bin/Makefile.sparc64
+++ b/usr.bin/Makefile.sparc64
@@ -1,3 +1,2 @@
# $FreeBSD$
-SUBDIR+= smbutil
diff --git a/usr.bin/ar/ar.h b/usr.bin/ar/ar.h
index 77dd492..957a985 100644
--- a/usr.bin/ar/ar.h
+++ b/usr.bin/ar/ar.h
@@ -111,7 +111,7 @@ struct bsdar {
};
void bsdar_errc(struct bsdar *, int _eval, int _code,
- const char *fmt, ...);
+ const char *fmt, ...) __dead2;
void bsdar_warnc(struct bsdar *, int _code, const char *fmt, ...);
void ar_mode_d(struct bsdar *bsdar);
void ar_mode_m(struct bsdar *bsdar);
diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c
index 8c83bcc..0604a1c 100644
--- a/usr.bin/at/parsetime.c
+++ b/usr.bin/at/parsetime.c
@@ -64,7 +64,7 @@ enum { /* symbols */
MIDNIGHT, NOON, TEATIME,
PM, AM, TOMORROW, TODAY, NOW,
MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS,
- NUMBER, PLUS, DOT, SLASH, ID, JUNK,
+ NUMBER, PLUS, MINUS, DOT, SLASH, ID, JUNK,
JAN, FEB, MAR, APR, MAY, JUN,
JUL, AUG, SEP, OCT, NOV, DEC,
SUN, MON, TUE, WED, THU, FRI, SAT
@@ -246,6 +246,8 @@ token(void)
return sc_tokid = DOT;
else if (sc_token[0] == '+')
return sc_tokid = PLUS;
+ else if (sc_token[0] == '-')
+ return sc_tokid = MINUS;
else if (sc_token[0] == '/')
return sc_tokid = SLASH;
else
@@ -277,22 +279,14 @@ expect(int desired)
/*
- * plus() parses a now + time
- *
- * at [NOW] PLUS NUMBER [MINUTES|HOURS|DAYS|WEEKS|MONTHS|YEARS]
- *
+ * plus_or_minus() holds functionality common to plus() and minus()
*/
-
static void
-plus(struct tm *tm)
+plus_or_minus(struct tm *tm, int delay)
{
- int delay;
int expectplur;
- expect(NUMBER);
-
- delay = atoi(sc_token);
- expectplur = (delay != 1) ? 1 : 0;
+ expectplur = (delay != 1 && delay != -1) ? 1 : 0;
switch (token()) {
case YEARS:
@@ -323,11 +317,43 @@ plus(struct tm *tm)
tm->tm_isdst = -1;
if (mktime(tm) < 0)
plonk(sc_tokid);
+} /* plus_or_minus */
+
+
+/*
+ * plus() parses a now + time
+ *
+ * at [NOW] PLUS NUMBER [MINUTES|HOURS|DAYS|WEEKS|MONTHS|YEARS]
+ *
+ */
+static void
+plus(struct tm *tm)
+{
+ int delay;
+
+ expect(NUMBER);
+ delay = atoi(sc_token);
+ plus_or_minus(tm, delay);
} /* plus */
/*
+ * minus() is like plus but can not be used with NOW
+ */
+static void
+minus(struct tm *tm)
+{
+ int delay;
+
+ expect(NUMBER);
+
+ delay = -atoi(sc_token);
+ plus_or_minus(tm, delay);
+} /* minus */
+
+
+/*
* tod() computes the time of day
* [NUMBER [DOT NUMBER] [AM|PM]]
*/
@@ -379,7 +405,8 @@ tod(struct tm *tm)
* if we've gone past that time - but if we're specifying a time plus
* a relative offset, it's okay to bump things
*/
- if ((sc_tokid == EOF || sc_tokid == PLUS) && tm->tm_hour > hour) {
+ if ((sc_tokid == EOF || sc_tokid == PLUS || sc_tokid == MINUS) &&
+ tm->tm_hour > hour) {
tm->tm_mday++;
tm->tm_wday++;
}
@@ -456,6 +483,9 @@ month(struct tm *tm)
case PLUS:
plus(tm);
break;
+ case MINUS:
+ minus(tm);
+ break;
case TOMORROW:
/* do something tomorrow */
@@ -588,6 +618,12 @@ parsetime(int argc, char **argv)
plus(&runtime);
break;
+ /* MINUS is different from PLUS in that NOW is not
+ * an optional prefix for it
+ */
+ case MINUS:
+ minus(&runtime);
+ break;
case NUMBER:
tod(&runtime);
month(&runtime);
diff --git a/usr.bin/at/privs.h b/usr.bin/at/privs.h
index 50dd6b1..297c252 100644
--- a/usr.bin/at/privs.h
+++ b/usr.bin/at/privs.h
@@ -59,23 +59,21 @@
* to the real userid before calling any of them.
*/
-#ifndef MAIN
-extern
-#endif
-uid_t real_uid, effective_uid;
+extern uid_t real_uid, effective_uid;
+extern gid_t real_gid, effective_gid;
-#ifndef MAIN
-extern
-#endif
+#ifdef MAIN
+uid_t real_uid, effective_uid;
gid_t real_gid, effective_gid;
+#endif
#define RELINQUISH_PRIVS { \
real_uid = getuid(); \
effective_uid = geteuid(); \
real_gid = getgid(); \
effective_gid = getegid(); \
- seteuid(real_uid); \
- setegid(real_gid); \
+ if (seteuid(real_uid) != 0) err(1, "seteuid failed"); \
+ if (setegid(real_gid) != 0) err(1, "setegid failed"); \
}
#define RELINQUISH_PRIVS_ROOT(a, b) { \
@@ -83,26 +81,26 @@ gid_t real_gid, effective_gid;
effective_uid = geteuid(); \
real_gid = (b); \
effective_gid = getegid(); \
- setegid(real_gid); \
- seteuid(real_uid); \
+ if (setegid(real_gid) != 0) err(1, "setegid failed"); \
+ if (seteuid(real_uid) != 0) err(1, "seteuid failed"); \
}
#define PRIV_START { \
- seteuid(effective_uid); \
- setegid(effective_gid); \
+ if (seteuid(effective_uid) != 0) err(1, "seteuid failed"); \
+ if (setegid(effective_gid) != 0) err(1, "setegid failed"); \
}
#define PRIV_END { \
- setegid(real_gid); \
- seteuid(real_uid); \
+ if (setegid(real_gid) != 0) err(1, "setegid failed"); \
+ if (seteuid(real_uid) != 0) err(1, "seteuid failed"); \
}
#define REDUCE_PRIV(a, b) { \
PRIV_START \
effective_uid = (a); \
effective_gid = (b); \
- setreuid((uid_t)-1, effective_uid); \
- setregid((gid_t)-1, effective_gid); \
+ if (setreuid((uid_t)-1, effective_uid) != 0) err(1, "setreuid failed"); \
+ if (setregid((gid_t)-1, effective_gid) != 0) err(1, "setregid failed"); \
PRIV_END \
}
#endif
diff --git a/usr.bin/atf/Makefile b/usr.bin/atf/Makefile
new file mode 100644
index 0000000..77d3299
--- /dev/null
+++ b/usr.bin/atf/Makefile
@@ -0,0 +1,34 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# 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.
+#
+# $FreeBSD$
+
+SUBDIR= atf-config \
+ atf-report \
+ atf-run \
+ atf-sh \
+ atf-version
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/atf/Makefile.inc b/usr.bin/atf/Makefile.inc
new file mode 100644
index 0000000..0b2188b
--- /dev/null
+++ b/usr.bin/atf/Makefile.inc
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../../contrib/atf
+
+CFLAGS+= -DGDB=\"gdb\"
+
+BINDIR?= /usr/bin
+WARNS?= 3
diff --git a/usr.bin/atf/atf-config/Makefile b/usr.bin/atf/atf-config/Makefile
new file mode 100644
index 0000000..d84ed11
--- /dev/null
+++ b/usr.bin/atf/atf-config/Makefile
@@ -0,0 +1,42 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# 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.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-config
+
+PROG_CXX= atf-config
+SRCS= atf-config.cpp
+MAN= atf-config.1
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atf/atf-report/Makefile b/usr.bin/atf/atf-report/Makefile
new file mode 100644
index 0000000..0b1e8d2
--- /dev/null
+++ b/usr.bin/atf/atf-report/Makefile
@@ -0,0 +1,42 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# 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.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-report
+
+PROG_CXX= atf-report
+SRCS= atf-report.cpp reader.cpp
+MAN= atf-report.1
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atf/atf-run/Makefile b/usr.bin/atf/atf-run/Makefile
new file mode 100644
index 0000000..d33cae1
--- /dev/null
+++ b/usr.bin/atf/atf-run/Makefile
@@ -0,0 +1,44 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# 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.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-run
+
+PROG_CXX= atf-run
+SRCS= atf-run.cpp atffile.cpp config.cpp fs.cpp io.cpp requirements.cpp \
+ signals.cpp test-program.cpp timer.cpp user.cpp
+MAN= atf-run.1
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+CFLAGS+= -I${.CURDIR}/../../lib/libatf-c
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atf/atf-sh/Makefile b/usr.bin/atf/atf-sh/Makefile
new file mode 100644
index 0000000..8112098
--- /dev/null
+++ b/usr.bin/atf/atf-sh/Makefile
@@ -0,0 +1,47 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# 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.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-sh
+
+PROG_CXX= atf-sh
+SRCS= atf-sh.cpp
+MAN= atf-sh.1 atf-sh-api.3
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+FILESGROUPS= SUBR
+
+SUBRDIR= ${SHAREDIR}/atf
+SUBR= libatf-sh.subr
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atf/atf-version/Makefile b/usr.bin/atf/atf-version/Makefile
new file mode 100644
index 0000000..0320380
--- /dev/null
+++ b/usr.bin/atf/atf-version/Makefile
@@ -0,0 +1,52 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# 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.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-version
+
+PROG_CXX= atf-version
+SRCS= atf-version.cpp revision.h
+MAN= atf-version.1
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+CFLAGS+= -I${.CURDIR}/../../lib/libatf-c
+CFLAGS+= -I${.CURDIR}
+CFLAGS+= -I.
+
+CLEANFILES+= revision.h
+revision.h:
+ @sh ${ATF}/atf-version/generate-revision.sh \
+ -o ${.TARGET} \
+ -r ${ATF} \
+ -v `awk '$$2 == "VERSION" { print $$3 }' ${ATF}/bconfig.h`
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile
new file mode 100644
index 0000000..44ce56f
--- /dev/null
+++ b/usr.bin/bmake/Makefile
@@ -0,0 +1,212 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+.sinclude "Makefile.inc"
+
+SRCTOP?= ${.CURDIR:H:H}
+
+# look here first for config.h
+CFLAGS+= -I${.CURDIR}
+
+# $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
+# @(#)Makefile 5.2 (Berkeley) 12/28/90
+
+# $Id: Makefile.in,v 1.174 2012/10/10 18:46:24 sjg Exp $
+
+PROG?= ${.CURDIR:T}
+SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
+ make.c parse.c str.c suff.c targ.c trace.c var.c util.c
+SRCS+= strlist.c
+SRCS+= make_malloc.c
+SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
+ lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
+ lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \
+ lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c lstLast.c \
+ lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
+SRCS += lstPrev.c
+
+# you can use this Makefile if you have an earlier version of bmake.
+prefix= /usr
+srcdir= ${SRCTOP}/contrib/bmake
+CC?= gcc
+
+# Base version on src date
+MAKE_VERSION= 20121010
+DEFAULT_SYS_PATH = .../share/mk:/usr/share/mk
+
+CPPFLAGS+=
+CFLAGS+= ${CPPFLAGS}
+CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
+CFLAGS+= -I. -I${srcdir} -DHAVE_CONFIG_H ${XDEFS} -DMAKE_NATIVE
+CFLAGS+= ${CFLAGS_${.TARGET:T}}
+CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
+COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
+LDFLAGS=
+LIBOBJS= ${LIBOBJDIR}stresep$U.o
+LDADD=
+
+.if !empty(LIBOBJS)
+SRCS+= ${LIBOBJS:T:.o=.c}
+.endif
+
+USE_META = yes
+.if ${USE_META} != "no"
+SRCS+= meta.c
+CPPFLAGS+= -DUSE_META
+FILEMON_H ?= /usr/include/dev/filemon/filemon.h
+.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
+COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
+.endif
+.endif
+
+.PATH: ${srcdir}
+.PATH: ${srcdir}/lst.lib
+
+OS!= uname -s
+ARCH!= uname -p 2>/dev/null || uname -m
+
+# list of OS's which are derrived from BSD4.4
+isBSD44= NetBSD FreeBSD OpenBSD DragonFly
+
+.if ${OS} == "NetBSD"
+# Don't set these for anyone else since we don't know what the effect may be.
+# On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
+WFORMAT= 1
+WARNS=4
+.NOPATH: bmake.cat1
+.if make(install) && exists(${DESTDIR}/usr/share/doc)
+SUBDIR= PSD.doc
+.endif
+.endif
+
+.if defined(.PARSEDIR)
+# we cannot rely on anything but bmake to parse this correctly.
+.if empty(isBSD44:M${OS})
+MANTARGET=cat
+INSTALL?=${srcdir}/install-sh
+.if (${MACHINE} == "sun386")
+# even I don't have one of these anymore :-)
+CFLAGS+= -DPORTAR
+.elif (${MACHINE} != "sunos")
+SRCS+= sigcompat.c
+CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
+.endif
+.endif
+
+.if make(obj) || make(clean)
+SUBDIR+= unit-tests
+.endif
+.endif
+
+# many systems use gcc these days
+CC_IS_GCC=yes
+.if ${CC_IS_GCC} == "yes"
+# problem with gcc3
+CFLAGS_var.o+= -Wno-cast-qual
+.endif
+
+CFLAGS_main.o+= "-DMACHINE=\"${MACHINE}\"" "-DMACHINE_ARCH=\"${MACHINE_ARCH}\""
+
+EXTRACT_MAN=no
+
+MAN=${PROG}.1
+.if (${PROG} != "make")
+my.history: ${MAKEFILE}
+ @(echo ".Nm"; \
+ echo "is derived from NetBSD"; \
+ echo ".Xr make 1 ."; \
+ echo "It uses autoconf to facilitate portability to other platforms."; \
+ echo ".Pp") > $@
+
+${MAN}: make.1 my.history
+ @echo making ${PROG}.1
+ @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
+ -e '/^.Sh HISTORY/rmy.history' \
+ -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
+
+.endif
+
+.if !empty(isBSD44:M${OS})
+.if "${OS}" != "NetBSD"
+MAN1=${MAN}
+.endif
+MANTARGET?=man
+.endif
+
+MANTARGET?= cat
+MANDEST?= ${MANDIR}/${MANTARGET}1
+
+.if ${MANTARGET} == "cat"
+_mfromdir=${srcdir}
+.endif
+
+.if exists(${srcdir}/../Makefile.inc)
+.include "${srcdir}/../Makefile.inc"
+.endif
+.sinclude <bsd.prog.mk>
+# sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
+# so the inclusion below, results in complaints about re-defined
+# targets. For NetBSD though we need to explicitly include it.
+.if defined(.PARSEDIR)
+.if defined(SUBDIR) && !target(${SUBDIR:[1]})
+.sinclude <bsd.subdir.mk>
+.endif
+.endif
+
+CPPFLAGS+= -DMAKE_NATIVE
+COPTS.var.c += -Wno-cast-qual
+COPTS.job.c += -Wno-format-nonliteral
+COPTS.parse.c += -Wno-format-nonliteral
+COPTS.var.c += -Wno-format-nonliteral
+
+# Force these
+BINDIR= ${prefix}/bin
+MANDIR= ${prefix}/man
+
+arch.o: config.h
+# make sure that MAKE_VERSION gets updated.
+main.o: ${SRCS} ${MAKEFILE}
+
+MK?=${prefix}/share/mk
+MKSRC?=mk
+INSTALL?=${srcdir}/install-sh
+
+beforeinstall:
+ test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
+ test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
+
+# latest version of *.mk includes an installer.
+# you should not need to set USE_OS
+install-mk:
+.if exists(${MKSRC}/install-mk)
+ test -d ${DESTDIR}${MK} || ${INSTALL} -m 775 -d ${DESTDIR}${MK}
+ ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${MK} ${USE_OS}
+.else
+ @echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
+.endif
+
+.ifdef TOOLDIR
+# this is a native netbsd build,
+# use libutil rather than the local emalloc etc.
+CPPFLAGS+= -DUSE_EMALLOC
+LDADD+=-lutil
+DPADD+=${LIBUTIL}
+.endif
+
+# A simple unit-test driver to help catch regressions
+accept test:
+ cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
+
+# override some simple things
+BINDIR= /usr/bin
+MANDIR= /usr/share/man/man
+
+# make sure we get this
+CFLAGS+= ${COPTS.${.IMPSRC:T}}
+CLEANFILES+= bootstrap
+
+after-import: ${SRCTOP}/contrib/bmake/bsd.after-import.mk
+ cd ${.CURDIR} && ${.MAKE} -f ${SRCTOP}/contrib/bmake/bsd.after-import.mk
+
diff --git a/usr.bin/bmake/Makefile.inc b/usr.bin/bmake/Makefile.inc
new file mode 100644
index 0000000..4b126c7
--- /dev/null
+++ b/usr.bin/bmake/Makefile.inc
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+.include "bsd.own.mk"
+
+.if defined(.PARSEDIR)
+# make sure this is available to unit-tests/Makefile
+.export SRCTOP
+.endif
+
+.if ${MK_BMAKE} != "no"
+PROG= make
+.endif
+
+WARNS=3
diff --git a/usr.bin/bmake/config.h b/usr.bin/bmake/config.h
new file mode 100644
index 0000000..64777b8
--- /dev/null
+++ b/usr.bin/bmake/config.h
@@ -0,0 +1,316 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.in by autoheader. */
+/* $FreeBSD$ */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Path of default shell */
+/* #undef DEFSHELL_CUSTOM */
+
+/* Shell spec to use by default */
+/* #undef DEFSHELL_INDEX */
+
+/* Define to 1 if you have the <ar.h> header file. */
+#define HAVE_AR_H 1
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+ don't. */
+#define HAVE_DECL_SYS_SIGLIST 1
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the `dirname' function. */
+#define HAVE_DIRNAME 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+/* #undef HAVE_DOPRNT */
+
+/* Define to 1 if you have the `err' function. */
+#define HAVE_ERR 1
+
+/* Define to 1 if you have the `errx' function. */
+#define HAVE_ERRX 1
+
+/* Define to 1 if you have the <err.h> header file. */
+#define HAVE_ERR_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `getenv' function. */
+#define HAVE_GETENV 1
+
+/* Define to 1 if you have the `getopt' function. */
+#define HAVE_GETOPT 1
+
+/* Define to 1 if you have the `getwd' function. */
+#define HAVE_GETWD 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `killpg' function. */
+#define HAVE_KILLPG 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <paths.h> header file. */
+#define HAVE_PATHS_H 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the <ranlib.h> header file. */
+#define HAVE_RANLIB_H 1
+
+/* Define to 1 if you have the `realpath' function. */
+#define HAVE_REALPATH 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the `setpgid' function. */
+#define HAVE_SETPGID 1
+
+/* Define to 1 if you have the `setsid' function. */
+#define HAVE_SETSID 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `sigvec' function. */
+#define HAVE_SIGVEC 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the `stresep' function. */
+/* #undef HAVE_STRESEP */
+
+/* Define to 1 if you have the `strftime' function. */
+#define HAVE_STRFTIME 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtod' function. */
+#define HAVE_STRTOD 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 1
+
+/* Define to 1 if `struct stat' is a member of `st_rdev'. */
+#define HAVE_STRUCT_STAT_ST_RDEV 1
+
+/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
+ `HAVE_STRUCT_STAT_ST_RDEV' instead. */
+#define HAVE_ST_RDEV 1
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define HAVE_UNSETENV 1
+
+/* Define to 1 if you have the <utime.h> header file. */
+#define HAVE_UTIME_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the <vfork.h> header file. */
+/* #undef HAVE_VFORK_H */
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `wait3' function. */
+#define HAVE_WAIT3 1
+
+/* Define to 1 if you have the `wait4' function. */
+#define HAVE_WAIT4 1
+
+/* Define to 1 if you have the `waitpid' function. */
+#define HAVE_WAITPID 1
+
+/* Define to 1 if you have the `warn' function. */
+#define HAVE_WARN 1
+
+/* Define to 1 if you have the `warnx' function. */
+#define HAVE_WARNX 1
+
+/* Define to 1 if `fork' works. */
+#define HAVE_WORKING_FORK 1
+
+/* Define to 1 if `vfork' works. */
+#define HAVE_WORKING_VFORK 1
+
+/* define if your compiler has __attribute__ */
+/* #undef HAVE___ATTRIBUTE__ */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "sjg@NetBSD.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "bmake"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "bmake 20120620"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "bmake"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "20120620"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* # undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define as `fork' if `vfork' does not work. */
+/* #undef vfork */
diff --git a/usr.bin/bmake/unit-tests/Makefile b/usr.bin/bmake/unit-tests/Makefile
new file mode 100644
index 0000000..c22dbc5
--- /dev/null
+++ b/usr.bin/bmake/unit-tests/Makefile
@@ -0,0 +1,103 @@
+# This is a generated file, do NOT edit!
+# See contrib/bmake/bsd.after-import.mk
+#
+# $FreeBSD$
+
+SRCTOP?= ${.CURDIR:H:H:H}
+
+# $Id: Makefile.in,v 1.38 2012/06/19 23:38:48 sjg Exp $
+#
+# $NetBSD: Makefile,v 1.34 2012/06/19 23:25:53 sjg Exp $
+#
+# Unit tests for make(1)
+# The main targets are:
+#
+# all: run all the tests
+# test: run 'all', capture output and compare to expected results
+# accept: move generated output to expected results
+#
+# Adding a test case.
+# Each feature should get its own set of tests in its own suitably
+# named makefile which should be added to SUBFILES to hook it in.
+#
+
+srcdir= ${SRCTOP}/contrib/bmake/unit-tests
+
+.MAIN: all
+
+UNIT_TESTS:= ${srcdir}
+
+# Simple sub-makefiles - we run them as a black box
+# keep the list sorted.
+SUBFILES= \
+ comment \
+ cond1 \
+ error \
+ export \
+ export-all \
+ doterror \
+ dotwait \
+ forloop \
+ forsubst \
+ hash \
+ misc \
+ moderrs \
+ modmatch \
+ modmisc \
+ modorder \
+ modts \
+ modword \
+ phony-end \
+ posix \
+ qequals \
+ sysv \
+ ternary \
+ unexport \
+ unexport-env \
+ varcmd
+
+all: ${SUBFILES}
+
+flags.doterror=
+
+# the tests are actually done with sub-makes.
+.PHONY: ${SUBFILES}
+.PRECIOUS: ${SUBFILES}
+${SUBFILES}:
+ -@${.MAKE} ${flags.$@:U-k} -f ${UNIT_TESTS}/$@
+
+clean:
+ rm -f *.out *.fail *.core
+
+.sinclude <bsd.obj.mk>
+
+TEST_MAKE?= ${.MAKE}
+TOOL_SED?= sed
+TOOL_TR?= tr
+TOOL_DIFF?= diff
+DIFF_FLAGS?= -u
+
+# ensure consistent results from sort(1)
+LC_ALL= C
+LANG= C
+.export LANG LC_ALL
+
+# The driver.
+# We always pretend .MAKE was called 'make'
+# and strip ${.CURDIR}/ from the output
+# and replace anything after 'stopped in' with unit-tests
+# so the results can be compared.
+test:
+ @echo "${TEST_MAKE} -f ${MAKEFILE} > ${.TARGET}.out 2>&1"
+ @cd ${.OBJDIR} && ${TEST_MAKE} -f ${MAKEFILE} 2>&1 | \
+ ${TOOL_TR} -d '\015' | \
+ ${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}:,make:,' \
+ -e '/stopped/s, /.*, unit-tests,' \
+ -e 's,${.CURDIR:C/\./\\\./g}/,,g' \
+ -e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' > ${.TARGET}.out || { \
+ tail ${.TARGET}.out; mv ${.TARGET}.out ${.TARGET}.fail; exit 1; }
+ ${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/${.TARGET}.exp ${.TARGET}.out
+
+accept:
+ mv test.out ${srcdir}/test.exp
+
diff --git a/usr.bin/calendar/calendar.1 b/usr.bin/calendar/calendar.1
index 997bb1f..d8ed6cb 100644
--- a/usr.bin/calendar/calendar.1
+++ b/usr.bin/calendar/calendar.1
@@ -313,7 +313,7 @@ the time-difference towards Greenwich.
The new and full moons are happening on the day indicated: They
might happen in the time period in the early night or in the late
evening.
-It doesn't indicate that they are starting in the night on that date.
+It does not indicate that they are starting in the night on that date.
.Pp
Because of minor differences between the output of the formulas
used and other sources on the Internet, Druids and Werewolves should
diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c
index bd03e02..2a107c2 100644
--- a/usr.bin/calendar/calendar.c
+++ b/usr.bin/calendar/calendar.c
@@ -60,8 +60,8 @@ __FBSDID("$FreeBSD$");
struct passwd *pw;
int doall = 0;
int debug = 0;
-char *DEBUG = NULL;
-time_t f_time = 0;
+static char *DEBUG = NULL;
+static time_t f_time = 0;
double UTCOffset = UTCOFFSET_NOTSET;
int EastLongitude = LONGITUDE_NOTSET;
diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd
index 0f1f36d..5f517a6 100644
--- a/usr.bin/calendar/calendars/calendar.freebsd
+++ b/usr.bin/calendar/calendars/calendar.freebsd
@@ -54,6 +54,7 @@
02/10 David Greenman <dg@FreeBSD.org> born in Portland, Oregon, United States, 1968
02/10 Paul Richards <paul@FreeBSD.org> born in Ammanford, Carmarthenshire, United Kingdom, 1968
02/10 Simon Barner <barner@FreeBSD.org> born in Rosenheim, Bayern, Germany, 1980
+02/10 Jason E. Hale <jhale@FreeBSD.org> born in Pittsburgh, Pennsylvania, Unites States, 1982
02/13 Jesper Skriver <jesper@FreeBSD.org> born in Aarhus, Denmark, 1975
02/13 Steve Wills <swills@FreeBSD.org> born in Lynchburg, Virginia, United States, 1975
02/13 Andrey Slusar <anray@FreeBSD.org> born in Odessa, USSR, 1979
@@ -118,6 +119,7 @@
04/03 Tong Liu <nemoliu@FreeBSD.org> born in Beijing, People's Republic of China, 1981
04/03 Gabor Pali <pgj@FreeBSD.org> born in Kunhegyes, Hungary, 1982
04/05 Stacey Son <sson@FreeBSD.org> born in Burley, Idaho, United States, 1967
+04/06 Peter Jeremy <peterj@FreeBSD.org> born in Sydney, New South Wales, Australia, 1961
04/07 Edward Tomasz Napierala <trasz@FreeBSD.org> born in Wolsztyn, Poland, 1981
04/08 Jordan K. Hubbard <jkh@FreeBSD.org> born in Honolulu, Hawaii, United States, 1963
04/09 Ceri Davies <ceri@FreeBSD.org> born in Haverfordwest, Pembrokeshire, United Kingdom, 1976
@@ -230,6 +232,7 @@
07/22 Jens Schweikhardt <schweikh@FreeBSD.org> born in Waiblingen, Baden-Wuerttemberg, Germany, 1967
07/22 Lukas Ertl <le@FreeBSD.org> born in Weissenbach/Enns, Steiermark, Austria, 1976
07/23 Sergey A. Osokin <osa@FreeBSD.org> born in Krasnogorsky, Stepnogorsk, Akmolinskaya region, Kazakhstan, 1972
+07/23 Andrey Zonov <zont@FreeBSD.org> born in Kirov, Russian Federation, 1985
07/24 Alexander Nedotsukov <bland@FreeBSD.org> born in Ulyanovsk, Russian Federation, 1974
07/24 Alberto Villa <avilla@FreeBSD.org> born in Vercelli, Italy, 1987
07/27 Andriy Gapon <avg@FreeBSD.org> born in Kyrykivka, Sumy region, Ukraine, 1976
@@ -285,6 +288,7 @@
09/18 Matthew Fleming <mdf@FreeBSD.org> born in Cleveland, Ohio, United States, 1975
09/20 Kevin Lo <kevlo@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1972
09/21 Gleb Kurtsou <gleb@FreeBSD.org> born in Minsk, Belarus, 1984
+09/22 Bryan Drewery <bdrewery@FreeBSD.org> born in San Diego, California, United States, 1984
09/27 Neil Blakey-Milner <nbm@FreeBSD.org> born in Port Elizabeth, South Africa, 1978
09/27 Renato Botelho <garga@FreeBSD.org> born in Araras, Sao Paulo, Brazil, 1979
09/28 Greg Lehey <grog@FreeBSD.org> born in Melbourne, Victoria, Australia, 1948
@@ -310,6 +314,7 @@
10/23 Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> born in Brasilia, Distrito Federal, Brazil, 1976
10/25 Eric Melville <eric@FreeBSD.org> born in Los Gatos, California, United States, 1980
10/25 Julien Laffaye <jlaffaye@FreeBSD.org> born in Toulouse, France, 1988
+10/25 Ashish SHUKLA <ashish@FreeBSD.org> born in Kanpur, India, 1985
10/26 Philip M. Gollucci <pgollucci@FreeBSD.org> born in Silver Spring, Maryland, United States, 1979
10/27 Takanori Watanabe <takawata@FreeBSD.org> born in Numazu, Shizuoka, Japan, 1972
11/05 M. Warner Losh <imp@FreeBSD.org> born in Kansas City, Kansas, United States, 1966
@@ -349,6 +354,7 @@
12/23 Sean Chittenden <seanc@FreeBSD.org> born in Seattle, Washington, United States, 1979
12/23 Alejandro Pulver <alepulver@FreeBSD.org> born in Buenos Aires, Argentina, 1989
12/24 Guido Falsi <madpilot@FreeBSD.org> born in Firenze, Italy, 1978
+12/25 Niclas Zeising <zeising@FreeBSD.org> born in Stockholm, Sweden, 1986
12/28 Soren Schmidt <sos@FreeBSD.org> born in Maribo, Denmark, 1960
12/28 Ade Lovett <ade@FreeBSD.org> born in London, England, 1969
12/28 Marius Strobl <marius@FreeBSD.org> born in Cham, Bavaria, Germany, 1978
diff --git a/usr.bin/calendar/dates.c b/usr.bin/calendar/dates.c
index 3f8b89f..989f29c 100644
--- a/usr.bin/calendar/dates.c
+++ b/usr.bin/calendar/dates.c
@@ -43,7 +43,7 @@ struct cal_year {
int firstdayofweek; /* 0 .. 6 */
struct cal_month *months;
struct cal_year *nextyear;
-} cal_year;
+};
struct cal_month {
int month; /* 01 .. 12 */
@@ -52,7 +52,7 @@ struct cal_month {
struct cal_year *year; /* points back */
struct cal_day *days;
struct cal_month *nextmonth;
-} cal_month;
+};
struct cal_day {
int dayofmonth; /* 01 .. 31 */
@@ -62,19 +62,18 @@ struct cal_day {
struct cal_month *month; /* points back */
struct cal_year *year; /* points back */
struct event *events;
-} cal_day;
+};
int debug_remember = 0;
-struct cal_year *hyear = NULL;
+static struct cal_year *hyear = NULL;
/* 1-based month, 0-based days, cumulative */
-int *cumdays;
int cumdaytab[][14] = {
{0, -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364},
{0, -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
};
/* 1-based month, individual */
-int *mondays;
+static int *mondays;
int mondaytab[][14] = {
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30},
diff --git a/usr.bin/calendar/day.c b/usr.bin/calendar/day.c
index 237b6b5..dac6115 100644
--- a/usr.bin/calendar/day.c
+++ b/usr.bin/calendar/day.c
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
#include "calendar.h"
-time_t time1, time2;
+static time_t time1, time2;
const struct tm tm0;
char dayname[100];
int year1, year2;
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c
index e1ed21d..1625717 100644
--- a/usr.bin/calendar/io.c
+++ b/usr.bin/calendar/io.c
@@ -60,10 +60,10 @@ __FBSDID("$FreeBSD$");
#include "calendar.h"
const char *calendarFile = "calendar"; /* default calendar file */
-const char *calendarHomes[] = {".calendar", _PATH_INCLUDE}; /* HOME */
-const char *calendarNoMail = "nomail"; /* don't sent mail if this file exist */
+static const char *calendarHomes[] = {".calendar", _PATH_INCLUDE}; /* HOME */
+static const char *calendarNoMail = "nomail";/* don't sent mail if file exist */
-char path[MAXPATHLEN];
+static char path[MAXPATHLEN];
struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon;
struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;
diff --git a/usr.bin/chat/chat.8 b/usr.bin/chat/chat.8
index ed908b9..b130ee8 100644
--- a/usr.bin/chat/chat.8
+++ b/usr.bin/chat/chat.8
@@ -1,41 +1,81 @@
-.\" -*- nroff -*-
-.\" manual page [] for chat 1.8
.\" $FreeBSD$
-.\" SH section heading
-.\" SS subsection heading
-.\" LP paragraph
-.\" IP indented paragraph
-.\" TP hanging label
-.TH CHAT 8 "27 Sep 1997" "Chat Version 1.17"
-.SH NAME
-chat \- Automated conversational script with a modem
-.SH SYNOPSIS
-.B chat
-[
-.I options
-]
-.I script
-.SH DESCRIPTION
-.LP
-The \fIchat\fR program defines a conversational exchange between the
+.Dd September 10, 2012
+.Dt CHAT 8
+.Os
+.Sh NAME
+.Nm chat
+.Nd Automated conversational script with a modem
+.Sh SYNOPSIS
+.Nm
+.Op Fl eSsVv
+.Op Fl f Ar chat-file
+.Op Fl r Ar report-file
+.Op Fl T Ar phone-number
+.Op Fl t Ar timeout
+.Op Fl U Ar phone-number2
+.Op Ar script
+.Sh DESCRIPTION
+The
+.Nm
+program defines a conversational exchange between the
computer and the modem.
Its primary purpose is to establish the
-connection between the Point-to-Point Protocol Daemon (\fIpppd\fR) and
-the remote's \fIpppd\fR process.
-.SH OPTIONS
-.TP
-.B -f \fI<chat file>
-Read the chat script from the chat \fIfile\fR.
+connection between the Point-to-Point Protocol Daemon
+.Pq pppd
+and the remote's pppd process.
+.Sh OPTIONS
+.Bl -tag -width indent
+.It Fl e
+Start with the echo option turned on.
+Echoing may also be turned on
+or off at specific points in the chat script by using the ECHO
+keyword.
+When echoing is enabled, all output from the modem is echoed
+to
+.Em stderr .
+.It Fl f Ar chat-file
+Read the chat script from the chat file.
The use of this option
is mutually exclusive with the chat script parameters.
The user must
have read access to the file.
-Multiple lines are permitted in the
-file.
+Multiple lines are permitted in the file.
Space or horizontal tab characters should be used to separate
the strings.
-.TP
-.B -t \fI<timeout>
+.It Fl r Ar report-file
+Set the file for output of the report strings.
+If you use the keyword
+.Dv REPORT ,
+the resulting strings are written to this file.
+If this
+option is not used and you still use
+.Dv REPORT
+keywords, the
+.Pa stderr
+file is used for the report strings.
+.It Fl S
+Do not use
+.Xr syslog 3 .
+By default, error messages are sent to
+.Xr syslog 3 .
+The use of
+.Fl S
+will prevent both log messages from
+.Fl v
+and error messages from being sent to
+.Xr syslog 3 .
+.It Fl s
+Use
+.Em stderr .
+All log messages from
+.Fl v
+and all error messages will be
+sent to
+.Em stderr .
+.It Fl T Ar phone-number
+Pass in an arbitrary string, usually a phone number, that will be
+substituted for the \\T substitution metacharacter in a send string.
+.It Fl t Ar timeout
Set the timeout for the expected string to be received.
If the string
is not received within the time limit then the reply string is not
@@ -43,96 +83,81 @@ sent.
An alternate reply may be sent or the script will fail if there
is no alternate reply string.
A failed script will cause the
-\fIchat\fR program to terminate with a non-zero error code.
-.TP
-.B -r \fI<report file>
-Set the file for output of the report strings.
-If you use the keyword
-\fIREPORT\fR, the resulting strings are written to this file.
-If this
-option is not used and you still use \fIREPORT\fR keywords, the
-\fIstderr\fR file is used for the report strings.
-.TP
-.B -e
-Start with the echo option turned on.
-Echoing may also be turned on
-or off at specific points in the chat script by using the \fIECHO\fR
-keyword.
-When echoing is enabled, all output from the modem is echoed
-to \fIstderr\fR.
-.TP
-.B -v
-Request that the \fIchat\fR script be executed in a verbose mode.
+.Nm
+program to terminate with a non-zero error code.
+.It Fl U Ar phone-number2
+Pass in a second string, usually a phone number, that will be
+substituted for the \\U substitution metacharacter in a send string.
+This is useful when dialing an ISDN terminal adapter that requires two
+numbers.
+.It Fl V
+Request that the
+.Nm
+script be executed in a
+.Em stderr
+verbose mode.
The
-\fIchat\fR program will then log the execution state of the chat
-script as well as all text received from the modem and the output
-strings sent to the modem. The default is to log through
-.IR syslog (3);
-the logging method may be altered with the -S and -s flags.
-Logging is
-done to the \fIlocal2\fR facility at level \fIinfo\fR for verbose tracing
-and level \fIerr\fR for some errors.
-.TP
-.B -V
-Request that the \fIchat\fR script be executed in a stderr verbose
-mode.
-The \fIchat\fR program will then log all text received from the
+.Nm
+program will then log all text received from the
modem and the output strings sent to the modem to the stderr device.
This
device is usually the local console at the station running the chat or
pppd program.
-.TP
-.B -s
-Use stderr. All log messages from '-v' and all error messages will be
-sent to stderr.
-.TP
-.B -S
-Do not use
-.IR syslog (3).
-By default, error messages are sent to
-.IR syslog (3).
-The use of -S will prevent both log messages from '-v' and
-error messages from being sent to
-.IR syslog (3).
-.TP
-.B -T \fI<phone number>
-Pass in an arbitrary string, usually a phone number, that will be
-substituted for the \\T substitution metacharacter in a send string.
-.TP
-.B -U \fI<phone number 2>
-Pass in a second string, usually a phone number, that will be
-substituted for the \\U substitution metacharacter in a send string.
-This is useful when dialing an ISDN terminal adapter that requires two
-numbers.
-.TP
-.B script
-If the script is not specified in a file with the \fI-f\fR option then
-the script is included as parameters to the \fIchat\fR program.
-.SH CHAT SCRIPT
-.LP
-The \fIchat\fR script defines the communications.
-.LP
+.It Fl v
+Request that the
+.Nm
+script be executed in a verbose mode.
+The
+.Nm
+program will then log the execution state of the chat
+script as well as all text received from the modem and the output
+strings sent to the modem.
+The default is to log through
+.Xr syslog 3 ;
+the logging method may be altered with the
+.Fl S
+and
+.Fl s
+flags.
+Logging is done to the
+.Em local2
+facility at level
+.Em info
+for verbose tracing and level
+.Em err
+for some errors.
+.El
+.Sh CHAT SCRIPT
+The
+.Nm
+script defines the communications.
A script consists of one or more "expect-send" pairs of strings,
separated by spaces, with an optional "subexpect-subsend" string pair,
separated by a dash as in the following example:
-.IP
-ogin:-BREAK-ogin: ppp ssword: hello2u2
-.LP
-This line indicates that the \fIchat\fR program should expect the string
-"ogin:". If it fails to receive a login prompt within the time interval
+.Pp
+.D1 ogin:-BREAK-ogin: ppp ssword: hello2u2
+.Pp
+This line indicates that the
+.Nm
+program should expect the string "ogin:".
+If it fails to receive a login prompt within the time interval
allotted, it is to send a break sequence to the remote and then expect the
-string "ogin:". If the first "ogin:" is received then the break sequence is
+string "ogin:".
+If the first "ogin:" is received then the break sequence is
not generated.
-.LP
-Once it received the login prompt the \fIchat\fR program will send the
-string ppp and then expect the prompt "ssword:". When it receives the
+.Pp
+Once it received the login prompt the
+.Nm
+program will send the
+string ppp and then expect the prompt "ssword:".
+When it receives the
prompt for the password, it will send the password hello2u2.
-.LP
+.Pp
A carriage return is normally sent following the reply string.
It is not
expected in the "expect" string unless it is specifically requested by using
the \\r character sequence.
-.LP
+.Pp
The expect sequence should contain only what is needed to identify the
string.
Since it is normally stored on a disk file, it should not contain
@@ -140,29 +165,30 @@ variable information.
It is generally not acceptable to look for time
strings, network identification strings, or other variable pieces of data as
an expect string.
-.LP
+.Pp
To help correct for characters which may be corrupted during the initial
-sequence, look for the string "ogin:" rather than "login:". It is possible
+sequence, look for the string "ogin:" rather than "login:".
+It is possible
that the leading "l" character may be received in error and you may never
find the string even though it was sent by the system.
For this reason,
scripts look for "ogin:" rather than "login:" and "ssword:" rather than
"password:".
-.LP
+.Pp
A very simple script might look like this:
-.IP
-ogin: ppp ssword: hello2u2
-.LP
+.Pp
+.D1 ogin: ppp ssword: hello2u2
+.Pp
In other words, expect ....ogin:, send ppp, expect ...ssword:, send hello2u2.
-.LP
+.Pp
In actual practice, simple scripts are rare.
At the vary least, you
should include sub-expect sequences should the original string not be
received.
For example, consider the following script:
-.IP
-ogin:--ogin: ppp ssword: hello2u2
-.LP
+.Pp
+.D1 ogin:--ogin: ppp ssword: hello2u2
+.Pp
This would be a better script than the simple one used earlier.
This would look
for the same login: prompt, however, if one was not received, a single
@@ -170,123 +196,135 @@ return sequence is sent and then it will look for login: again.
Should line
noise obscure the first login prompt then sending the empty line will
usually generate a login prompt again.
-.SH COMMENTS
+.Sh COMMENTS
Comments can be embedded in the chat script.
A comment is a line which
-starts with the \fB#\fR (hash) character in column 1. Such comment
+starts with the # (hash) character in column 1.
+Such comment
lines are just ignored by the chat program.
If a '#' character is to
be expected as the first character of the expect sequence, you should
quote the expect string.
If you want to wait for a prompt that starts with a # (hash)
character, you would have to write something like this:
-.IP
+.Bd -literal -offset indent
# Now wait for the prompt and send logout string
-.br
\&'# ' logout
-.LP
-
-.SH ABORT STRINGS
+.Ed
+.Sh ABORT STRINGS
Many modems will report the status of the call as a string.
-These
-strings may be \fBCONNECTED\fR or \fBNO CARRIER\fR or \fBBUSY\fR.
-It
-is often desirable to terminate the script should the modem fail to
+These strings may be
+.Dv CONNECTED
+or
+.Dv NO CARRIER
+or
+.Dv BUSY .
+It is often desirable to terminate the script should the modem fail to
connect to the remote.
The difficulty is that a script would not know
exactly which modem string it may receive.
-On one attempt, it may
-receive \fBBUSY\fR while the next time it may receive \fBNO CARRIER\fR.
-.LP
-These "abort" strings may be specified in the script using the \fIABORT\fR
+On one attempt, it may receive
+.Dv BUSY
+while the next time it may receive
+.Dv NO CARRIER .
+.Pp
+These "abort" strings may be specified in the script using the ABORT
sequence.
It is written in the script as in the following example:
-.IP
-ABORT BUSY ABORT 'NO CARRIER' '' ATZ OK ATDT5551212 CONNECT
-.LP
+.Pp
+.D1 ABORT BUSY ABORT 'NO CARRIER' '' ATZ OK ATDT5551212 CONNECT
+.Pp
This sequence will expect nothing; and then send the string ATZ.
-The
-expected response to this is the string \fIOK\fR.
-When it receives \fIOK\fR,
+The expected response to this is the string
+.Dv OK .
+When it receives
+.Dv OK ,
the string ATDT5551212 to dial the telephone.
The expected string is
-\fICONNECT\fR.
-If the string \fICONNECT\fR is received the remainder of the
+.Dv CONNECT .
+If the string
+.Dv CONNECT
+is received the remainder of the
script is executed.
However, should the modem find a busy telephone, it will
-send the string \fIBUSY\fR.
+send the string
+.Dv BUSY .
This will cause the string to match the abort
character sequence.
The script will then fail because it found a match to
the abort string.
-If it received the string \fINO CARRIER\fR, it will abort
+If it received the string
+.Dv NO CARRIER ,
+it will abort
for the same reason.
Either string may be received.
Either string will
-terminate the \fIchat\fR script.
-.SH CLR_ABORT STRINGS
-This sequence allows for clearing previously set \fBABORT\fR strings.
-\fBABORT\fR strings are kept in an array of a pre-determined size (at
-compilation time); \fBCLR_ABORT\fR will reclaim the space for cleared
+terminate the
+.Nm
+script.
+.Sh CLR_ABORT STRINGS
+This sequence allows for clearing previously set
+.Dv ABORT
+strings.
+.Dv ABORT
+strings are kept in an array of a pre-determined size (at
+compilation time); CLR_ABORT will reclaim the space for cleared
entries so that new strings can use that space.
-.SH SAY STRINGS
-The \fBSAY\fR directive allows the script to send strings to the user
-at the terminal via standard error. If \fBchat\fR is being run by
+.Sh SAY STRINGS
+The
+.Dv SAY
+directive allows the script to send strings to the user
+at the terminal via standard error.
+If
+.Nm
+is being run by
pppd, and pppd is running as a daemon (detached from its controlling
terminal), standard error will normally be redirected to the file
-/etc/ppp/connect-errors.
-.LP
-\fBSAY\fR strings must be enclosed in single or double quotes.
-If
-carriage return and line feed are needed in the string to be output,
+.Pa /etc/ppp/connect-errors .
+.Pp
+.Dv SAY
+strings must be enclosed in single or double quotes.
+If carriage return and line feed are needed in the string to be output,
you must explicitly add them to your string.
-.LP
-The SAY strings could be used to give progress messages in sections of
+.Pp
+The
+.Dv SAY
+strings could be used to give progress messages in sections of
the script where you want to have 'ECHO OFF' but still let the user
know what is happening. An example is:
-.IP
+.Bd -literal -offset indent
ABORT BUSY
-.br
ECHO OFF
-.br
SAY "Dialling your ISP...\\n"
-.br
\&'' ATDT5551212
-.br
TIMEOUT 120
-.br
SAY "Waiting up to 2 minutes for connection ... "
-.br
CONNECT ''
-.br
SAY "Connected, now logging in ...\\n"
-.br
ogin: account
-.br
ssword: pass
-.br
-$ \c
-SAY "Logged in OK ...\\n"
-\fIetc ...\fR
-.LP
-This sequence will only present the SAY strings to the user and all
+$ SAY "Logged in OK ...\\n" \fIetc ...\fR
+.Ed
+.Pp
+This sequence will only present the
+.Dv SAY
+strings to the user and all
the details of the script will remain hidden.
For example, if the
above script works, the user will see:
-.IP
+.Bd -literal -offset indent
Dialling your ISP...
-.br
Waiting up to 2 minutes for connection ... Connected, now logging in ...
-.br
Logged in OK ...
-.LP
-
-.SH REPORT STRINGS
-A \fBreport\fR string is similar to the ABORT string.
+.Ed
+.Sh REPORT STRINGS
+A report string is similar to the
+.Dv ABORT
+string.
The difference
is that the strings, and all characters to the next control character
such as a carriage return, are written to the report file.
-.LP
+.Pp
The report strings may be used to isolate the transmission rate of the
modem's connect string and return the value to the chat user.
The
@@ -295,281 +333,312 @@ other string processing such as looking for the expect string.
The use
of the same string for a report and abort sequence is probably not
very useful, however, it is possible.
-.LP
+.Pp
The report strings to no change the completion code of the program.
-.LP
-These "report" strings may be specified in the script using the \fIREPORT\fR
+.Pp
+These "report" strings may be specified in the script using the
+.Dv REPORT
sequence.
It is written in the script as in the following example:
-.IP
-REPORT CONNECT ABORT BUSY '' ATDT5551212 CONNECT '' ogin: account
-.LP
+.Pp
+.D1 REPORT CONNECT ABORT BUSY '' ATDT5551212 CONNECT '' ogin: account
+.Pp
This sequence will expect nothing; and then send the string
ATDT5551212 to dial the telephone.
The expected string is
-\fICONNECT\fR.
-If the string \fICONNECT\fR is received the remainder
+.Dv CONNECT .
+If the string
+.Dv CONNECT
+is received the remainder
of the script is executed.
In addition the program will write to the
expect-file the string "CONNECT" plus any characters which follow it
such as the connection rate.
-.SH CLR_REPORT STRINGS
-This sequence allows for clearing previously set \fBREPORT\fR strings.
-\fBREPORT\fR strings are kept in an array of a pre-determined size (at
-compilation time); \fBCLR_REPORT\fR will reclaim the space for cleared
+.Sh CLR_REPORT STRINGS
+This sequence allows for clearing previously set
+.Dv REPORT
+strings.
+.Dv REPORT
+strings are kept in an array of a pre-determined size (at
+compilation time); CLR_REPORT will reclaim the space for cleared
entries so that new strings can use that space.
-.SH ECHO
+.Sh ECHO
The echo options controls whether the output from the modem is echoed
-to \fIstderr\fR.
-This option may be set with the \fI-e\fR option, but
-it can also be controlled by the \fIECHO\fR keyword.
+to
+.Em stderr .
+This option may be set with the
+.Fl e
+option, but
+it can also be controlled by the
+.Dv ECHO
+keyword.
The "expect-send"
-pair \fIECHO\fR \fION\fR enables echoing, and \fIECHO\fR \fIOFF\fR
+pair
+.Dv ECHO ON
+enables echoing, and
+.Dv ECHO OFF
disables it.
With this keyword you can select which parts of the
conversation should be visible.
For instance, with the following
script:
-.IP
+.Bd -literal -offset indent
ABORT 'BUSY'
-.br
ABORT 'NO CARRIER'
-.br
\&'' ATZ
-.br
OK\\r\\n ATD1234567
-.br
\\r\\n \\c
-.br
ECHO ON
-.br
CONNECT \\c
-.br
ogin: account
-.LP
+.Ed
+.Pp
all output resulting from modem configuration and dialing is not visible,
-but starting with the \fICONNECT\fR (or \fIBUSY\fR) message, everything
+but starting with the
+.Dv CONNECT
+or
+.Dv BUSY
+message, everything
will be echoed.
-.SH HANGUP
-The HANGUP options control whether a modem hangup should be considered
-as an error or not. This option is useful in scripts for dialling
-systems which will hang up and call your system back. The HANGUP
-options can be \fBON\fR or \fBOFF\fR.
-.br
-When HANGUP is set OFF and the modem hangs up (e.g., after the first
-stage of logging in to a callback system), \fBchat\fR will continue
+.Sh HANGUP
+The
+.Dv HANGUP
+options control whether a modem hangup should be considered
+as an error or not.
+This option is useful in scripts for dialling
+systems which will hang up and call your system back.
+The
+.Dv HANGUP
+options can be
+.Dv ON
+or
+.Dv OFF .
+.Pp
+When
+.Dv HANGUP
+is set
+.Dv OFF
+and the modem hangs up (e.g., after the first
+stage of logging in to a callback system),
+.Nm
+will continue
running the script (e.g., waiting for the incoming call and second
-stage login prompt). As soon as the incoming call is connected, you
-should use the \fBHANGUP ON\fR directive to reinstall normal hang up
-signal behavior. Here is a (simple) example script:
-.IP
+stage login prompt).
+As soon as the incoming call is connected, you
+should use the
+.Dv HANGUP ON
+directive to reinstall normal hang up
+signal behavior.
+Here is a (simple) example script:
+.Bd -literal -offset indent
ABORT 'BUSY'
-.br
\&'' ATZ
-.br
OK\\r\\n ATD1234567
-.br
\\r\\n \\c
-.br
CONNECT \\c
-.br
\&'Callback login:' call_back_ID
-.br
HANGUP OFF
-.br
ABORT "Bad Login"
-.br
\&'Callback Password:' Call_back_password
-.br
TIMEOUT 120
-.br
CONNECT \\c
-.br
HANGUP ON
-.br
ABORT "NO CARRIER"
-.br
ogin:--BREAK--ogin: real_account
-.br
\fIetc ...\fR
-.SH TIMEOUT
+.Ed
+.Sh TIMEOUT
The initial timeout value is 45 seconds.
-This may be changed using the \fB-t\fR
+This may be changed using the
+.Fl t
parameter.
-.LP
+.Pp
To change the timeout value for the next expect string, the following
example may be used:
-.IP
+.Bd -literal -offset indent
ATZ OK ATDT5551212 CONNECT TIMEOUT 10 ogin:--ogin: TIMEOUT 5 assword: hello2u2
-.LP
+.Ed
+.Pp
This will change the timeout to 10 seconds when it expects the login:
prompt.
The timeout is then changed to 5 seconds when it looks for the
password prompt.
-.LP
+.Pp
The timeout, once changed, remains in effect until it is changed again.
-.SH SENDING EOT
-The special reply string of \fIEOT\fR indicates that the chat program
-should send an EOT character to the remote.
+.Sh SENDING EOT
+The special reply string of
+.Dv EOT
+indicates that the chat program
+should send an
+.Dv EOT
+character to the remote.
This is normally the
End-of-file character sequence.
A return character is not sent
-following the EOT.
-.LP
-The EOT sequence may be embedded into the send string using the
-sequence \fI^D\fR.
-.SH GENERATING BREAK
-The special reply string of \fIBREAK\fR will cause a break condition
+following the
+.Dv EOT .
+.Pp
+The
+.Dv EOT
+sequence may be embedded into the send string using the
+sequence ^D.
+.Sh GENERATING BREAK
+The special reply string of
+.Dv BREAK
+will cause a break condition
to be sent.
The break is a special signal on the transmitter.
The
normal processing on the receiver is to change the transmission rate.
It may be used to cycle through the available transmission rates on
the remote until you are able to receive a valid login prompt.
-.LP
+.Pp
The break sequence may be embedded into the send string using the
\fI\\K\fR sequence.
-.SH ESCAPE SEQUENCES
+.Sh ESCAPE SEQUENCES
The expect and reply strings may contain escape sequences.
All of the
sequences are legal in the reply string.
Many are legal in the expect.
Those which are not valid in the expect sequence are so indicated.
-.TP
-.B ''
+.Bl -tag -width indent
+.It ''
Expects or sends a null string.
If you send a null string then it will still
send the return character.
This sequence may either be a pair of apostrophe
or quote characters.
-.TP
-.B \\\\b
+.It \eb
represents a backspace character.
-.TP
-.B \\\\c
+.It \ec
Suppresses the newline at the end of the reply string.
This is the only
method to send a string without a trailing return character.
It must
be at the end of the send string.
For example,
-the sequence hello\\c will simply send the characters h, e, l, l, o.
-.I (not valid in expect.)
-.TP
-.B \\\\d
+the sequence hello\\c will simply send the characters h, e, l, l, o
+.Pq Em not valid in expect .
+.It \ed
Delay for one second.
The program uses sleep(1) which will delay to a
-maximum of one second.
-.I (not valid in expect.)
-.TP
-.B \\\\K
-Insert a BREAK
-.I (not valid in expect.)
-.TP
-.B \\\\n
+maximum of one second
+.Pq Em not valid in expect .
+.It \eK
+Insert a
+.Dv BREAK
+.Pq Em not valid in expect .
+.It \en
Send a newline or linefeed character.
-.TP
-.B \\\\N
+.It \eN
Send a null character.
-The same sequence may be represented by \\0.
-.I (not valid in expect.)
-.TP
-.B \\\\p
+The same sequence may be represented by \\0
+.Pq Em not valid in expect .
+.It \ep
Pause for a fraction of a second.
-The delay is 1/10th of a second.
-.I (not valid in expect.)
-.TP
-.B \\\\q
+The delay is 1/10th of a second
+.Pq Em not valid in expect .
+.It \eq
Suppress writing the string to
-.IR syslogd (8).
+.Xr syslogd 8 .
The string ?????? is
-written to the log in its place.
-.I (not valid in expect.)
-.TP
-.B \\\\r
+written to the log in its place
+.Pq Em not valid in expect .
+.It \er
Send or expect a carriage return.
-.TP
-.B \\\\s
+.It \es
Represents a space character in the string.
This may be used when it
is not desirable to quote the strings which contains spaces.
The
sequence 'HI TIM' and HI\\sTIM are the same.
-.TP
-.B \\\\t
+.It \et
Send or expect a tab character.
-.TP
-.B \\\\\\\\
+.It \e
Send or expect a backslash character.
-.TP
-.B \\\\ddd
+.It \eddd
Collapse the octal digits (ddd) into a single ASCII character and send that
-character.
-.I (some characters are not valid in expect.)
-.TP
-.B \^^C
+character
+.Pq Em some characters are not valid in expect .
+.It \^^C
Substitute the sequence with the control character represented by C.
-For example, the character DC1 (17) is shown as \^^Q.
-.I (some characters are not valid in expect.)
-.SH TERMINATION CODES
-The \fIchat\fR program will terminate with the following completion
+For example, the character DC1 (17) is shown as \^^Q
+.Pq Em some characters are not valid in expect .
+.El
+.Sh TERMINATION CODES
+The
+.Nm
+program will terminate with the following completion
codes.
-.TP
-.B 0
+.Bl -tag -width indent
+.It 0
The normal termination of the program.
This indicates that the script
was executed without error to the normal conclusion.
-.TP
-.B 1
+.It 1
One or more of the parameters are invalid or an expect string was too
large for the internal buffers.
This indicates that the program as not
properly executed.
-.TP
-.B 2
+.It 2
An error occurred during the execution of the program.
This may be due
to a read or write operation failing for some reason or chat receiving
-a signal such as SIGINT.
-.TP
-.B 3
-A timeout event occurred when there was an \fIexpect\fR string without
+a signal such as
+.Dv SIGINT .
+.It 3
+A timeout event occurred when there was an
+.Em expect
+string without
having a "-subsend" string.
This may mean that you did not program the
script correctly for the condition or that some unexpected event has
occurred and the expected string could not be found.
-.TP
-.B 4
-The first string marked as an \fIABORT\fR condition occurred.
-.TP
-.B 5
-The second string marked as an \fIABORT\fR condition occurred.
-.TP
-.B 6
-The third string marked as an \fIABORT\fR condition occurred.
-.TP
-.B 7
-The fourth string marked as an \fIABORT\fR condition occurred.
-.TP
-.B ...
-The other termination codes are also strings marked as an \fIABORT\fR
+.It 4
+The first string marked as an
+.Dv ABORT
+condition occurred.
+.It 5
+The second string marked as an
+.Dv ABORT
+condition occurred.
+.It 6
+The third string marked as an
+.Dv ABORT
+condition occurred.
+.It 7
+The fourth string marked as an
+.Dv ABORT
+condition occurred.
+.It ...
+The other termination codes are also strings marked as an
+.Dv ABORT
condition.
-.LP
+.El
+.Pp
Using the termination code, it is possible to determine which event
terminated the script.
It is possible to decide if the string "BUSY"
-was received from the modem as opposed to "NO DIAL TONE". While the
+was received from the modem as opposed to "NO DIAL TONE".
+While the
first event may be retried, the second will probably have little
chance of succeeding during a retry.
-.SH SEE ALSO
-Additional information about \fIchat\fR scripts may be found with UUCP
+.Sh SEE ALSO
+Additional information about
+.Nm
+scripts may be found with UUCP
documentation.
-The \fIchat\fR script was taken from the ideas proposed
-by the scripts used by the \fIuucico\fR program.
-.LP
-uucico(1), uucp(1), syslog(3), syslogd(8).
-.SH COPYRIGHT
-The \fIchat\fR program is in public domain.
+The
+.Nm
+script was taken from the ideas proposed
+by the scripts used by the uucico program.
+.Pp
+.Xr syslog 3 ,
+.Xr syslogd 8
+.Sh COPYRIGHT
+The
+.Nm
+program is in public domain.
This is not the GNU public
license.
If it breaks then you get to keep both pieces.
diff --git a/usr.bin/chat/chat.c b/usr.bin/chat/chat.c
index 86e6cfb..522762d 100644
--- a/usr.bin/chat/chat.c
+++ b/usr.bin/chat/chat.c
@@ -109,40 +109,39 @@ __FBSDID("$FreeBSD$");
#define MAX_REPORTS 50
#define DEFAULT_CHAT_TIMEOUT 45
-int echo = 0;
-int verbose = 0;
-int to_log = 1;
-int to_stderr = 0;
-int Verbose = 0;
-int quiet = 0;
-int exit_code = 0;
-FILE* report_fp = (FILE *) 0;
-char *report_file = (char *) 0;
-char *chat_file = (char *) 0;
-char *phone_num = (char *) 0;
-char *phone_num2 = (char *) 0;
-int timeout = DEFAULT_CHAT_TIMEOUT;
+static int echo;
+static int verbose;
+static int to_log;
+static int to_stderr;
+static int Verbose;
+static int quiet;
+static int exit_code;
+static FILE* report_fp;
+static char *report_file;
+static char *chat_file;
+static char *phone_num;
+static char *phone_num2;
+static int timeout = DEFAULT_CHAT_TIMEOUT;
static char blank[] = "";
-int have_tty_parameters = 0;
+static int have_tty_parameters;
#define term_parms struct termios
#define get_term_param(param) tcgetattr(0, param)
#define set_term_param(param) tcsetattr(0, TCSANOW, param)
-struct termios saved_tty_parameters;
+static struct termios saved_tty_parameters;
-char *abort_string[MAX_ABORTS], *fail_reason = (char *)0,
- fail_buffer[50];
-int n_aborts = 0, abort_next = 0, timeout_next = 0, echo_next = 0;
-int clear_abort_next = 0;
+static char *abort_string[MAX_ABORTS], *fail_reason, fail_buffer[50];
+static int n_aborts, abort_next, timeout_next, echo_next;
+static int clear_abort_next;
-char *report_string[MAX_REPORTS] ;
-char report_buffer[50] ;
-int n_reports = 0, report_next = 0, report_gathering = 0 ;
-int clear_report_next = 0;
+static char *report_string[MAX_REPORTS];
+static char report_buffer[50];
+static int n_reports, report_next, report_gathering;
+static int clear_report_next;
-int say_next = 0, hup_next = 0;
+static int say_next, hup_next;
void *dup_mem(void *b, size_t c);
void *copy_of(char *s);
@@ -396,14 +395,13 @@ usage(void)
exit(1);
}
-char line[1024];
-
/*
* Send a message to syslog and/or stderr.
*/
void
chat_logf(const char *fmt, ...)
{
+ char line[1024];
va_list args;
va_start(args, fmt);
@@ -422,6 +420,7 @@ chat_logf(const char *fmt, ...)
void
fatal(int code, const char *fmt, ...)
{
+ char line[1024];
va_list args;
va_start(args, fmt);
@@ -434,7 +433,7 @@ fatal(int code, const char *fmt, ...)
terminate(code);
}
-int alarmed = 0;
+static int alarmed;
SIGTYPE sigalrm(int signo __unused)
{
diff --git a/usr.bin/cksum/extern.h b/usr.bin/cksum/extern.h
index 7cfe507..84ec8d2 100644
--- a/usr.bin/cksum/extern.h
+++ b/usr.bin/cksum/extern.h
@@ -32,6 +32,9 @@
#include <sys/cdefs.h>
+extern uint32_t crc_total;
+extern uint32_t crc32_total;
+
__BEGIN_DECLS
int crc(int, uint32_t *, off_t *);
void pcrc(char *, uint32_t, off_t);
diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile
index 1cfa57f..db5fae7 100644
--- a/usr.bin/clang/Makefile
+++ b/usr.bin/clang/Makefile
@@ -4,7 +4,7 @@
SUBDIR= clang clang-tblgen tblgen
-.if ${MK_CLANG_EXTRAS} != "no"
+.if ${MK_CLANG_EXTRAS} != "no" && !defined(TOOLS_PREFIX)
SUBDIR+=bugpoint \
llc \
lli \
@@ -14,7 +14,6 @@ SUBDIR+=bugpoint \
llvm-diff \
llvm-dis \
llvm-extract \
- llvm-ld \
llvm-link \
llvm-mc \
llvm-nm \
@@ -22,7 +21,6 @@ SUBDIR+=bugpoint \
llvm-prof \
llvm-ranlib \
llvm-rtdyld \
- llvm-stub \
macho-dump \
opt
.endif
diff --git a/usr.bin/clang/bugpoint/bugpoint.1 b/usr.bin/clang/bugpoint/bugpoint.1
index b660e65..0e119a4 100644
--- a/usr.bin/clang/bugpoint/bugpoint.1
+++ b/usr.bin/clang/bugpoint/bugpoint.1
@@ -1,291 +1,284 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.TH "BUGPOINT" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+bugpoint \- automatic test case reduction tool
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "BUGPOINT 1"
-.TH BUGPOINT 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-bugpoint \- automatic test case reduction tool
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBbugpoint\fR [\fIoptions\fR] [\fIinput \s-1LLVM\s0 ll/bc files\fR] [\fI\s-1LLVM\s0 passes\fR] \fB\-\-args\fR
-\&\fIprogram arguments\fR
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBbugpoint\fR narrows down the source of problems in \s-1LLVM\s0 tools and passes. It
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBbugpoint\fP [\fIoptions\fP] [\fIinput LLVM ll/bc files\fP] [\fILLVM passes\fP] \fB\-\-args\fP
+\fIprogram arguments\fP
+.SH DESCRIPTION
+.sp
+\fBbugpoint\fP narrows down the source of problems in LLVM tools and passes. It
can be used to debug three types of failures: optimizer crashes, miscompilations
by optimizers, or bad native code generation (including problems in the static
-and \s-1JIT\s0 compilers). It aims to reduce large test cases to small, useful ones.
-For more information on the design and inner workings of \fBbugpoint\fR, as well as
-advice for using bugpoint, see \fIllvm/docs/Bugpoint.html\fR in the \s-1LLVM\s0
+and JIT compilers). It aims to reduce large test cases to small, useful ones.
+For more information on the design and inner workings of \fBbugpoint\fP, as well as
+advice for using bugpoint, see \fIllvm/docs/Bugpoint.html\fP in the LLVM
distribution.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-\-additional\-so\fR \fIlibrary\fR" 4
-.IX Item "--additional-so library"
-Load the dynamic shared object \fIlibrary\fR into the test program whenever it is
-run. This is useful if you are debugging programs which depend on non-LLVM
+.SH OPTIONS
+.sp
+\fB\-\-additional\-so\fP \fIlibrary\fP
+.INDENT 0.0
+.INDENT 3.5
+Load the dynamic shared object \fIlibrary\fP into the test program whenever it is
+run. This is useful if you are debugging programs which depend on non\-LLVM
libraries (such as the X or curses libraries) to run.
-.IP "\fB\-\-append\-exit\-code\fR=\fI{true,false}\fR" 4
-.IX Item "--append-exit-code={true,false}"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-append\-exit\-code\fP=\fI{true,false}\fP
+.INDENT 0.0
+.INDENT 3.5
Append the test programs exit code to the output file so that a change in exit
code is considered a test failure. Defaults to false.
-.IP "\fB\-\-args\fR \fIprogram args\fR" 4
-.IX Item "--args program args"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-args\fP \fIprogram args\fP
+.INDENT 0.0
+.INDENT 3.5
Pass all arguments specified after \-args to the test program whenever it runs.
-Note that if any of the \fIprogram args\fR start with a '\-', you should use:
-.Sp
-.Vb 1
-\& bugpoint [bugpoint args] \-\-args \-\- [program args]
-.Ve
-.Sp
-The \*(L"\-\-\*(R" right after the \fB\-\-args\fR option tells \fBbugpoint\fR to consider any
-options starting with \f(CW\*(C`\-\*(C'\fR to be part of the \fB\-\-args\fR option, not as options to
-\&\fBbugpoint\fR itself.
-.IP "\fB\-\-tool\-args\fR \fItool args\fR" 4
-.IX Item "--tool-args tool args"
-Pass all arguments specified after \-\-tool\-args to the \s-1LLVM\s0 tool under test
-(\fBllc\fR, \fBlli\fR, etc.) whenever it runs. You should use this option in the
+Note that if any of the \fIprogram args\fP start with a \(aq\-\(aq, you should use:
+.sp
+.nf
+.ft C
+bugpoint [bugpoint args] \-\-args \-\- [program args]
+.ft P
+.fi
+.sp
+The "\-\-" right after the \fB\-\-args\fP option tells \fBbugpoint\fP to consider any
+options starting with \fB\-\fP to be part of the \fB\-\-args\fP option, not as options to
+\fBbugpoint\fP itself.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-tool\-args\fP \fItool args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \-\-tool\-args to the LLVM tool under test
+(\fBllc\fP, \fBlli\fP, etc.) whenever it runs. You should use this option in the
following way:
-.Sp
-.Vb 1
-\& bugpoint [bugpoint args] \-\-tool\-args \-\- [tool args]
-.Ve
-.Sp
-The \*(L"\-\-\*(R" right after the \fB\-\-tool\-args\fR option tells \fBbugpoint\fR to consider any
-options starting with \f(CW\*(C`\-\*(C'\fR to be part of the \fB\-\-tool\-args\fR option, not as
-options to \fBbugpoint\fR itself. (See \fB\-\-args\fR, above.)
-.IP "\fB\-\-safe\-tool\-args\fR \fItool args\fR" 4
-.IX Item "--safe-tool-args tool args"
-Pass all arguments specified after \fB\-\-safe\-tool\-args\fR to the \*(L"safe\*(R" execution
+.sp
+.nf
+.ft C
+bugpoint [bugpoint args] \-\-tool\-args \-\- [tool args]
+.ft P
+.fi
+.sp
+The "\-\-" right after the \fB\-\-tool\-args\fP option tells \fBbugpoint\fP to consider any
+options starting with \fB\-\fP to be part of the \fB\-\-tool\-args\fP option, not as
+options to \fBbugpoint\fP itself. (See \fB\-\-args\fP, above.)
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-safe\-tool\-args\fP \fItool args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \fB\-\-safe\-tool\-args\fP to the "safe" execution
tool.
-.IP "\fB\-\-gcc\-tool\-args\fR \fIgcc tool args\fR" 4
-.IX Item "--gcc-tool-args gcc tool args"
-Pass all arguments specified after \fB\-\-gcc\-tool\-args\fR to the invocation of
-\&\fBgcc\fR.
-.IP "\fB\-\-opt\-args\fR \fIopt args\fR" 4
-.IX Item "--opt-args opt args"
-Pass all arguments specified after \fB\-\-opt\-args\fR to the invocation of \fBopt\fR.
-.IP "\fB\-\-disable\-{dce,simplifycfg}\fR" 4
-.IX Item "--disable-{dce,simplifycfg}"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-gcc\-tool\-args\fP \fIgcc tool args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \fB\-\-gcc\-tool\-args\fP to the invocation of
+\fBgcc\fP.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-opt\-args\fP \fIopt args\fP
+.INDENT 0.0
+.INDENT 3.5
+Pass all arguments specified after \fB\-\-opt\-args\fP to the invocation of \fBopt\fP.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-disable\-{dce,simplifycfg}\fP
+.INDENT 0.0
+.INDENT 3.5
Do not run the specified passes to clean up and reduce the size of the test
-program. By default, \fBbugpoint\fR uses these passes internally when attempting to
-reduce test programs. If you're trying to find a bug in one of these passes,
-\&\fBbugpoint\fR may crash.
-.IP "\fB\-\-enable\-valgrind\fR" 4
-.IX Item "--enable-valgrind"
+program. By default, \fBbugpoint\fP uses these passes internally when attempting to
+reduce test programs. If you\(aqre trying to find a bug in one of these passes,
+\fBbugpoint\fP may crash.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-enable\-valgrind\fP
+.INDENT 0.0
+.INDENT 3.5
Use valgrind to find faults in the optimization phase. This will allow
bugpoint to find otherwise asymptomatic problems caused by memory
-mis-management.
-.IP "\fB\-find\-bugs\fR" 4
-.IX Item "-find-bugs"
+mis\-management.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-find\-bugs\fP
+.INDENT 0.0
+.INDENT 3.5
Continually randomize the specified passes and run them on the test program
-until a bug is found or the user kills \fBbugpoint\fR.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+until a bug is found or the user kills \fBbugpoint\fP.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.IP "\fB\-\-input\fR \fIfilename\fR" 4
-.IX Item "--input filename"
-Open \fIfilename\fR and redirect the standard input of the test program, whenever
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-input\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Open \fIfilename\fP and redirect the standard input of the test program, whenever
it runs, to come from that file.
-.IP "\fB\-\-load\fR \fIplugin\fR" 4
-.IX Item "--load plugin"
-Load the dynamic object \fIplugin\fR into \fBbugpoint\fR itself. This object should
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-load\fP \fIplugin\fP
+.INDENT 0.0
+.INDENT 3.5
+Load the dynamic object \fIplugin\fP into \fBbugpoint\fP itself. This object should
register new optimization passes. Once loaded, the object will add new command
line options to enable various optimizations. To see the new complete list of
-optimizations, use the \fB\-help\fR and \fB\-\-load\fR options together; for example:
-.Sp
-.Vb 1
-\& bugpoint \-\-load myNewPass.so \-help
-.Ve
-.IP "\fB\-\-mlimit\fR \fImegabytes\fR" 4
-.IX Item "--mlimit megabytes"
+optimizations, use the \fB\-help\fP and \fB\-\-load\fP options together; for example:
+.sp
+.nf
+.ft C
+bugpoint \-\-load myNewPass.so \-help
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-mlimit\fP \fImegabytes\fP
+.INDENT 0.0
+.INDENT 3.5
Specifies an upper limit on memory usage of the optimization and codegen. Set
to zero to disable the limit.
-.IP "\fB\-\-output\fR \fIfilename\fR" 4
-.IX Item "--output filename"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-output\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
Whenever the test program produces output on its standard output stream, it
-should match the contents of \fIfilename\fR (the \*(L"reference output\*(R"). If you
-do not use this option, \fBbugpoint\fR will attempt to generate a reference output
-by compiling the program with the \*(L"safe\*(R" backend and running it.
-.IP "\fB\-\-profile\-info\-file\fR \fIfilename\fR" 4
-.IX Item "--profile-info-file filename"
-Profile file loaded by \fB\-\-profile\-loader\fR.
-.IP "\fB\-\-run\-{int,jit,llc,cbe,custom}\fR" 4
-.IX Item "--run-{int,jit,llc,cbe,custom}"
-Whenever the test program is compiled, \fBbugpoint\fR should generate code for it
+should match the contents of \fIfilename\fP (the "reference output"). If you
+do not use this option, \fBbugpoint\fP will attempt to generate a reference output
+by compiling the program with the "safe" backend and running it.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-profile\-info\-file\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Profile file loaded by \fB\-\-profile\-loader\fP.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-run\-{int,jit,llc,custom}\fP
+.INDENT 0.0
+.INDENT 3.5
+Whenever the test program is compiled, \fBbugpoint\fP should generate code for it
using the specified code generator. These options allow you to choose the
-interpreter, the \s-1JIT\s0 compiler, the static native code compiler, the C
-backend, or a custom command (see \fB\-\-exec\-command\fR) respectively.
-.IP "\fB\-\-safe\-{llc,cbe,custom}\fR" 4
-.IX Item "--safe-{llc,cbe,custom}"
-When debugging a code generator, \fBbugpoint\fR should use the specified code
-generator as the \*(L"safe\*(R" code generator. This is a known-good code generator
-used to generate the \*(L"reference output\*(R" if it has not been provided, and to
+interpreter, the JIT compiler, the static native code compiler, or a
+custom command (see \fB\-\-exec\-command\fP) respectively.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-safe\-{llc,custom}\fP
+.INDENT 0.0
+.INDENT 3.5
+When debugging a code generator, \fBbugpoint\fP should use the specified code
+generator as the "safe" code generator. This is a known\-good code generator
+used to generate the "reference output" if it has not been provided, and to
compile portions of the program that as they are excluded from the testcase.
These options allow you to choose the
-static native code compiler, the C backend, or a custom command,
-(see \fB\-\-exec\-command\fR) respectively. The interpreter and the \s-1JIT\s0 backends
-cannot currently be used as the \*(L"safe\*(R" backends.
-.IP "\fB\-\-exec\-command\fR \fIcommand\fR" 4
-.IX Item "--exec-command command"
-This option defines the command to use with the \fB\-\-run\-custom\fR and
-\&\fB\-\-safe\-custom\fR options to execute the bitcode testcase. This can
-be useful for cross-compilation.
-.IP "\fB\-\-compile\-command\fR \fIcommand\fR" 4
-.IX Item "--compile-command command"
-This option defines the command to use with the \fB\-\-compile\-custom\fR
+static native code compiler, or a custom command, (see \fB\-\-exec\-command\fP)
+respectively. The interpreter and the JIT backends cannot currently
+be used as the "safe" backends.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-exec\-command\fP \fIcommand\fP
+.INDENT 0.0
+.INDENT 3.5
+This option defines the command to use with the \fB\-\-run\-custom\fP and
+\fB\-\-safe\-custom\fP options to execute the bitcode testcase. This can
+be useful for cross\-compilation.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-compile\-command\fP \fIcommand\fP
+.INDENT 0.0
+.INDENT 3.5
+This option defines the command to use with the \fB\-\-compile\-custom\fP
option to compile the bitcode testcase. This can be useful for
testing compiler output without running any link or execute stages. To
-generate a reduced unit test, you may add \s-1CHECK\s0 directives to the
-testcase and pass the name of an executable compile-command script in this form:
-.Sp
-.Vb 3
-\& #!/bin/sh
-\& llc "$@"
-\& not FileCheck [bugpoint input file].ll < bugpoint\-test\-program.s
-.Ve
-.Sp
-This script will \*(L"fail\*(R" as long as FileCheck passes. So the result
+generate a reduced unit test, you may add CHECK directives to the
+testcase and pass the name of an executable compile\-command script in this form:
+.sp
+.nf
+.ft C
+#!/bin/sh
+llc "$@"
+not FileCheck [bugpoint input file].ll < bugpoint\-test\-program.s
+.ft P
+.fi
+.sp
+This script will "fail" as long as FileCheck passes. So the result
will be the minimum bitcode that passes FileCheck.
-.IP "\fB\-\-safe\-path\fR \fIpath\fR" 4
-.IX Item "--safe-path path"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-safe\-path\fP \fIpath\fP
+.INDENT 0.0
+.INDENT 3.5
This option defines the path to the command to execute with the
-\&\fB\-\-safe\-{int,jit,llc,cbe,custom}\fR
+\fB\-\-safe\-{int,jit,llc,custom}\fP
option.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBbugpoint\fR succeeds in finding a problem, it will exit with 0. Otherwise,
-if an error occurs, it will exit with a non-zero value.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-opt
-.SH "AUTHOR"
-.IX Header "AUTHOR"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBbugpoint\fP succeeds in finding a problem, it will exit with 0. Otherwise,
+if an error occurs, it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+opt|opt
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/clang-tblgen/Makefile b/usr.bin/clang/clang-tblgen/Makefile
index aedbeb4..bc949ec 100644
--- a/usr.bin/clang/clang-tblgen/Makefile
+++ b/usr.bin/clang/clang-tblgen/Makefile
@@ -13,6 +13,7 @@ SRCS= ClangASTNodesEmitter.cpp \
TableGen.cpp
LLVM_REQUIRES_EH=
-LIBDEPS=llvmtablegen llvmsupport
+LIBDEPS=llvmtablegen \
+ llvmsupport
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk
index bf64177..9ebac4f 100644
--- a/usr.bin/clang/clang.prog.mk
+++ b/usr.bin/clang/clang.prog.mk
@@ -1,14 +1,14 @@
# $FreeBSD$
-LLVM_SRCS=${.CURDIR}/../../../contrib/llvm
+LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm
.include "../../lib/clang/clang.build.mk"
.for lib in ${LIBDEPS}
-DPADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
-LDADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
+DPADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
+LDADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
.endfor
-BINDIR?=/usr/bin
+BINDIR?= /usr/bin
.include <bsd.prog.mk>
diff --git a/usr.bin/clang/clang/Makefile b/usr.bin/clang/clang/Makefile
index 946dea9..7c8f0e4 100644
--- a/usr.bin/clang/clang/Makefile
+++ b/usr.bin/clang/clang/Makefile
@@ -9,6 +9,10 @@ SRCS= cc1_main.cpp \
cc1as_main.cpp \
driver.cpp
+.if ${MK_SHARED_TOOLCHAIN} == "no"
+NO_SHARED?= yes
+.endif
+
LINKS= ${BINDIR}/clang ${BINDIR}/clang++ \
${BINDIR}/clang ${BINDIR}/clang-cpp
MLINKS= clang.1 clang++.1 \
@@ -23,7 +27,6 @@ MLINKS+= clang.1 cc.1 \
.endif
TGHDRS= CC1AsOptions \
- CC1Options \
DiagnosticCommonKinds \
DiagnosticDriverKinds \
DiagnosticFrontendKinds \
@@ -55,23 +58,23 @@ LIBDEPS=clangfrontendtool \
llvmbitwriter \
llvmbitreader \
llvmasmparser \
- llvmmipsasmparser \
- llvmmipscodegen \
- llvmmipsdesc \
- llvmmipsinfo \
- llvmmipsinstprinter \
llvmarmdisassembler \
llvmarmasmparser \
llvmarmcodegen \
llvmarmdesc \
llvmarminfo \
llvmarminstprinter \
+ llvmmipscodegen \
+ llvmmipsdisassembler \
+ llvmmipsasmparser \
+ llvmmipsdesc \
+ llvmmipsinfo \
+ llvmmipsinstprinter \
llvmpowerpccodegen \
llvmpowerpcdesc \
llvmpowerpcinfo \
llvmpowerpcinstprinter \
llvmx86asmparser \
- llvmx86disassembler \
llvmx86codegen \
llvmselectiondag \
llvmasmprinter \
@@ -82,6 +85,7 @@ LIBDEPS=clangfrontendtool \
llvmtransformutils \
llvmipa \
llvmanalysis \
+ llvmx86disassembler \
llvmx86desc \
llvmx86info \
llvmtarget \
diff --git a/usr.bin/clang/clang/clang.1 b/usr.bin/clang/clang/clang.1
index 7fd800b..214fe0e 100644
--- a/usr.bin/clang/clang/clang.1
+++ b/usr.bin/clang/clang/clang.1
@@ -1,5 +1,5 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -125,7 +125,7 @@
.\" ========================================================================
.\"
.IX Title "CLANG 1"
-.TH CLANG 1 "2012-04-05" "clang 3.1" "Clang Tools Documentation"
+.TH CLANG 1 "2012-08-09" "clang 3.2" "Clang Tools Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -358,6 +358,13 @@ This flag sets the default visibility level.
.IX Item "-fcommon"
This flag specifies that variables without initializers get common linkage. It
can be disabled with \fB\-fno\-common\fR.
+.IP "\fB\-ftls\-model\fR" 4
+.IX Item "-ftls-model"
+Set the default thread-local storage (\s-1TLS\s0) model to use for thread-local
+variables. Valid values are: \*(L"global-dynamic\*(R", \*(L"local-dynamic\*(R", \*(L"initial-exec\*(R"
+and \*(L"local-exec\*(R". The default is \*(L"global-dynamic\*(R". The default model can be
+overridden with the tls_model attribute. The compiler will try to choose a more
+efficient model if possible.
.IP "\fB\-flto\fR \fB\-emit\-llvm\fR" 4
.IX Item "-flto -emit-llvm"
Generate output files in \s-1LLVM\s0 formats, suitable for link time optimization. When
diff --git a/usr.bin/clang/llc/Makefile b/usr.bin/clang/llc/Makefile
index db5f12d..b99f876 100644
--- a/usr.bin/clang/llc/Makefile
+++ b/usr.bin/clang/llc/Makefile
@@ -11,20 +11,20 @@ LIBDEPS=llvmasmparser \
llvmarmasmparser \
llvmarmcodegen \
llvmarmdesc \
- llvmarminstprinter \
llvmarminfo \
+ llvmarminstprinter \
llvmmipscodegen \
+ llvmmipsdisassembler \
+ llvmmipsasmparser \
llvmmipsdesc \
- llvmmipsinstprinter \
llvmmipsinfo \
+ llvmmipsinstprinter \
llvmpowerpccodegen \
llvmpowerpcdesc \
- llvmpowerpcinstprinter \
llvmpowerpcinfo \
- llvmx86disassembler \
+ llvmpowerpcinstprinter \
llvmx86asmparser \
llvmx86codegen \
- llvmx86desc \
llvmselectiondag \
llvmasmprinter \
llvmmcparser \
@@ -34,12 +34,15 @@ LIBDEPS=llvmasmparser \
llvmtransformutils \
llvmipa \
llvmanalysis \
+ llvmx86disassembler \
+ llvmx86desc \
+ llvmx86info \
llvmtarget \
llvmx86instprinter \
+ llvmmc \
+ llvmobject \
llvmx86utils \
llvmcore \
- llvmx86info \
- llvmmc \
llvmsupport
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llc/llc.1 b/usr.bin/clang/llc/llc.1
index 588cf1b..b7862db 100644
--- a/usr.bin/clang/llc/llc.1
+++ b/usr.bin/clang/llc/llc.1
@@ -1,285 +1,276 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.TH "LLC" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llc \- LLVM static compiler
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLC 1"
-.TH LLC 1 "2012-04-06" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llc \- LLVM static compiler
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllc\fR [\fIoptions\fR] [\fIfilename\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllc\fR command compiles \s-1LLVM\s0 source inputs into assembly language for a
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllc\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBllc\fP command compiles LLVM source inputs into assembly language for a
specified architecture. The assembly language output can then be passed through
a native assembler and linker to generate a native executable.
-.PP
+.sp
The choice of architecture for the output assembly code is automatically
-determined from the input file, unless the \fB\-march\fR option is used to override
+determined from the input file, unless the \fB\-march\fP option is used to override
the default.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-If \fIfilename\fR is \- or omitted, \fBllc\fR reads from standard input. Otherwise, it
-will from \fIfilename\fR. Inputs can be in either the \s-1LLVM\s0 assembly language
-format (.ll) or the \s-1LLVM\s0 bitcode format (.bc).
-.PP
-If the \fB\-o\fR option is omitted, then \fBllc\fR will send its output to standard
-output if the input is from standard input. If the \fB\-o\fR option specifies \-,
+.SH OPTIONS
+.sp
+If \fIfilename\fP is \- or omitted, \fBllc\fP reads from standard input. Otherwise, it
+will from \fIfilename\fP. Inputs can be in either the LLVM assembly language
+format (.ll) or the LLVM bitcode format (.bc).
+.sp
+If the \fB\-o\fP option is omitted, then \fBllc\fP will send its output to standard
+output if the input is from standard input. If the \fB\-o\fP option specifies \-,
then the output will also be sent to standard output.
-.PP
-If no \fB\-o\fR option is specified and an input file other than \- is specified,
-then \fBllc\fR creates the output filename by taking the input filename,
-removing any existing \fI.bc\fR extension, and adding a \fI.s\fR suffix.
-.PP
-Other \fBllc\fR options are as follows:
-.SS "End-user Options"
-.IX Subsection "End-user Options"
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+.sp
+If no \fB\-o\fP option is specified and an input file other than \- is specified,
+then \fBllc\fP creates the output filename by taking the input filename,
+removing any existing \fI.bc\fP extension, and adding a \fI.s\fP suffix.
+.sp
+Other \fBllc\fP options are as follows:
+.SS End\-user Options
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.IP "\fB\-O\fR=\fIuint\fR" 4
-.IX Item "-O=uint"
-Generate code at different optimization levels. These correspond to the \fI\-O0\fR,
-\&\fI\-O1\fR, \fI\-O2\fR, and \fI\-O3\fR optimization levels used by \fBllvm-gcc\fR and
-\&\fBclang\fR.
-.IP "\fB\-mtriple\fR=\fItarget triple\fR" 4
-.IX Item "-mtriple=target triple"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-O\fP=\fIuint\fP
+.INDENT 0.0
+.INDENT 3.5
+Generate code at different optimization levels. These correspond to the \fI\-O0\fP,
+\fI\-O1\fP, \fI\-O2\fP, and \fI\-O3\fP optimization levels used by \fBllvm\-gcc\fP and
+\fBclang\fP.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-mtriple\fP=\fItarget triple\fP
+.INDENT 0.0
+.INDENT 3.5
Override the target triple specified in the input file with the specified
string.
-.IP "\fB\-march\fR=\fIarch\fR" 4
-.IX Item "-march=arch"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-march\fP=\fIarch\fP
+.INDENT 0.0
+.INDENT 3.5
Specify the architecture for which to generate assembly, overriding the target
-encoded in the input file. See the output of \fBllc \-help\fR for a list of
+encoded in the input file. See the output of \fBllc \-help\fP for a list of
valid architectures. By default this is inferred from the target triple or
autodetected to the current architecture.
-.IP "\fB\-mcpu\fR=\fIcpuname\fR" 4
-.IX Item "-mcpu=cpuname"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-mcpu\fP=\fIcpuname\fP
+.INDENT 0.0
+.INDENT 3.5
Specify a specific chip in the current architecture to generate code for.
-By default this is inferred from the target triple and autodetected to
+By default this is inferred from the target triple and autodetected to
the current architecture. For a list of available CPUs, use:
-\&\fBllvm-as < /dev/null | llc \-march=xyz \-mcpu=help\fR
-.IP "\fB\-mattr\fR=\fIa1,+a2,\-a3,...\fR" 4
-.IX Item "-mattr=a1,+a2,-a3,..."
-Override or control specific attributes of the target, such as whether \s-1SIMD\s0
+\fBllvm\-as < /dev/null | llc \-march=xyz \-mcpu=help\fP
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-mattr\fP=\fIa1,+a2,\-a3,...\fP
+.INDENT 0.0
+.INDENT 3.5
+Override or control specific attributes of the target, such as whether SIMD
operations are enabled or not. The default set of attributes is set by the
-current \s-1CPU\s0. For a list of available attributes, use:
-\&\fBllvm-as < /dev/null | llc \-march=xyz \-mattr=help\fR
-.IP "\fB\-\-disable\-fp\-elim\fR" 4
-.IX Item "--disable-fp-elim"
+current CPU. For a list of available attributes, use:
+\fBllvm\-as < /dev/null | llc \-march=xyz \-mattr=help\fP
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-disable\-fp\-elim\fP
+.INDENT 0.0
+.INDENT 3.5
Disable frame pointer elimination optimization.
-.IP "\fB\-\-disable\-excess\-fp\-precision\fR" 4
-.IX Item "--disable-excess-fp-precision"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-disable\-excess\-fp\-precision\fP
+.INDENT 0.0
+.INDENT 3.5
Disable optimizations that may produce excess precision for floating point.
Note that this option can dramatically slow down code on some systems
(e.g. X86).
-.IP "\fB\-\-enable\-no\-infs\-fp\-math\fR" 4
-.IX Item "--enable-no-infs-fp-math"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-enable\-no\-infs\-fp\-math\fP
+.INDENT 0.0
+.INDENT 3.5
Enable optimizations that assume no Inf values.
-.IP "\fB\-\-enable\-no\-nans\-fp\-math\fR" 4
-.IX Item "--enable-no-nans-fp-math"
-Enable optimizations that assume no \s-1NAN\s0 values.
-.IP "\fB\-\-enable\-unsafe\-fp\-math\fR" 4
-.IX Item "--enable-unsafe-fp-math"
-Enable optimizations that make unsafe assumptions about \s-1IEEE\s0 math (e.g. that
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-enable\-no\-nans\-fp\-math\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable optimizations that assume no NAN values.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-enable\-unsafe\-fp\-math\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
addition is associative) or may not work for all input ranges. These
optimizations allow the code generator to make use of some instructions which
would otherwise not be usable (such as fsin on X86).
-.IP "\fB\-\-enable\-correct\-eh\-support\fR" 4
-.IX Item "--enable-correct-eh-support"
-Instruct the \fBlowerinvoke\fR pass to insert code for correct exception handling
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-enable\-correct\-eh\-support\fP
+.INDENT 0.0
+.INDENT 3.5
+Instruct the \fBlowerinvoke\fP pass to insert code for correct exception handling
support. This is expensive and is by default omitted for efficiency.
-.IP "\fB\-\-stats\fR" 4
-.IX Item "--stats"
-Print statistics recorded by code-generation passes.
-.IP "\fB\-\-time\-passes\fR" 4
-.IX Item "--time-passes"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-stats\fP
+.INDENT 0.0
+.INDENT 3.5
+Print statistics recorded by code\-generation passes.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-time\-passes\fP
+.INDENT 0.0
+.INDENT 3.5
Record the amount of time needed for each pass and print a report to standard
error.
-.IP "\fB\-\-load\fR=\fIdso_path\fR" 4
-.IX Item "--load=dso_path"
-Dynamically load \fIdso_path\fR (a path to a dynamically shared object) that
-implements an \s-1LLVM\s0 target. This will permit the target name to be used with the
-\&\fB\-march\fR option so that code can be generated for that target.
-.SS "Tuning/Configuration Options"
-.IX Subsection "Tuning/Configuration Options"
-.IP "\fB\-\-print\-machineinstrs\fR" 4
-.IX Item "--print-machineinstrs"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-load\fP=\fIdso_path\fP
+.INDENT 0.0
+.INDENT 3.5
+Dynamically load \fIdso_path\fP (a path to a dynamically shared object) that
+implements an LLVM target. This will permit the target name to be used with the
+\fB\-march\fP option so that code can be generated for that target.
+.UNINDENT
+.UNINDENT
+.SS Tuning/Configuration Options
+.sp
+\fB\-\-print\-machineinstrs\fP
+.INDENT 0.0
+.INDENT 3.5
Print generated machine code between compilation phases (useful for debugging).
-.IP "\fB\-\-regalloc\fR=\fIallocator\fR" 4
-.IX Item "--regalloc=allocator"
-Specify the register allocator to use. The default \fIallocator\fR is \fIlocal\fR.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-regalloc\fP=\fIallocator\fP
+.INDENT 0.0
+.INDENT 3.5
+Specify the register allocator to use. The default \fIallocator\fP is \fIlocal\fP.
Valid register allocators are:
-.RS 4
-.IP "\fIsimple\fR" 4
-.IX Item "simple"
-Very simple \*(L"always spill\*(R" register allocator
-.IP "\fIlocal\fR" 4
-.IX Item "local"
+.sp
+\fIsimple\fP
+.INDENT 0.0
+.INDENT 3.5
+Very simple "always spill" register allocator
+.UNINDENT
+.UNINDENT
+.sp
+\fIlocal\fP
+.INDENT 0.0
+.INDENT 3.5
Local register allocator
-.IP "\fIlinearscan\fR" 4
-.IX Item "linearscan"
+.UNINDENT
+.UNINDENT
+.sp
+\fIlinearscan\fP
+.INDENT 0.0
+.INDENT 3.5
Linear scan global register allocator
-.IP "\fIiterativescan\fR" 4
-.IX Item "iterativescan"
+.UNINDENT
+.UNINDENT
+.sp
+\fIiterativescan\fP
+.INDENT 0.0
+.INDENT 3.5
Iterative scan global register allocator
-.RE
-.RS 4
-.RE
-.IP "\fB\-\-spiller\fR=\fIspiller\fR" 4
-.IX Item "--spiller=spiller"
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-spiller\fP=\fIspiller\fP
+.INDENT 0.0
+.INDENT 3.5
Specify the spiller to use for register allocators that support it. Currently
this option is used only by the linear scan register allocator. The default
-\&\fIspiller\fR is \fIlocal\fR. Valid spillers are:
-.RS 4
-.IP "\fIsimple\fR" 4
-.IX Item "simple"
+\fIspiller\fP is \fIlocal\fP. Valid spillers are:
+.sp
+\fIsimple\fP
+.INDENT 0.0
+.INDENT 3.5
Simple spiller
-.IP "\fIlocal\fR" 4
-.IX Item "local"
+.UNINDENT
+.UNINDENT
+.sp
+\fIlocal\fP
+.INDENT 0.0
+.INDENT 3.5
Local spiller
-.RE
-.RS 4
-.RE
-.SS "Intel IA\-32\-specific Options"
-.IX Subsection "Intel IA-32-specific Options"
-.IP "\fB\-\-x86\-asm\-syntax=att|intel\fR" 4
-.IX Item "--x86-asm-syntax=att|intel"
-Specify whether to emit assembly code in \s-1AT&T\s0 syntax (the default) or intel
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.SS Intel IA\-32\-specific Options
+.sp
+\fB\-\-x86\-asm\-syntax=att|intel\fP
+.INDENT 0.0
+.INDENT 3.5
+Specify whether to emit assembly code in AT&T syntax (the default) or intel
syntax.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllc\fR succeeds, it will exit with 0. Otherwise, if an error occurs,
-it will exit with a non-zero value.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-lli
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllc\fP succeeds, it will exit with 0. Otherwise, if an error occurs,
+it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+lli|lli
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/lli/lli.1 b/usr.bin/clang/lli/lli.1
index 87f4cf8..e018a95 100644
--- a/usr.bin/clang/lli/lli.1
+++ b/usr.bin/clang/lli/lli.1
@@ -1,310 +1,326 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.TH "LLI" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+lli \- directly execute programs from LLVM bitcode
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLI 1"
-.TH LLI 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-lli \- directly execute programs from LLVM bitcode
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBlli\fR [\fIoptions\fR] [\fIfilename\fR] [\fIprogram args\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBlli\fR directly executes programs in \s-1LLVM\s0 bitcode format. It takes a program
-in \s-1LLVM\s0 bitcode format and executes it using a just-in-time compiler, if one is
-available for the current architecture, or an interpreter. \fBlli\fR takes all of
-the same code generator options as llc, but they are only effective when
-\&\fBlli\fR is using the just-in-time compiler.
-.PP
-If \fIfilename\fR is not specified, then \fBlli\fR reads the \s-1LLVM\s0 bitcode for the
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBlli\fP [\fIoptions\fP] [\fIfilename\fP] [\fIprogram args\fP]
+.SH DESCRIPTION
+.sp
+\fBlli\fP directly executes programs in LLVM bitcode format. It takes a program
+in LLVM bitcode format and executes it using a just\-in\-time compiler, if one is
+available for the current architecture, or an interpreter. \fBlli\fP takes all of
+the same code generator options as llc|llc, but they are only effective when
+\fBlli\fP is using the just\-in\-time compiler.
+.sp
+If \fIfilename\fP is not specified, then \fBlli\fP reads the LLVM bitcode for the
program from standard input.
-.PP
-The optional \fIargs\fR specified on the command line are passed to the program as
+.sp
+The optional \fIargs\fP specified on the command line are passed to the program as
arguments.
-.SH "GENERAL OPTIONS"
-.IX Header "GENERAL OPTIONS"
-.IP "\fB\-fake\-argv0\fR=\fIexecutable\fR" 4
-.IX Item "-fake-argv0=executable"
-Override the \f(CW\*(C`argv[0]\*(C'\fR value passed into the executing program.
-.IP "\fB\-force\-interpreter\fR=\fI{false,true}\fR" 4
-.IX Item "-force-interpreter={false,true}"
-If set to true, use the interpreter even if a just-in-time compiler is available
+.SH GENERAL OPTIONS
+.sp
+\fB\-fake\-argv0\fP=\fIexecutable\fP
+.INDENT 0.0
+.INDENT 3.5
+Override the \fBargv[0]\fP value passed into the executing program.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-force\-interpreter\fP=\fI{false,true}\fP
+.INDENT 0.0
+.INDENT 3.5
+If set to true, use the interpreter even if a just\-in\-time compiler is available
for this architecture. Defaults to false.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.IP "\fB\-load\fR=\fIpuginfilename\fR" 4
-.IX Item "-load=puginfilename"
-Causes \fBlli\fR to load the plugin (shared object) named \fIpluginfilename\fR and use
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-load\fP=\fIpuginfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Causes \fBlli\fP to load the plugin (shared object) named \fIpluginfilename\fP and use
it for optimization.
-.IP "\fB\-stats\fR" 4
-.IX Item "-stats"
-Print statistics from the code-generation passes. This is only meaningful for
-the just-in-time compiler, at present.
-.IP "\fB\-time\-passes\fR" 4
-.IX Item "-time-passes"
-Record the amount of time needed for each code-generation pass and print it to
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-stats\fP
+.INDENT 0.0
+.INDENT 3.5
+Print statistics from the code\-generation passes. This is only meaningful for
+the just\-in\-time compiler, at present.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-time\-passes\fP
+.INDENT 0.0
+.INDENT 3.5
+Record the amount of time needed for each code\-generation pass and print it to
standard error.
-.IP "\fB\-version\fR" 4
-.IX Item "-version"
-Print out the version of \fBlli\fR and exit without doing anything else.
-.SH "TARGET OPTIONS"
-.IX Header "TARGET OPTIONS"
-.IP "\fB\-mtriple\fR=\fItarget triple\fR" 4
-.IX Item "-mtriple=target triple"
-Override the target triple specified in the input bitcode file with the
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-version\fP
+.INDENT 0.0
+.INDENT 3.5
+Print out the version of \fBlli\fP and exit without doing anything else.
+.UNINDENT
+.UNINDENT
+.SH TARGET OPTIONS
+.sp
+\fB\-mtriple\fP=\fItarget triple\fP
+.INDENT 0.0
+.INDENT 3.5
+Override the target triple specified in the input bitcode file with the
specified string. This may result in a crash if you pick an
architecture which is not compatible with the current system.
-.IP "\fB\-march\fR=\fIarch\fR" 4
-.IX Item "-march=arch"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-march\fP=\fIarch\fP
+.INDENT 0.0
+.INDENT 3.5
Specify the architecture for which to generate assembly, overriding the target
-encoded in the bitcode file. See the output of \fBllc \-help\fR for a list of
+encoded in the bitcode file. See the output of \fBllc \-help\fP for a list of
valid architectures. By default this is inferred from the target triple or
autodetected to the current architecture.
-.IP "\fB\-mcpu\fR=\fIcpuname\fR" 4
-.IX Item "-mcpu=cpuname"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-mcpu\fP=\fIcpuname\fP
+.INDENT 0.0
+.INDENT 3.5
Specify a specific chip in the current architecture to generate code for.
-By default this is inferred from the target triple and autodetected to
+By default this is inferred from the target triple and autodetected to
the current architecture. For a list of available CPUs, use:
-\&\fBllvm-as < /dev/null | llc \-march=xyz \-mcpu=help\fR
-.IP "\fB\-mattr\fR=\fIa1,+a2,\-a3,...\fR" 4
-.IX Item "-mattr=a1,+a2,-a3,..."
-Override or control specific attributes of the target, such as whether \s-1SIMD\s0
+\fBllvm\-as < /dev/null | llc \-march=xyz \-mcpu=help\fP
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-mattr\fP=\fIa1,+a2,\-a3,...\fP
+.INDENT 0.0
+.INDENT 3.5
+Override or control specific attributes of the target, such as whether SIMD
operations are enabled or not. The default set of attributes is set by the
-current \s-1CPU\s0. For a list of available attributes, use:
-\&\fBllvm-as < /dev/null | llc \-march=xyz \-mattr=help\fR
-.SH "FLOATING POINT OPTIONS"
-.IX Header "FLOATING POINT OPTIONS"
-.IP "\fB\-disable\-excess\-fp\-precision\fR" 4
-.IX Item "-disable-excess-fp-precision"
+current CPU. For a list of available attributes, use:
+\fBllvm\-as < /dev/null | llc \-march=xyz \-mattr=help\fP
+.UNINDENT
+.UNINDENT
+.SH FLOATING POINT OPTIONS
+.sp
+\fB\-disable\-excess\-fp\-precision\fP
+.INDENT 0.0
+.INDENT 3.5
Disable optimizations that may increase floating point precision.
-.IP "\fB\-enable\-no\-infs\-fp\-math\fR" 4
-.IX Item "-enable-no-infs-fp-math"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-enable\-no\-infs\-fp\-math\fP
+.INDENT 0.0
+.INDENT 3.5
Enable optimizations that assume no Inf values.
-.IP "\fB\-enable\-no\-nans\-fp\-math\fR" 4
-.IX Item "-enable-no-nans-fp-math"
-Enable optimizations that assume no \s-1NAN\s0 values.
-.IP "\fB\-enable\-unsafe\-fp\-math\fR" 4
-.IX Item "-enable-unsafe-fp-math"
-Causes \fBlli\fR to enable optimizations that may decrease floating point
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-enable\-no\-nans\-fp\-math\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable optimizations that assume no NAN values.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-enable\-unsafe\-fp\-math\fP
+.INDENT 0.0
+.INDENT 3.5
+Causes \fBlli\fP to enable optimizations that may decrease floating point
precision.
-.IP "\fB\-soft\-float\fR" 4
-.IX Item "-soft-float"
-Causes \fBlli\fR to generate software floating point library calls instead of
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-soft\-float\fP
+.INDENT 0.0
+.INDENT 3.5
+Causes \fBlli\fP to generate software floating point library calls instead of
equivalent hardware instructions.
-.SH "CODE GENERATION OPTIONS"
-.IX Header "CODE GENERATION OPTIONS"
-.IP "\fB\-code\-model\fR=\fImodel\fR" 4
-.IX Item "-code-model=model"
+.UNINDENT
+.UNINDENT
+.SH CODE GENERATION OPTIONS
+.sp
+\fB\-code\-model\fP=\fImodel\fP
+.INDENT 0.0
+.INDENT 3.5
Choose the code model from:
-.Sp
-.Vb 5
-\& default: Target default code model
-\& small: Small code model
-\& kernel: Kernel code model
-\& medium: Medium code model
-\& large: Large code model
-.Ve
-.IP "\fB\-disable\-post\-RA\-scheduler\fR" 4
-.IX Item "-disable-post-RA-scheduler"
+.sp
+.nf
+.ft C
+default: Target default code model
+small: Small code model
+kernel: Kernel code model
+medium: Medium code model
+large: Large code model
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-disable\-post\-RA\-scheduler\fP
+.INDENT 0.0
+.INDENT 3.5
Disable scheduling after register allocation.
-.IP "\fB\-disable\-spill\-fusing\fR" 4
-.IX Item "-disable-spill-fusing"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-disable\-spill\-fusing\fP
+.INDENT 0.0
+.INDENT 3.5
Disable fusing of spill code into instructions.
-.IP "\fB\-enable\-correct\-eh\-support\fR" 4
-.IX Item "-enable-correct-eh-support"
-Make the \-lowerinvoke pass insert expensive, but correct, \s-1EH\s0 code.
-.IP "\fB\-jit\-enable\-eh\fR" 4
-.IX Item "-jit-enable-eh"
-Exception handling should be enabled in the just-in-time compiler.
-.IP "\fB\-join\-liveintervals\fR" 4
-.IX Item "-join-liveintervals"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-enable\-correct\-eh\-support\fP
+.INDENT 0.0
+.INDENT 3.5
+Make the \-lowerinvoke pass insert expensive, but correct, EH code.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-jit\-enable\-eh\fP
+.INDENT 0.0
+.INDENT 3.5
+Exception handling should be enabled in the just\-in\-time compiler.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-join\-liveintervals\fP
+.INDENT 0.0
+.INDENT 3.5
Coalesce copies (default=true).
-.IP "\fB\-nozero\-initialized\-in\-bss\fR Don't place zero-initialized symbols into the \s-1BSS\s0 section." 4
-.IX Item "-nozero-initialized-in-bss Don't place zero-initialized symbols into the BSS section."
-.PD 0
-.IP "\fB\-pre\-RA\-sched\fR=\fIscheduler\fR" 4
-.IX Item "-pre-RA-sched=scheduler"
-.PD
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-nozero\-initialized\-in\-bss\fP Don\(aqt place zero\-initialized symbols into the BSS section.
+.sp
+\fB\-pre\-RA\-sched\fP=\fIscheduler\fP
+.INDENT 0.0
+.INDENT 3.5
Instruction schedulers available (before register allocation):
-.Sp
-.Vb 7
-\& =default: Best scheduler for the target
-\& =none: No scheduling: breadth first sequencing
-\& =simple: Simple two pass scheduling: minimize critical path and maximize processor utilization
-\& =simple\-noitin: Simple two pass scheduling: Same as simple except using generic latency
-\& =list\-burr: Bottom\-up register reduction list scheduling
-\& =list\-tdrr: Top\-down register reduction list scheduling
-\& =list\-td: Top\-down list scheduler \-print\-machineinstrs \- Print generated machine code
-.Ve
-.IP "\fB\-regalloc\fR=\fIallocator\fR" 4
-.IX Item "-regalloc=allocator"
+.sp
+.nf
+.ft C
+=default: Best scheduler for the target
+=none: No scheduling: breadth first sequencing
+=simple: Simple two pass scheduling: minimize critical path and maximize processor utilization
+=simple\-noitin: Simple two pass scheduling: Same as simple except using generic latency
+=list\-burr: Bottom\-up register reduction list scheduling
+=list\-tdrr: Top\-down register reduction list scheduling
+=list\-td: Top\-down list scheduler \-print\-machineinstrs \- Print generated machine code
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-regalloc\fP=\fIallocator\fP
+.INDENT 0.0
+.INDENT 3.5
Register allocator to use (default=linearscan)
-.Sp
-.Vb 3
-\& =bigblock: Big\-block register allocator
-\& =linearscan: linear scan register allocator =local \- local register allocator
-\& =simple: simple register allocator
-.Ve
-.IP "\fB\-relocation\-model\fR=\fImodel\fR" 4
-.IX Item "-relocation-model=model"
+.sp
+.nf
+.ft C
+=bigblock: Big\-block register allocator
+=linearscan: linear scan register allocator =local \- local register allocator
+=simple: simple register allocator
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-relocation\-model\fP=\fImodel\fP
+.INDENT 0.0
+.INDENT 3.5
Choose relocation model from:
-.Sp
-.Vb 3
-\& =default: Target default relocation model
-\& =static: Non\-relocatable code =pic \- Fully relocatable, position independent code
-\& =dynamic\-no\-pic: Relocatable external references, non\-relocatable code
-.Ve
-.IP "\fB\-spiller\fR" 4
-.IX Item "-spiller"
+.sp
+.nf
+.ft C
+=default: Target default relocation model
+=static: Non\-relocatable code =pic \- Fully relocatable, position independent code
+=dynamic\-no\-pic: Relocatable external references, non\-relocatable code
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-spiller\fP
+.INDENT 0.0
+.INDENT 3.5
Spiller to use (default=local)
-.Sp
-.Vb 2
-\& =simple: simple spiller
-\& =local: local spiller
-.Ve
-.IP "\fB\-x86\-asm\-syntax\fR=\fIsyntax\fR" 4
-.IX Item "-x86-asm-syntax=syntax"
+.sp
+.nf
+.ft C
+=simple: simple spiller
+=local: local spiller
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-x86\-asm\-syntax\fP=\fIsyntax\fP
+.INDENT 0.0
+.INDENT 3.5
Choose style of code to emit from X86 backend:
-.Sp
-.Vb 2
-\& =att: Emit AT&T\-style assembly
-\& =intel: Emit Intel\-style assembly
-.Ve
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBlli\fR fails to load the program, it will exit with an exit code of 1.
+.sp
+.nf
+.ft C
+=att: Emit AT&T\-style assembly
+=intel: Emit Intel\-style assembly
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBlli\fP fails to load the program, it will exit with an exit code of 1.
Otherwise, it will return the exit code of the program it executes.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-llc
-.SH "AUTHOR"
-.IX Header "AUTHOR"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.SH SEE ALSO
+.sp
+llc|llc
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-ar/llvm-ar.1 b/usr.bin/clang/llvm-ar/llvm-ar.1
index bd681b4..84a978f 100644
--- a/usr.bin/clang/llvm-ar/llvm-ar.1
+++ b/usr.bin/clang/llvm-ar/llvm-ar.1
@@ -1,461 +1,484 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-AR" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-ar \- LLVM archiver
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-AR 1"
-.TH LLVM-AR 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-ar \- LLVM archiver
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-ar\fR [\-]{dmpqrtx}[Rabfikouz] [relpos] [count] <archive> [files...]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllvm-ar\fR command is similar to the common Unix utility, \f(CW\*(C`ar\*(C'\fR. It
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-ar\fP [\-]{dmpqrtx}[Rabfikou] [relpos] [count] <archive> [files...]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-ar\fP command is similar to the common Unix utility, \fBar\fP. It
archives several files together into a single file. The intent for this is
-to produce archive libraries by \s-1LLVM\s0 bitcode that can be linked into an
-\&\s-1LLVM\s0 program. However, the archive can contain any kind of file. By default,
-\&\fBllvm-ar\fR generates a symbol table that makes linking faster because
+to produce archive libraries by LLVM bitcode that can be linked into an
+LLVM program. However, the archive can contain any kind of file. By default,
+\fBllvm\-ar\fP generates a symbol table that makes linking faster because
only the symbol table needs to be consulted, not each individual file member
of the archive.
-.PP
-The \fBllvm-ar\fR command can be used to \fIread\fR both \s-1SVR4\s0 and \s-1BSD\s0 style archive
-files. However, it cannot be used to write them. While the \fBllvm-ar\fR command
-produces files that are \fIalmost\fR identical to the format used by other \f(CW\*(C`ar\*(C'\fR
-implementations, it has two significant departures in order to make the
-archive appropriate for \s-1LLVM\s0. The first departure is that \fBllvm-ar\fR only
-uses \s-1BSD4\s0.4 style long path names (stored immediately after the header) and
+.sp
+The \fBllvm\-ar\fP command can be used to \fIread\fP both SVR4 and BSD style archive
+files. However, it cannot be used to write them. While the \fBllvm\-ar\fP command
+produces files that are \fIalmost\fP identical to the format used by other \fBar\fP
+implementations, it has two significant departures in order to make the
+archive appropriate for LLVM. The first departure is that \fBllvm\-ar\fP only
+uses BSD4.4 style long path names (stored immediately after the header) and
never contains a string table for long names. The second departure is that the
-symbol table is formated for efficient construction of an in-memory data
-structure that permits rapid (red-black tree) lookups. Consequently, archives
-produced with \fBllvm-ar\fR usually won't be readable or editable with any
-\&\f(CW\*(C`ar\*(C'\fR implementation or useful for linking. Using the \f(CW\*(C`f\*(C'\fR modifier to flatten
-file names will make the archive readable by other \f(CW\*(C`ar\*(C'\fR implementations
-but not for linking because the symbol table format for \s-1LLVM\s0 is unique. If an
-\&\s-1SVR4\s0 or \s-1BSD\s0 style archive is used with the \f(CW\*(C`r\*(C'\fR (replace) or \f(CW\*(C`q\*(C'\fR (quick
-update) operations, the archive will be reconstructed in \s-1LLVM\s0 format. This
-means that the string table will be dropped (in deference to \s-1BSD\s0 4.4 long names)
-and an \s-1LLVM\s0 symbol table will be added (by default). The system symbol table
+symbol table is formated for efficient construction of an in\-memory data
+structure that permits rapid (red\-black tree) lookups. Consequently, archives
+produced with \fBllvm\-ar\fP usually won\(aqt be readable or editable with any
+\fBar\fP implementation or useful for linking. Using the \fBf\fP modifier to flatten
+file names will make the archive readable by other \fBar\fP implementations
+but not for linking because the symbol table format for LLVM is unique. If an
+SVR4 or BSD style archive is used with the \fBr\fP (replace) or \fBq\fP (quick
+update) operations, the archive will be reconstructed in LLVM format. This
+means that the string table will be dropped (in deference to BSD 4.4 long names)
+and an LLVM symbol table will be added (by default). The system symbol table
will be retained.
-.PP
-Here's where \fBllvm-ar\fR departs from previous \f(CW\*(C`ar\*(C'\fR implementations:
-.IP "\fISymbol Table\fR" 4
-.IX Item "Symbol Table"
-Since \fBllvm-ar\fR is intended to archive bitcode files, the symbol table
-won't make much sense to anything but \s-1LLVM\s0. Consequently, the symbol table's
+.sp
+Here\(aqs where \fBllvm\-ar\fP departs from previous \fBar\fP implementations:
+.sp
+\fISymbol Table\fP
+.INDENT 0.0
+.INDENT 3.5
+Since \fBllvm\-ar\fP is intended to archive bitcode files, the symbol table
+won\(aqt make much sense to anything but LLVM. Consequently, the symbol table\(aqs
format has been simplified. It consists simply of a sequence of pairs
-of a file member index number as an \s-1LSB\s0 4byte integer and a null-terminated
+of a file member index number as an LSB 4byte integer and a null\-terminated
string.
-.IP "\fILong Paths\fR" 4
-.IX Item "Long Paths"
-Some \f(CW\*(C`ar\*(C'\fR implementations (\s-1SVR4\s0) use a separate file member to record long
-path names (> 15 characters). \fBllvm-ar\fR takes the \s-1BSD\s0 4.4 and Mac \s-1OS\s0 X
+.UNINDENT
+.UNINDENT
+.sp
+\fILong Paths\fP
+.INDENT 0.0
+.INDENT 3.5
+Some \fBar\fP implementations (SVR4) use a separate file member to record long
+path names (> 15 characters). \fBllvm\-ar\fP takes the BSD 4.4 and Mac OS X
approach which is to simply store the full path name immediately preceding
the data for the file. The path name is null terminated and may contain the
slash (/) character.
-.IP "\fICompression\fR" 4
-.IX Item "Compression"
-\&\fBllvm-ar\fR can compress the members of an archive to save space. The
-compression used depends on what's available on the platform and what choices
-the \s-1LLVM\s0 Compressor utility makes. It generally favors bzip2 but will select
-between \*(L"no compression\*(R" or bzip2 depending on what makes sense for the
-file's content.
-.IP "\fIDirectory Recursion\fR" 4
-.IX Item "Directory Recursion"
-Most \f(CW\*(C`ar\*(C'\fR implementations do not recurse through directories but simply
-ignore directories if they are presented to the program in the \fIfiles\fR
-option. \fBllvm-ar\fR, however, can recurse through directory structures and
+.UNINDENT
+.UNINDENT
+.sp
+\fIDirectory Recursion\fP
+.INDENT 0.0
+.INDENT 3.5
+Most \fBar\fP implementations do not recurse through directories but simply
+ignore directories if they are presented to the program in the \fIfiles\fP
+option. \fBllvm\-ar\fP, however, can recurse through directory structures and
add all the files under a directory, if requested.
-.IP "\fI\s-1TOC\s0 Verbose Output\fR" 4
-.IX Item "TOC Verbose Output"
-When \fBllvm-ar\fR prints out the verbose table of contents (\f(CW\*(C`tv\*(C'\fR option), it
-precedes the usual output with a character indicating the basic kind of
-content in the file. A blank means the file is a regular file. A 'Z' means
-the file is compressed. A 'B' means the file is an \s-1LLVM\s0 bitcode file. An
-\&'S' means the file is the symbol table.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-The options to \fBllvm-ar\fR are compatible with other \f(CW\*(C`ar\*(C'\fR implementations.
-However, there are a few modifiers (\fIzR\fR) that are not found in other
-\&\f(CW\*(C`ar\*(C'\fRs. The options to \fBllvm-ar\fR specify a single basic operation to
-perform on the archive, a variety of modifiers for that operation, the
-name of the archive file, and an optional list of file names. These options
-are used to determine how \fBllvm-ar\fR should process the archive file.
-.PP
+.UNINDENT
+.UNINDENT
+.sp
+\fITOC Verbose Output\fP
+.INDENT 0.0
+.INDENT 3.5
+When \fBllvm\-ar\fP prints out the verbose table of contents (\fBtv\fP option), it
+precedes the usual output with a character indicating the basic kind of
+content in the file. A blank means the file is a regular file. A \(aqB\(aq means
+the file is an LLVM bitcode file. An \(aqS\(aq means the file is the symbol table.
+.UNINDENT
+.UNINDENT
+.SH OPTIONS
+.sp
+The options to \fBllvm\-ar\fP are compatible with other \fBar\fP implementations.
+However, there are a few modifiers (\fIR\fP) that are not found in other \fBar\fP
+implementations. The options to \fBllvm\-ar\fP specify a single basic operation to
+perform on the archive, a variety of modifiers for that operation, the name of
+the archive file, and an optional list of file names. These options are used to
+determine how \fBllvm\-ar\fP should process the archive file.
+.sp
The Operations and Modifiers are explained in the sections below. The minimal
set of options is at least one operator and the name of the archive. Typically
-archive files end with a \f(CW\*(C`.a\*(C'\fR suffix, but this is not required. Following
-the \fIarchive-name\fR comes a list of \fIfiles\fR that indicate the specific members
-of the archive to operate on. If the \fIfiles\fR option is not specified, it
-generally means either \*(L"none\*(R" or \*(L"all\*(R" members, depending on the operation.
-.SS "Operations"
-.IX Subsection "Operations"
-.IP "d" 4
-.IX Item "d"
+archive files end with a \fB.a\fP suffix, but this is not required. Following
+the \fIarchive\-name\fP comes a list of \fIfiles\fP that indicate the specific members
+of the archive to operate on. If the \fIfiles\fP option is not specified, it
+generally means either "none" or "all" members, depending on the operation.
+.SS Operations
+.sp
+d
+.INDENT 0.0
+.INDENT 3.5
Delete files from the archive. No modifiers are applicable to this operation.
-The \fIfiles\fR options specify which members should be removed from the
+The \fIfiles\fP options specify which members should be removed from the
archive. It is not an error if a specified file does not appear in the archive.
-If no \fIfiles\fR are specified, the archive is not modified.
-.IP "m[abi]" 4
-.IX Item "m[abi]"
-Move files from one location in the archive to another. The \fIa\fR, \fIb\fR, and
-\&\fIi\fR modifiers apply to this operation. The \fIfiles\fR will all be moved
+If no \fIfiles\fP are specified, the archive is not modified.
+.UNINDENT
+.UNINDENT
+.sp
+m[abi]
+.INDENT 0.0
+.INDENT 3.5
+Move files from one location in the archive to another. The \fIa\fP, \fIb\fP, and
+\fIi\fP modifiers apply to this operation. The \fIfiles\fP will all be moved
to the location given by the modifiers. If no modifiers are used, the files
-will be moved to the end of the archive. If no \fIfiles\fR are specified, the
+will be moved to the end of the archive. If no \fIfiles\fP are specified, the
archive is not modified.
-.IP "p[k]" 4
-.IX Item "p[k]"
-Print files to the standard output. The \fIk\fR modifier applies to this
-operation. This operation simply prints the \fIfiles\fR indicated to the
-standard output. If no \fIfiles\fR are specified, the entire archive is printed.
-Printing bitcode files is ill-advised as they might confuse your terminal
-settings. The \fIp\fR operation never modifies the archive.
-.IP "q[Rfz]" 4
-.IX Item "q[Rfz]"
-Quickly append files to the end of the archive. The \fIR\fR, \fIf\fR, and \fIz\fR
-modifiers apply to this operation. This operation quickly adds the
-\&\fIfiles\fR to the archive without checking for duplicates that should be
-removed first. If no \fIfiles\fR are specified, the archive is not modified.
-Because of the way that \fBllvm-ar\fR constructs the archive file, its dubious
-whether the \fIq\fR operation is any faster than the \fIr\fR operation.
-.IP "r[Rabfuz]" 4
-.IX Item "r[Rabfuz]"
-Replace or insert file members. The \fIR\fR, \fIa\fR, \fIb\fR, \fIf\fR, \fIu\fR, and \fIz\fR
+.UNINDENT
+.UNINDENT
+.sp
+p[k]
+.INDENT 0.0
+.INDENT 3.5
+Print files to the standard output. The \fIk\fP modifier applies to this
+operation. This operation simply prints the \fIfiles\fP indicated to the
+standard output. If no \fIfiles\fP are specified, the entire archive is printed.
+Printing bitcode files is ill\-advised as they might confuse your terminal
+settings. The \fIp\fP operation never modifies the archive.
+.UNINDENT
+.UNINDENT
+.sp
+q[Rf]
+.INDENT 0.0
+.INDENT 3.5
+Quickly append files to the end of the archive. The \fIR\fP, and \fIf\fP
+modifiers apply to this operation. This operation quickly adds the
+\fIfiles\fP to the archive without checking for duplicates that should be
+removed first. If no \fIfiles\fP are specified, the archive is not modified.
+Because of the way that \fBllvm\-ar\fP constructs the archive file, its dubious
+whether the \fIq\fP operation is any faster than the \fIr\fP operation.
+.UNINDENT
+.UNINDENT
+.sp
+r[Rabfu]
+.INDENT 0.0
+.INDENT 3.5
+Replace or insert file members. The \fIR\fP, \fIa\fP, \fIb\fP, \fIf\fP, and \fIu\fP
modifiers apply to this operation. This operation will replace existing
-\&\fIfiles\fR or insert them at the end of the archive if they do not exist. If no
-\&\fIfiles\fR are specified, the archive is not modified.
-.IP "t[v]" 4
-.IX Item "t[v]"
+\fIfiles\fP or insert them at the end of the archive if they do not exist. If no
+\fIfiles\fP are specified, the archive is not modified.
+.UNINDENT
+.UNINDENT
+.sp
+t[v]
+.INDENT 0.0
+.INDENT 3.5
Print the table of contents. Without any modifiers, this operation just prints
-the names of the members to the standard output. With the \fIv\fR modifier,
-\&\fBllvm-ar\fR also prints out the file type (B=bitcode, Z=compressed, S=symbol
+the names of the members to the standard output. With the \fIv\fP modifier,
+\fBllvm\-ar\fP also prints out the file type (B=bitcode, S=symbol
table, blank=regular file), the permission mode, the owner and group, the
-size, and the date. If any \fIfiles\fR are specified, the listing is only for
-those files. If no \fIfiles\fR are specified, the table of contents for the
+size, and the date. If any \fIfiles\fP are specified, the listing is only for
+those files. If no \fIfiles\fP are specified, the table of contents for the
whole archive is printed.
-.IP "x[oP]" 4
-.IX Item "x[oP]"
-Extract archive members back to files. The \fIo\fR modifier applies to this
-operation. This operation retrieves the indicated \fIfiles\fR from the archive
-and writes them back to the operating system's file system. If no
-\&\fIfiles\fR are specified, the entire archive is extract.
-.SS "Modifiers (operation specific)"
-.IX Subsection "Modifiers (operation specific)"
+.UNINDENT
+.UNINDENT
+.sp
+x[oP]
+.INDENT 0.0
+.INDENT 3.5
+Extract archive members back to files. The \fIo\fP modifier applies to this
+operation. This operation retrieves the indicated \fIfiles\fP from the archive
+and writes them back to the operating system\(aqs file system. If no
+\fIfiles\fP are specified, the entire archive is extract.
+.UNINDENT
+.UNINDENT
+.SS Modifiers (operation specific)
+.sp
The modifiers below are specific to certain operations. See the Operations
section (above) to determine which modifiers are applicable to which operations.
-.IP "[a]" 4
-.IX Item "[a]"
+.sp
+[a]
+.INDENT 0.0
+.INDENT 3.5
When inserting or moving member files, this option specifies the destination of
-the new files as being \f(CW\*(C`a\*(C'\fRfter the \fIrelpos\fR member. If \fIrelpos\fR is not found,
+the new files as being after the \fIrelpos\fP member. If \fIrelpos\fP is not found,
the files are placed at the end of the archive.
-.IP "[b]" 4
-.IX Item "[b]"
+.UNINDENT
+.UNINDENT
+.sp
+[b]
+.INDENT 0.0
+.INDENT 3.5
When inserting or moving member files, this option specifies the destination of
-the new files as being \f(CW\*(C`b\*(C'\fRefore the \fIrelpos\fR member. If \fIrelpos\fR is not
-found, the files are placed at the end of the archive. This modifier is
-identical to the the \fIi\fR modifier.
-.IP "[f]" 4
-.IX Item "[f]"
-Normally, \fBllvm-ar\fR stores the full path name to a file as presented to it on
+the new files as being before the \fIrelpos\fP member. If \fIrelpos\fP is not
+found, the files are placed at the end of the archive. This modifier is
+identical to the \fIi\fP modifier.
+.UNINDENT
+.UNINDENT
+.sp
+[f]
+.INDENT 0.0
+.INDENT 3.5
+Normally, \fBllvm\-ar\fP stores the full path name to a file as presented to it on
the command line. With this option, truncated (15 characters max) names are
-used. This ensures name compatibility with older versions of \f(CW\*(C`ar\*(C'\fR but may also
+used. This ensures name compatibility with older versions of \fBar\fP but may also
thwart correct extraction of the files (duplicates may overwrite). If used with
-the \fIR\fR option, the directory recursion will be performed but the file names
-will all be \f(CW\*(C`f\*(C'\fRlattened to simple file names.
-.IP "[i]" 4
-.IX Item "[i]"
-A synonym for the \fIb\fR option.
-.IP "[k]" 4
-.IX Item "[k]"
-Normally, \fBllvm-ar\fR will not print the contents of bitcode files when the
-\&\fIp\fR operation is used. This modifier defeats the default and allows the
+the \fIR\fP option, the directory recursion will be performed but the file names
+will all be flattened to simple file names.
+.UNINDENT
+.UNINDENT
+.sp
+[i]
+.INDENT 0.0
+.INDENT 3.5
+A synonym for the \fIb\fP option.
+.UNINDENT
+.UNINDENT
+.sp
+[k]
+.INDENT 0.0
+.INDENT 3.5
+Normally, \fBllvm\-ar\fP will not print the contents of bitcode files when the
+\fIp\fP operation is used. This modifier defeats the default and allows the
bitcode members to be printed.
-.IP "[N]" 4
-.IX Item "[N]"
-This option is ignored by \fBllvm-ar\fR but provided for compatibility.
-.IP "[o]" 4
-.IX Item "[o]"
-When extracting files, this option will cause \fBllvm-ar\fR to preserve the
+.UNINDENT
+.UNINDENT
+.sp
+[N]
+.INDENT 0.0
+.INDENT 3.5
+This option is ignored by \fBllvm\-ar\fP but provided for compatibility.
+.UNINDENT
+.UNINDENT
+.sp
+[o]
+.INDENT 0.0
+.INDENT 3.5
+When extracting files, this option will cause \fBllvm\-ar\fP to preserve the
original modification times of the files it writes.
-.IP "[P]" 4
-.IX Item "[P]"
+.UNINDENT
+.UNINDENT
+.sp
+[P]
+.INDENT 0.0
+.INDENT 3.5
use full path names when matching
-.IP "[R]" 4
-.IX Item "[R]"
-This modifier instructions the \fIr\fR option to recursively process directories.
-Without \fIR\fR, directories are ignored and only those \fIfiles\fR that refer to
-files will be added to the archive. When \fIR\fR is used, any directories specified
-with \fIfiles\fR will be scanned (recursively) to find files to be added to the
+.UNINDENT
+.UNINDENT
+.sp
+[R]
+.INDENT 0.0
+.INDENT 3.5
+This modifier instructions the \fIr\fP option to recursively process directories.
+Without \fIR\fP, directories are ignored and only those \fIfiles\fP that refer to
+files will be added to the archive. When \fIR\fP is used, any directories specified
+with \fIfiles\fP will be scanned (recursively) to find files to be added to the
archive. Any file whose name begins with a dot will not be added.
-.IP "[u]" 4
-.IX Item "[u]"
+.UNINDENT
+.UNINDENT
+.sp
+[u]
+.INDENT 0.0
+.INDENT 3.5
When replacing existing files in the archive, only replace those files that have
a time stamp than the time stamp of the member in the archive.
-.IP "[z]" 4
-.IX Item "[z]"
-When inserting or replacing any file in the archive, compress the file first.
-This
-modifier is safe to use when (previously) compressed bitcode files are added to
-the archive; the compressed bitcode files will not be doubly compressed.
-.SS "Modifiers (generic)"
-.IX Subsection "Modifiers (generic)"
+.UNINDENT
+.UNINDENT
+.SS Modifiers (generic)
+.sp
The modifiers below may be applied to any operation.
-.IP "[c]" 4
-.IX Item "[c]"
-For all operations, \fBllvm-ar\fR will always create the archive if it doesn't
-exist. Normally, \fBllvm-ar\fR will print a warning message indicating that the
+.sp
+[c]
+.INDENT 0.0
+.INDENT 3.5
+For all operations, \fBllvm\-ar\fP will always create the archive if it doesn\(aqt
+exist. Normally, \fBllvm\-ar\fP will print a warning message indicating that the
archive is being created. Using this modifier turns off that warning.
-.IP "[s]" 4
-.IX Item "[s]"
+.UNINDENT
+.UNINDENT
+.sp
+[s]
+.INDENT 0.0
+.INDENT 3.5
This modifier requests that an archive index (or symbol table) be added to the
archive. This is the default mode of operation. The symbol table will contain
all the externally visible functions and global variables defined by all the
bitcode files in the archive. Using this modifier is more efficient that using
-llvm-ranlib which also creates the symbol table.
-.IP "[S]" 4
-.IX Item "[S]"
-This modifier is the opposite of the \fIs\fR modifier. It instructs \fBllvm-ar\fR to
-not build the symbol table. If both \fIs\fR and \fIS\fR are used, the last modifier to
+llvm\-ranlib|llvm\-ranlib which also creates the symbol table.
+.UNINDENT
+.UNINDENT
+.sp
+[S]
+.INDENT 0.0
+.INDENT 3.5
+This modifier is the opposite of the \fIs\fP modifier. It instructs \fBllvm\-ar\fP to
+not build the symbol table. If both \fIs\fP and \fIS\fP are used, the last modifier to
occur in the options will prevail.
-.IP "[v]" 4
-.IX Item "[v]"
-This modifier instructs \fBllvm-ar\fR to be verbose about what it is doing. Each
+.UNINDENT
+.UNINDENT
+.sp
+[v]
+.INDENT 0.0
+.INDENT 3.5
+This modifier instructs \fBllvm\-ar\fP to be verbose about what it is doing. Each
editing operation taken against the archive will produce a line of output saying
what is being done.
-.SH "STANDARDS"
-.IX Header "STANDARDS"
-The \fBllvm-ar\fR utility is intended to provide a superset of the \s-1IEEE\s0 Std 1003.2
-(\s-1POSIX\s0.2) functionality for \f(CW\*(C`ar\*(C'\fR. \fBllvm-ar\fR can read both \s-1SVR4\s0 and \s-1BSD4\s0.4 (or
-Mac \s-1OS\s0 X) archives. If the \f(CW\*(C`f\*(C'\fR modifier is given to the \f(CW\*(C`x\*(C'\fR or \f(CW\*(C`r\*(C'\fR operations
-then \fBllvm-ar\fR will write \s-1SVR4\s0 compatible archives. Without this modifier,
-\&\fBllvm-ar\fR will write \s-1BSD4\s0.4 compatible archives that have long names
-immediately after the header and indicated using the \*(L"#1/ddd\*(R" notation for the
+.UNINDENT
+.UNINDENT
+.SH STANDARDS
+.sp
+The \fBllvm\-ar\fP utility is intended to provide a superset of the IEEE Std 1003.2
+(POSIX.2) functionality for \fBar\fP. \fBllvm\-ar\fP can read both SVR4 and BSD4.4 (or
+Mac OS X) archives. If the \fBf\fP modifier is given to the \fBx\fP or \fBr\fP operations
+then \fBllvm\-ar\fP will write SVR4 compatible archives. Without this modifier,
+\fBllvm\-ar\fP will write BSD4.4 compatible archives that have long names
+immediately after the header and indicated using the "#1/ddd" notation for the
name in the header.
-.SH "FILE FORMAT"
-.IX Header "FILE FORMAT"
-The file format for \s-1LLVM\s0 Archive files is similar to that of \s-1BSD\s0 4.4 or Mac \s-1OSX\s0
-archive files. In fact, except for the symbol table, the \f(CW\*(C`ar\*(C'\fR commands on those
-operating systems should be able to read \s-1LLVM\s0 archive files. The details of the
+.SH FILE FORMAT
+.sp
+The file format for LLVM Archive files is similar to that of BSD 4.4 or Mac OSX
+archive files. In fact, except for the symbol table, the \fBar\fP commands on those
+operating systems should be able to read LLVM archive files. The details of the
file format follow.
-.PP
+.sp
Each archive begins with the archive magic number which is the eight printable
-characters \*(L"!<arch>\en\*(R" where \en represents the newline character (0x0A).
-Following the magic number, the file is composed of even length members that
-begin with an archive header and end with a \en padding character if necessary
-(to make the length even). Each file member is composed of a header (defined
-below), an optional newline-terminated \*(L"long file name\*(R" and the contents of
+characters "!<arch>n" where n represents the newline character (0x0A).
+Following the magic number, the file is composed of even length members that
+begin with an archive header and end with a n padding character if necessary
+(to make the length even). Each file member is composed of a header (defined
+below), an optional newline\-terminated "long file name" and the contents of
the file.
-.PP
+.sp
The fields of the header are described in the items below. All fields of the
-header contain only \s-1ASCII\s0 characters, are left justified and are right padded
+header contain only ASCII characters, are left justified and are right padded
with space characters.
-.IP "name \- char[16]" 4
-.IX Item "name - char[16]"
+.sp
+name \- char[16]
+.INDENT 0.0
+.INDENT 3.5
This field of the header provides the name of the archive member. If the name is
longer than 15 characters or contains a slash (/) character, then this field
-contains \f(CW\*(C`#1/nnn\*(C'\fR where \f(CW\*(C`nnn\*(C'\fR provides the length of the name and the \f(CW\*(C`#1/\*(C'\fR
-is literal. In this case, the actual name of the file is provided in the \f(CW\*(C`nnn\*(C'\fR
+contains \fB#1/nnn\fP where \fBnnn\fP provides the length of the name and the \fB#1/\fP
+is literal. In this case, the actual name of the file is provided in the \fBnnn\fP
bytes immediately following the header. If the name is 15 characters or less, it
is contained directly in this field and terminated with a slash (/) character.
-.IP "date \- char[12]" 4
-.IX Item "date - char[12]"
+.UNINDENT
+.UNINDENT
+.sp
+date \- char[12]
+.INDENT 0.0
+.INDENT 3.5
This field provides the date of modification of the file in the form of a
-decimal encoded number that provides the number of seconds since the epoch
+decimal encoded number that provides the number of seconds since the epoch
(since 00:00:00 Jan 1, 1970) per Posix specifications.
-.IP "uid \- char[6]" 4
-.IX Item "uid - char[6]"
-This field provides the user id of the file encoded as a decimal \s-1ASCII\s0 string.
-This field might not make much sense on non-Unix systems. On Unix, it is the
-same value as the st_uid field of the stat structure returned by the \fIstat\fR\|(2)
+.UNINDENT
+.UNINDENT
+.sp
+uid \- char[6]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the user id of the file encoded as a decimal ASCII string.
+This field might not make much sense on non\-Unix systems. On Unix, it is the
+same value as the st_uid field of the stat structure returned by the stat(2)
operating system call.
-.IP "gid \- char[6]" 4
-.IX Item "gid - char[6]"
-This field provides the group id of the file encoded as a decimal \s-1ASCII\s0 string.
-This field might not make much sense on non-Unix systems. On Unix, it is the
-same value as the st_gid field of the stat structure returned by the \fIstat\fR\|(2)
+.UNINDENT
+.UNINDENT
+.sp
+gid \- char[6]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the group id of the file encoded as a decimal ASCII string.
+This field might not make much sense on non\-Unix systems. On Unix, it is the
+same value as the st_gid field of the stat structure returned by the stat(2)
operating system call.
-.IP "mode \- char[8]" 4
-.IX Item "mode - char[8]"
-This field provides the access mode of the file encoded as an octal \s-1ASCII\s0
-string. This field might not make much sense on non-Unix systems. On Unix, it
-is the same value as the st_mode field of the stat structure returned by the
-\&\fIstat\fR\|(2) operating system call.
-.IP "size \- char[10]" 4
-.IX Item "size - char[10]"
-This field provides the size of the file, in bytes, encoded as a decimal \s-1ASCII\s0
-string. If the size field is negative (starts with a minus sign, 0x02D), then
-the archive member is stored in compressed form. The first byte of the archive
-member's data indicates the compression type used. A value of 0 (0x30) indicates
-that no compression was used. A value of 2 (0x32) indicates that bzip2
-compression was used.
-.IP "fmag \- char[2]" 4
-.IX Item "fmag - char[2]"
+.UNINDENT
+.UNINDENT
+.sp
+mode \- char[8]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the access mode of the file encoded as an octal ASCII
+string. This field might not make much sense on non\-Unix systems. On Unix, it
+is the same value as the st_mode field of the stat structure returned by the
+stat(2) operating system call.
+.UNINDENT
+.UNINDENT
+.sp
+size \- char[10]
+.INDENT 0.0
+.INDENT 3.5
+This field provides the size of the file, in bytes, encoded as a decimal ASCII
+string.
+.UNINDENT
+.UNINDENT
+.sp
+fmag \- char[2]
+.INDENT 0.0
+.INDENT 3.5
This field is the archive file member magic number. Its content is always the
-two characters back tick (0x60) and newline (0x0A). This provides some measure
+two characters back tick (0x60) and newline (0x0A). This provides some measure
utility in identifying archive files that have been corrupted.
-.PP
-The \s-1LLVM\s0 symbol table has the special name \*(L"#_LLVM_SYM_TAB_#\*(R". It is presumed
-that no regular archive member file will want this name. The \s-1LLVM\s0 symbol table
-is simply composed of a sequence of triplets: byte offset, length of symbol,
-and the symbol itself. Symbols are not null or newline terminated. Here are
+.UNINDENT
+.UNINDENT
+.sp
+The LLVM symbol table has the special name "#_LLVM_SYM_TAB_#". It is presumed
+that no regular archive member file will want this name. The LLVM symbol table
+is simply composed of a sequence of triplets: byte offset, length of symbol,
+and the symbol itself. Symbols are not null or newline terminated. Here are
the details on each of these items:
-.IP "offset \- vbr encoded 32\-bit integer" 4
-.IX Item "offset - vbr encoded 32-bit integer"
+.sp
+offset \- vbr encoded 32\-bit integer
+.INDENT 0.0
+.INDENT 3.5
The offset item provides the offset into the archive file where the bitcode
member is stored that is associated with the symbol. The offset value is 0
-based at the start of the first \*(L"normal\*(R" file member. To derive the actual
+based at the start of the first "normal" file member. To derive the actual
file offset of the member, you must add the number of bytes occupied by the file
signature (8 bytes) and the symbol tables. The value of this item is encoded
using variable bit rate encoding to reduce the size of the symbol table.
-Variable bit rate encoding uses the high bit (0x80) of each byte to indicate
+Variable bit rate encoding uses the high bit (0x80) of each byte to indicate
if there are more bytes to follow. The remaining 7 bits in each byte carry bits
from the value. The final byte does not have the high bit set.
-.IP "length \- vbr encoded 32\-bit integer" 4
-.IX Item "length - vbr encoded 32-bit integer"
+.UNINDENT
+.UNINDENT
+.sp
+length \- vbr encoded 32\-bit integer
+.INDENT 0.0
+.INDENT 3.5
The length item provides the length of the symbol that follows. Like this
-\&\fIoffset\fR item, the length is variable bit rate encoded.
-.IP "symbol \- character array" 4
-.IX Item "symbol - character array"
+\fIoffset\fP item, the length is variable bit rate encoded.
+.UNINDENT
+.UNINDENT
+.sp
+symbol \- character array
+.INDENT 0.0
+.INDENT 3.5
The symbol item provides the text of the symbol that is associated with the
-\&\fIoffset\fR. The symbol is not terminated by any character. Its length is provided
-by the \fIlength\fR field. Note that is allowed (but unwise) to use non-printing
-characters (even 0x00) in the symbol. This allows for multiple encodings of
+\fIoffset\fP. The symbol is not terminated by any character. Its length is provided
+by the \fIlength\fP field. Note that is allowed (but unwise) to use non\-printing
+characters (even 0x00) in the symbol. This allows for multiple encodings of
symbol names.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-ar\fR succeeds, it will exit with 0. A usage error, results
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-ar\fP succeeds, it will exit with 0. A usage error, results
in an exit code of 1. A hard (file system typically) error results in an
exit code of 2. Miscellaneous or unknown errors result in an
exit code of 3.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-llvm-ranlib, \fIar\fR\|(1)
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.SH SEE ALSO
+.sp
+llvm\-ranlib|llvm\-ranlib, ar(1)
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-as/llvm-as.1 b/usr.bin/clang/llvm-as/llvm-as.1
index 0887a2d..82e13bc 100644
--- a/usr.bin/clang/llvm-as/llvm-as.1
+++ b/usr.bin/clang/llvm-as/llvm-as.1
@@ -1,182 +1,87 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-AS" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-as \- LLVM assembler
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-AS 1"
-.TH LLVM-AS 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-as \- LLVM assembler
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-as\fR [\fIoptions\fR] [\fIfilename\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBllvm-as\fR is the \s-1LLVM\s0 assembler. It reads a file containing human-readable
-\&\s-1LLVM\s0 assembly language, translates it to \s-1LLVM\s0 bitcode, and writes the result
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-as\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+\fBllvm\-as\fP is the LLVM assembler. It reads a file containing human\-readable
+LLVM assembly language, translates it to LLVM bitcode, and writes the result
into a file or to standard output.
-.PP
-If \fIfilename\fR is omitted or is \f(CW\*(C`\-\*(C'\fR, then \fBllvm-as\fR reads its input from
+.sp
+If \fIfilename\fP is omitted or is \fB\-\fP, then \fBllvm\-as\fP reads its input from
standard input.
-.PP
-If an output file is not specified with the \fB\-o\fR option, then
-\&\fBllvm-as\fR sends its output to a file or standard output by following
+.sp
+If an output file is not specified with the \fB\-o\fP option, then
+\fBllvm\-as\fP sends its output to a file or standard output by following
these rules:
-.IP "\(bu" 4
+.INDENT 0.0
+.IP \(bu 2
If the input is standard input, then the output is standard output.
-.IP "\(bu" 4
-If the input is a file that ends with \f(CW\*(C`.ll\*(C'\fR, then the output file is of
-the same name, except that the suffix is changed to \f(CW\*(C`.bc\*(C'\fR.
-.IP "\(bu" 4
-If the input is a file that does not end with the \f(CW\*(C`.ll\*(C'\fR suffix, then the
-output file has the same name as the input file, except that the \f(CW\*(C`.bc\*(C'\fR
+.IP \(bu 2
+If the input is a file that ends with \fB.ll\fP, then the output file is of the
+same name, except that the suffix is changed to \fB.bc\fP.
+.IP \(bu 2
+If the input is a file that does not end with the \fB.ll\fP suffix, then the
+output file has the same name as the input file, except that the \fB.bc\fP
suffix is appended.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-f\fR" 4
-.IX Item "-f"
-Enable binary output on terminals. Normally, \fBllvm-as\fR will refuse to
+.UNINDENT
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \fB\-f\fP
+Enable binary output on terminals. Normally, \fBllvm\-as\fP will refuse to
write raw bitcode output if the output stream is a terminal. With this option,
-\&\fBllvm-as\fR will write raw bitcode regardless of the output device.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+\fBllvm\-as\fP will write raw bitcode regardless of the output device.
+.TP
+.B \fB\-help\fP
Print a summary of command line options.
-.IP "\fB\-o\fR \fIfilename\fR" 4
-.IX Item "-o filename"
-Specify the output file name. If \fIfilename\fR is \f(CW\*(C`\-\*(C'\fR, then \fBllvm-as\fR
+.TP
+.B \fB\-o\fP \fIfilename\fP
+Specify the output file name. If \fIfilename\fP is \fB\-\fP, then \fBllvm\-as\fP
sends its output to standard output.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-as\fR succeeds, it will exit with 0. Otherwise, if an error
-occurs, it will exit with a non-zero value.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-llvm-dis, gccas
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-as\fP succeeds, it will exit with 0. Otherwise, if an error occurs, it
+will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+llvm\-dis|llvm\-dis, gccas|gccas
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1 b/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1
index 1452c47..8611eec 100644
--- a/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1
+++ b/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1
@@ -1,370 +1,483 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-BCANALYZER" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-bcanalyzer \- LLVM bitcode analyzer
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-BCANALYZER 1"
-.TH LLVM-BCANALYZER 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-bcanalyzer \- LLVM bitcode analyzer
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-bcanalyzer\fR [\fIoptions\fR] [\fIfilename\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllvm-bcanalyzer\fR command is a small utility for analyzing bitcode files.
-The tool reads a bitcode file (such as generated with the \fBllvm-as\fR tool) and
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-bcanalyzer\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-bcanalyzer\fP command is a small utility for analyzing bitcode files.
+The tool reads a bitcode file (such as generated with the \fBllvm\-as\fP tool) and
produces a statistical report on the contents of the bitcode file. The tool
-can also dump a low level but human readable version of the bitcode file.
-This tool is probably not of much interest or utility except for those working
-directly with the bitcode file format. Most \s-1LLVM\s0 users can just ignore
+can also dump a low level but human readable version of the bitcode file.
+This tool is probably not of much interest or utility except for those working
+directly with the bitcode file format. Most LLVM users can just ignore
this tool.
-.PP
-If \fIfilename\fR is omitted or is \f(CW\*(C`\-\*(C'\fR, then \fBllvm-bcanalyzer\fR reads its input
+.sp
+If \fIfilename\fP is omitted or is \fB\-\fP, then \fBllvm\-bcanalyzer\fP reads its input
from standard input. This is useful for combining the tool into a pipeline.
Output is written to the standard output.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-nodetails\fR" 4
-.IX Item "-nodetails"
-Causes \fBllvm-bcanalyzer\fR to abbreviate its output by writing out only a module
+.SH OPTIONS
+.sp
+\fB\-nodetails\fP
+.INDENT 0.0
+.INDENT 3.5
+Causes \fBllvm\-bcanalyzer\fP to abbreviate its output by writing out only a module
level summary. The details for individual functions are not displayed.
-.IP "\fB\-dump\fR" 4
-.IX Item "-dump"
-Causes \fBllvm-bcanalyzer\fR to dump the bitcode in a human readable format. This
-format is significantly different from \s-1LLVM\s0 assembly and provides details about
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-dump\fP
+.INDENT 0.0
+.INDENT 3.5
+Causes \fBllvm\-bcanalyzer\fP to dump the bitcode in a human readable format. This
+format is significantly different from LLVM assembly and provides details about
the encoding of the bitcode file.
-.IP "\fB\-verify\fR" 4
-.IX Item "-verify"
-Causes \fBllvm-bcanalyzer\fR to verify the module produced by reading the
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-verify\fP
+.INDENT 0.0
+.INDENT 3.5
+Causes \fBllvm\-bcanalyzer\fP to verify the module produced by reading the
bitcode. This ensures that the statistics generated are based on a consistent
module.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-bcanalyzer\fR succeeds, it will exit with 0. Otherwise, if an error
-occurs, it will exit with a non-zero value, usually 1.
-.SH "SUMMARY OUTPUT DEFINITIONS"
-.IX Header "SUMMARY OUTPUT DEFINITIONS"
-The following items are always printed by llvm-bcanalyzer. They comprize the
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-bcanalyzer\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value, usually 1.
+.SH SUMMARY OUTPUT DEFINITIONS
+.sp
+The following items are always printed by llvm\-bcanalyzer. They comprize the
summary output.
-.IP "\fBBitcode Analysis Of Module\fR" 4
-.IX Item "Bitcode Analysis Of Module"
+.sp
+\fBBitcode Analysis Of Module\fP
+.INDENT 0.0
+.INDENT 3.5
This just provides the name of the module for which bitcode analysis is being
generated.
-.IP "\fBBitcode Version Number\fR" 4
-.IX Item "Bitcode Version Number"
-The bitcode version (not \s-1LLVM\s0 version) of the file read by the analyzer.
-.IP "\fBFile Size\fR" 4
-.IX Item "File Size"
+.UNINDENT
+.UNINDENT
+.sp
+\fBBitcode Version Number\fP
+.INDENT 0.0
+.INDENT 3.5
+The bitcode version (not LLVM version) of the file read by the analyzer.
+.UNINDENT
+.UNINDENT
+.sp
+\fBFile Size\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of the entire bitcode file.
-.IP "\fBModule Bytes\fR" 4
-.IX Item "Module Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBModule Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of the module block. Percentage is relative to File Size.
-.IP "\fBFunction Bytes\fR" 4
-.IX Item "Function Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBFunction Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of all the function blocks. Percentage is relative to File
Size.
-.IP "\fBGlobal Types Bytes\fR" 4
-.IX Item "Global Types Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBGlobal Types Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of the Global Types Pool. Percentage is relative to File
Size. This is the size of the definitions of all types in the bitcode file.
-.IP "\fBConstant Pool Bytes\fR" 4
-.IX Item "Constant Pool Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBConstant Pool Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of the Constant Pool Blocks Percentage is relative to File
Size.
-.IP "\fBModule Globals Bytes\fR" 4
-.IX Item "Module Globals Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBModule Globals Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
Ths size, in bytes, of the Global Variable Definitions and their initializers.
Percentage is relative to File Size.
-.IP "\fBInstruction List Bytes\fR" 4
-.IX Item "Instruction List Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBInstruction List Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of all the instruction lists in all the functions.
Percentage is relative to File Size. Note that this value is also included in
the Function Bytes.
-.IP "\fBCompaction Table Bytes\fR" 4
-.IX Item "Compaction Table Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBCompaction Table Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of all the compaction tables in all the functions.
Percentage is relative to File Size. Note that this value is also included in
the Function Bytes.
-.IP "\fBSymbol Table Bytes\fR" 4
-.IX Item "Symbol Table Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBSymbol Table Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of all the symbol tables in all the functions. Percentage is
relative to File Size. Note that this value is also included in the Function
Bytes.
-.IP "\fBDependent Libraries Bytes\fR" 4
-.IX Item "Dependent Libraries Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fBDependent Libraries Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The size, in bytes, of the list of dependent libraries in the module. Percentage
is relative to File Size. Note that this value is also included in the Module
Global Bytes.
-.IP "\fBNumber Of Bitcode Blocks\fR" 4
-.IX Item "Number Of Bitcode Blocks"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Bitcode Blocks\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of blocks of any kind in the bitcode file.
-.IP "\fBNumber Of Functions\fR" 4
-.IX Item "Number Of Functions"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Functions\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of function definitions in the bitcode file.
-.IP "\fBNumber Of Types\fR" 4
-.IX Item "Number Of Types"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Types\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of types defined in the Global Types Pool.
-.IP "\fBNumber Of Constants\fR" 4
-.IX Item "Number Of Constants"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Constants\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of constants (of any type) defined in the Constant Pool.
-.IP "\fBNumber Of Basic Blocks\fR" 4
-.IX Item "Number Of Basic Blocks"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Basic Blocks\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of basic blocks defined in all functions in the bitcode file.
-.IP "\fBNumber Of Instructions\fR" 4
-.IX Item "Number Of Instructions"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Instructions\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of instructions defined in all functions in the bitcode file.
-.IP "\fBNumber Of Long Instructions\fR" 4
-.IX Item "Number Of Long Instructions"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Long Instructions\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of long instructions defined in all functions in the bitcode
file. Long instructions are those taking greater than 4 bytes. Typically long
-instructions are GetElementPtr with several indices, \s-1PHI\s0 nodes, and calls to
+instructions are GetElementPtr with several indices, PHI nodes, and calls to
functions with large numbers of arguments.
-.IP "\fBNumber Of Operands\fR" 4
-.IX Item "Number Of Operands"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Operands\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of operands used in all instructions in the bitcode file.
-.IP "\fBNumber Of Compaction Tables\fR" 4
-.IX Item "Number Of Compaction Tables"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Compaction Tables\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of compaction tables in all functions in the bitcode file.
-.IP "\fBNumber Of Symbol Tables\fR" 4
-.IX Item "Number Of Symbol Tables"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Symbol Tables\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of symbol tables in all functions in the bitcode file.
-.IP "\fBNumber Of Dependent Libs\fR" 4
-.IX Item "Number Of Dependent Libs"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber Of Dependent Libs\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of dependent libraries found in the bitcode file.
-.IP "\fBTotal Instruction Size\fR" 4
-.IX Item "Total Instruction Size"
+.UNINDENT
+.UNINDENT
+.sp
+\fBTotal Instruction Size\fP
+.INDENT 0.0
+.INDENT 3.5
The total size of the instructions in all functions in the bitcode file.
-.IP "\fBAverage Instruction Size\fR" 4
-.IX Item "Average Instruction Size"
+.UNINDENT
+.UNINDENT
+.sp
+\fBAverage Instruction Size\fP
+.INDENT 0.0
+.INDENT 3.5
The average number of bytes per instruction across all functions in the bitcode
file. This value is computed by dividing Total Instruction Size by Number Of
Instructions.
-.IP "\fBMaximum Type Slot Number\fR" 4
-.IX Item "Maximum Type Slot Number"
-The maximum value used for a type's slot number. Larger slot number values take
+.UNINDENT
+.UNINDENT
+.sp
+\fBMaximum Type Slot Number\fP
+.INDENT 0.0
+.INDENT 3.5
+The maximum value used for a type\(aqs slot number. Larger slot number values take
more bytes to encode.
-.IP "\fBMaximum Value Slot Number\fR" 4
-.IX Item "Maximum Value Slot Number"
-The maximum value used for a value's slot number. Larger slot number values take
+.UNINDENT
+.UNINDENT
+.sp
+\fBMaximum Value Slot Number\fP
+.INDENT 0.0
+.INDENT 3.5
+The maximum value used for a value\(aqs slot number. Larger slot number values take
more bytes to encode.
-.IP "\fBBytes Per Value\fR" 4
-.IX Item "Bytes Per Value"
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Per Value\fP
+.INDENT 0.0
+.INDENT 3.5
The average size of a Value definition (of any type). This is computed by
dividing File Size by the total number of values of any type.
-.IP "\fBBytes Per Global\fR" 4
-.IX Item "Bytes Per Global"
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Per Global\fP
+.INDENT 0.0
+.INDENT 3.5
The average size of a global definition (constants and global variables).
-.IP "\fBBytes Per Function\fR" 4
-.IX Item "Bytes Per Function"
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Per Function\fP
+.INDENT 0.0
+.INDENT 3.5
The average number of bytes per function definition. This is computed by
dividing Function Bytes by Number Of Functions.
-.IP "\fB# of \s-1VBR\s0 32\-bit Integers\fR" 4
-.IX Item "# of VBR 32-bit Integers"
+.UNINDENT
+.UNINDENT
+.sp
+\fB# of VBR 32\-bit Integers\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of 32\-bit integers encoded using the Variable Bit Rate
encoding scheme.
-.IP "\fB# of \s-1VBR\s0 64\-bit Integers\fR" 4
-.IX Item "# of VBR 64-bit Integers"
+.UNINDENT
+.UNINDENT
+.sp
+\fB# of VBR 64\-bit Integers\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of 64\-bit integers encoded using the Variable Bit Rate encoding
scheme.
-.IP "\fB# of \s-1VBR\s0 Compressed Bytes\fR" 4
-.IX Item "# of VBR Compressed Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fB# of VBR Compressed Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of bytes consumed by the 32\-bit and 64\-bit integers that use
the Variable Bit Rate encoding scheme.
-.IP "\fB# of \s-1VBR\s0 Expanded Bytes\fR" 4
-.IX Item "# of VBR Expanded Bytes"
+.UNINDENT
+.UNINDENT
+.sp
+\fB# of VBR Expanded Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of bytes that would have been consumed by the 32\-bit and 64\-bit
integers had they not been compressed with the Variable Bit Rage encoding
scheme.
-.IP "\fBBytes Saved With \s-1VBR\s0\fR" 4
-.IX Item "Bytes Saved With VBR"
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Saved With VBR\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of bytes saved by using the Variable Bit Rate encoding scheme.
-The percentage is relative to # of \s-1VBR\s0 Expanded Bytes.
-.SH "DETAILED OUTPUT DEFINITIONS"
-.IX Header "DETAILED OUTPUT DEFINITIONS"
+The percentage is relative to # of VBR Expanded Bytes.
+.UNINDENT
+.UNINDENT
+.SH DETAILED OUTPUT DEFINITIONS
+.sp
The following definitions occur only if the \-nodetails option was not given.
-The detailed output provides additional information on a per-function basis.
-.IP "\fBType\fR" 4
-.IX Item "Type"
+The detailed output provides additional information on a per\-function basis.
+.sp
+\fBType\fP
+.INDENT 0.0
+.INDENT 3.5
The type signature of the function.
-.IP "\fBByte Size\fR" 4
-.IX Item "Byte Size"
-The total number of bytes in the function's block.
-.IP "\fBBasic Blocks\fR" 4
-.IX Item "Basic Blocks"
+.UNINDENT
+.UNINDENT
+.sp
+\fBByte Size\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes in the function\(aqs block.
+.UNINDENT
+.UNINDENT
+.sp
+\fBBasic Blocks\fP
+.INDENT 0.0
+.INDENT 3.5
The number of basic blocks defined by the function.
-.IP "\fBInstructions\fR" 4
-.IX Item "Instructions"
+.UNINDENT
+.UNINDENT
+.sp
+\fBInstructions\fP
+.INDENT 0.0
+.INDENT 3.5
The number of instructions defined by the function.
-.IP "\fBLong Instructions\fR" 4
-.IX Item "Long Instructions"
+.UNINDENT
+.UNINDENT
+.sp
+\fBLong Instructions\fP
+.INDENT 0.0
+.INDENT 3.5
The number of instructions using the long instruction format in the function.
-.IP "\fBOperands\fR" 4
-.IX Item "Operands"
+.UNINDENT
+.UNINDENT
+.sp
+\fBOperands\fP
+.INDENT 0.0
+.INDENT 3.5
The number of operands used by all instructions in the function.
-.IP "\fBInstruction Size\fR" 4
-.IX Item "Instruction Size"
+.UNINDENT
+.UNINDENT
+.sp
+\fBInstruction Size\fP
+.INDENT 0.0
+.INDENT 3.5
The number of bytes consumed by instructions in the function.
-.IP "\fBAverage Instruction Size\fR" 4
-.IX Item "Average Instruction Size"
+.UNINDENT
+.UNINDENT
+.sp
+\fBAverage Instruction Size\fP
+.INDENT 0.0
+.INDENT 3.5
The average number of bytes consumed by the instructions in the function. This
value is computed by dividing Instruction Size by Instructions.
-.IP "\fBBytes Per Instruction\fR" 4
-.IX Item "Bytes Per Instruction"
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Per Instruction\fP
+.INDENT 0.0
+.INDENT 3.5
The average number of bytes used by the function per instruction. This value is
computed by dividing Byte Size by Instructions. Note that this is not the same
as Average Instruction Size. It computes a number relative to the total function
size not just the size of the instruction list.
-.IP "\fBNumber of \s-1VBR\s0 32\-bit Integers\fR" 4
-.IX Item "Number of VBR 32-bit Integers"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber of VBR 32\-bit Integers\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of 32\-bit integers found in this function (for any use).
-.IP "\fBNumber of \s-1VBR\s0 64\-bit Integers\fR" 4
-.IX Item "Number of VBR 64-bit Integers"
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber of VBR 64\-bit Integers\fP
+.INDENT 0.0
+.INDENT 3.5
The total number of 64\-bit integers found in this function (for any use).
-.IP "\fBNumber of \s-1VBR\s0 Compressed Bytes\fR" 4
-.IX Item "Number of VBR Compressed Bytes"
-The total number of bytes in this function consumed by the 32\-bit and 64\-bit
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber of VBR Compressed Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes in this function consumed by the 32\-bit and 64\-bit
integers that use the Variable Bit Rate encoding scheme.
-.IP "\fBNumber of \s-1VBR\s0 Expanded Bytes\fR" 4
-.IX Item "Number of VBR Expanded Bytes"
-The total number of bytes in this function that would have been consumed by
-the 32\-bit and 64\-bit integers had they not been compressed with the Variable
+.UNINDENT
+.UNINDENT
+.sp
+\fBNumber of VBR Expanded Bytes\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes in this function that would have been consumed by
+the 32\-bit and 64\-bit integers had they not been compressed with the Variable
Bit Rate encoding scheme.
-.IP "\fBBytes Saved With \s-1VBR\s0\fR" 4
-.IX Item "Bytes Saved With VBR"
-The total number of bytes saved in this function by using the Variable Bit
-Rate encoding scheme. The percentage is relative to # of \s-1VBR\s0 Expanded Bytes.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-llvm-dis, <http://llvm.org/docs/BitCodeFormat.html>
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.UNINDENT
+.sp
+\fBBytes Saved With VBR\fP
+.INDENT 0.0
+.INDENT 3.5
+The total number of bytes saved in this function by using the Variable Bit
+Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
+.UNINDENT
+.UNINDENT
+.SH SEE ALSO
+.sp
+llvm\-dis|llvm\-dis, \fI\%http://llvm.org/docs/BitCodeFormat.html\fP
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-diff/llvm-diff.1 b/usr.bin/clang/llvm-diff/llvm-diff.1
index 75db7d9..21586ef 100644
--- a/usr.bin/clang/llvm-diff/llvm-diff.1
+++ b/usr.bin/clang/llvm-diff/llvm-diff.1
@@ -1,175 +1,77 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-DIFF" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-diff \- LLVM structural 'diff'
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-DIFF 1"
-.TH LLVM-DIFF 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-diff \- LLVM structural 'diff'
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-diff\fR [\fIoptions\fR] \fImodule 1\fR \fImodule 2\fR [\fIglobal name ...\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBllvm-diff\fR compares the structure of two \s-1LLVM\s0 modules, primarily
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-diff\fP [\fIoptions\fP] \fImodule 1\fP \fImodule 2\fP [\fIglobal name ...\fP]
+.SH DESCRIPTION
+.sp
+\fBllvm\-diff\fP compares the structure of two LLVM modules, primarily
focusing on differences in function definitions. Insignificant
differences, such as changes in the ordering of globals or in the
names of local values, are ignored.
-.PP
+.sp
An input module will be interpreted as an assembly file if its name
-ends in '.ll'; otherwise it will be read in as a bitcode file.
-.PP
+ends in \(aq.ll\(aq; otherwise it will be read in as a bitcode file.
+.sp
If a list of global names is given, just the values with those names
are compared; otherwise, all global values are compared, and
diagnostics are produced for globals which only appear in one module
or the other.
-.PP
-\&\fBllvm-diff\fR compares two functions by comparing their basic blocks,
+.sp
+\fBllvm\-diff\fP compares two functions by comparing their basic blocks,
beginning with the entry blocks. If the terminators seem to match,
then the corresponding successors are compared; otherwise they are
ignored. This algorithm is very sensitive to changes in control flow,
which tend to stop any downstream changes from being detected.
-.PP
-\&\fBllvm-diff\fR is intended as a debugging tool for writers of \s-1LLVM\s0
+.sp
+\fBllvm\-diff\fP is intended as a debugging tool for writers of LLVM
passes and frontends. It does not have a stable output format.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-diff\fR finds no differences between the modules, it will exit
-with 0 and produce no output. Otherwise it will exit with a non-zero
+.SH EXIT STATUS
+.sp
+If \fBllvm\-diff\fP finds no differences between the modules, it will exit
+with 0 and produce no output. Otherwise it will exit with a non\-zero
value.
-.SH "BUGS"
-.IX Header "BUGS"
+.SH BUGS
+.sp
Many important differences, like changes in linkage or function
attributes, are not diagnosed.
-.PP
+.sp
Changes in memory behavior (for example, coalescing loads) can cause
massive detected differences in blocks.
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-dis/Makefile b/usr.bin/clang/llvm-dis/Makefile
index 831bdbe..d6e0157 100644
--- a/usr.bin/clang/llvm-dis/Makefile
+++ b/usr.bin/clang/llvm-dis/Makefile
@@ -10,6 +10,7 @@ TGHDRS= Intrinsics
LIBDEPS=llvmanalysis \
llvmtarget \
llvmmc \
+ llvmobject \
llvmbitreader \
llvmcore \
llvmsupport
diff --git a/usr.bin/clang/llvm-dis/llvm-dis.1 b/usr.bin/clang/llvm-dis/llvm-dis.1
index df0d0f38..28363b7 100644
--- a/usr.bin/clang/llvm-dis/llvm-dis.1
+++ b/usr.bin/clang/llvm-dis/llvm-dis.1
@@ -1,175 +1,88 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-DIS" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-dis \- LLVM disassembler
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-DIS 1"
-.TH LLVM-DIS 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-dis \- LLVM disassembler
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-dis\fR [\fIoptions\fR] [\fIfilename\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllvm-dis\fR command is the \s-1LLVM\s0 disassembler. It takes an \s-1LLVM\s0
-bitcode file and converts it into human-readable \s-1LLVM\s0 assembly language.
-.PP
-If filename is omitted or specified as \f(CW\*(C`\-\*(C'\fR, \fBllvm-dis\fR reads its
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-dis\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-dis\fP command is the LLVM disassembler. It takes an LLVM
+bitcode file and converts it into human\-readable LLVM assembly language.
+.sp
+If filename is omitted or specified as \fB\-\fP, \fBllvm\-dis\fP reads its
input from standard input.
-.PP
-If the input is being read from standard input, then \fBllvm-dis\fR
+.sp
+If the input is being read from standard input, then \fBllvm\-dis\fP
will send its output to standard output by default. Otherwise, the
output will be written to a file named after the input file, with
-a \f(CW\*(C`.ll\*(C'\fR suffix added (any existing \f(CW\*(C`.bc\*(C'\fR suffix will first be
+a \fB.ll\fP suffix added (any existing \fB.bc\fP suffix will first be
removed). You can override the choice of output file using the
-\&\fB\-o\fR option.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-f\fR" 4
-.IX Item "-f"
-Enable binary output on terminals. Normally, \fBllvm-dis\fR will refuse to
+\fB\-o\fP option.
+.SH OPTIONS
+.sp
+\fB\-f\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable binary output on terminals. Normally, \fBllvm\-dis\fP will refuse to
write raw bitcode output if the output stream is a terminal. With this option,
-\&\fBllvm-dis\fR will write raw bitcode regardless of the output device.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+\fBllvm\-dis\fP will write raw bitcode regardless of the output device.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.IP "\fB\-o\fR \fIfilename\fR" 4
-.IX Item "-o filename"
-Specify the output file name. If \fIfilename\fR is \-, then the output is sent
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-o\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Specify the output file name. If \fIfilename\fP is \-, then the output is sent
to standard output.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-dis\fR succeeds, it will exit with 0. Otherwise, if an error
-occurs, it will exit with a non-zero value.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-llvm-as
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-dis\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+llvm\-as|llvm\-as
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-extract/Makefile b/usr.bin/clang/llvm-extract/Makefile
index ffedee4..7489dd6 100644
--- a/usr.bin/clang/llvm-extract/Makefile
+++ b/usr.bin/clang/llvm-extract/Makefile
@@ -9,6 +9,7 @@ LIBDEPS=llvmasmparser \
llvmbitwriter \
llvmbitreader \
llvmipo \
+ llvmvectorize \
llvmscalaropts \
llvminstcombine \
llvmtransformutils \
@@ -16,6 +17,7 @@ LIBDEPS=llvmasmparser \
llvmanalysis \
llvmtarget \
llvmmc \
+ llvmobject \
llvmcore \
llvmsupport
diff --git a/usr.bin/clang/llvm-extract/llvm-extract.1 b/usr.bin/clang/llvm-extract/llvm-extract.1
index 5db2815..fec5f07 100644
--- a/usr.bin/clang/llvm-extract/llvm-extract.1
+++ b/usr.bin/clang/llvm-extract/llvm-extract.1
@@ -1,195 +1,128 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-EXTRACT" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-extract \- extract a function from an LLVM module
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-EXTRACT 1"
-.TH LLVM-EXTRACT 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-extract \- extract a function from an LLVM module
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-extract\fR [\fIoptions\fR] \fB\-\-func\fR \fIfunction-name\fR [\fIfilename\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllvm-extract\fR command takes the name of a function and extracts it from
-the specified \s-1LLVM\s0 bitcode file. It is primarily used as a debugging tool to
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-extract\fP [\fIoptions\fP] \fB\-\-func\fP \fIfunction\-name\fP [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-extract\fP command takes the name of a function and extracts it from
+the specified LLVM bitcode file. It is primarily used as a debugging tool to
reduce test cases from larger programs that are triggering a bug.
-.PP
+.sp
In addition to extracting the bitcode of the specified function,
-\&\fBllvm-extract\fR will also remove unreachable global variables, prototypes, and
+\fBllvm\-extract\fP will also remove unreachable global variables, prototypes, and
unused types.
-.PP
-The \fBllvm-extract\fR command reads its input from standard input if filename is
+.sp
+The \fBllvm\-extract\fP command reads its input from standard input if filename is
omitted or if filename is \-. The output is always written to standard output,
-unless the \fB\-o\fR option is specified (see below).
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-f\fR" 4
-.IX Item "-f"
-Enable binary output on terminals. Normally, \fBllvm-extract\fR will refuse to
+unless the \fB\-o\fP option is specified (see below).
+.SH OPTIONS
+.sp
+\fB\-f\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable binary output on terminals. Normally, \fBllvm\-extract\fP will refuse to
write raw bitcode output if the output stream is a terminal. With this option,
-\&\fBllvm-extract\fR will write raw bitcode regardless of the output device.
-.IP "\fB\-\-func\fR \fIfunction-name\fR" 4
-.IX Item "--func function-name"
-Extract the function named \fIfunction-name\fR from the \s-1LLVM\s0 bitcode. May be
+\fBllvm\-extract\fP will write raw bitcode regardless of the output device.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-func\fP \fIfunction\-name\fP
+.INDENT 0.0
+.INDENT 3.5
+Extract the function named \fIfunction\-name\fP from the LLVM bitcode. May be
specified multiple times to extract multiple functions at once.
-.IP "\fB\-\-rfunc\fR \fIfunction-regular-expr\fR" 4
-.IX Item "--rfunc function-regular-expr"
-Extract the function(s) matching \fIfunction-regular-expr\fR from the \s-1LLVM\s0 bitcode.
-All functions matching the regular expression will be extracted. May be
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-rfunc\fP \fIfunction\-regular\-expr\fP
+.INDENT 0.0
+.INDENT 3.5
+Extract the function(s) matching \fIfunction\-regular\-expr\fP from the LLVM bitcode.
+All functions matching the regular expression will be extracted. May be
specified multiple times.
-.IP "\fB\-\-glob\fR \fIglobal-name\fR" 4
-.IX Item "--glob global-name"
-Extract the global variable named \fIglobal-name\fR from the \s-1LLVM\s0 bitcode. May be
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-glob\fP \fIglobal\-name\fP
+.INDENT 0.0
+.INDENT 3.5
+Extract the global variable named \fIglobal\-name\fP from the LLVM bitcode. May be
specified multiple times to extract multiple global variables at once.
-.IP "\fB\-\-rglob\fR \fIglob-regular-expr\fR" 4
-.IX Item "--rglob glob-regular-expr"
-Extract the global variable(s) matching \fIglobal-regular-expr\fR from the \s-1LLVM\s0
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-rglob\fP \fIglob\-regular\-expr\fP
+.INDENT 0.0
+.INDENT 3.5
+Extract the global variable(s) matching \fIglobal\-regular\-expr\fP from the LLVM
bitcode. All global variables matching the regular expression will be extracted.
May be specified multiple times.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.IP "\fB\-o\fR \fIfilename\fR" 4
-.IX Item "-o filename"
-Specify the output filename. If filename is \*(L"\-\*(R" (the default), then
-\&\fBllvm-extract\fR sends its output to standard output.
-.IP "\fB\-S\fR" 4
-.IX Item "-S"
-Write output in \s-1LLVM\s0 intermediate language (instead of bitcode).
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-extract\fR succeeds, it will exit with 0. Otherwise, if an error
-occurs, it will exit with a non-zero value.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-bugpoint
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-o\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Specify the output filename. If filename is "\-" (the default), then
+\fBllvm\-extract\fP sends its output to standard output.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-S\fP
+.INDENT 0.0
+.INDENT 3.5
+Write output in LLVM intermediate language (instead of bitcode).
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-extract\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+bugpoint|bugpoint
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-ld/Makefile b/usr.bin/clang/llvm-ld/Makefile
deleted file mode 100644
index 441bef9..0000000
--- a/usr.bin/clang/llvm-ld/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-# $FreeBSD$
-
-PROG_CXX=llvm-ld
-
-SRCDIR= tools/llvm-ld
-SRCS= Optimize.cpp \
- llvm-ld.cpp
-
-TGHDRS= Intrinsics
-LIBDEPS=llvmbitwriter \
- llvmlinker \
- llvmarchive \
- llvmbitreader \
- llvmipo \
- llvmvectorize \
- llvmscalaropts \
- llvminstcombine \
- llvmtransformutils \
- llvmipa \
- llvmanalysis \
- llvmtarget \
- llvmmc \
- llvmobject \
- llvmcore \
- llvmsupport
-
-.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-ld/llvm-ld.1 b/usr.bin/clang/llvm-ld/llvm-ld.1
deleted file mode 100644
index fcd3dbc..0000000
--- a/usr.bin/clang/llvm-ld/llvm-ld.1
+++ /dev/null
@@ -1,319 +0,0 @@
-.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-LD 1"
-.TH LLVM-LD 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-ld \- LLVM linker
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-ld\fR <options> <files>
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllvm-ld\fR tool takes a set of \s-1LLVM\s0 bitcode files and links them
-together into a single \s-1LLVM\s0 bitcode file. The output bitcode file can be
-another bitcode file or an executable bitcode program. Using additional
-options, \fBllvm-ld\fR is able to produce native code executables.
-.PP
-The \fBllvm-ld\fR tool is the main linker for \s-1LLVM\s0. It is used to link together
-the output of \s-1LLVM\s0 front-end compilers and run \*(L"link time\*(R" optimizations (mostly
-the inter-procedural kind).
-.PP
-The \fBllvm-ld\fR tools attempts to mimic the interface provided by the default
-system linker so that it can act as a \fIdrop-in\fR replacement.
-.SS "Search Order"
-.IX Subsection "Search Order"
-When looking for objects specified on the command line, \fBllvm-ld\fR will search
-for the object first in the current directory and then in the directory
-specified by the \fB\s-1LLVM_LIB_SEARCH_PATH\s0\fR environment variable. If it cannot
-find the object, it fails.
-.PP
-When looking for a library specified with the \fB\-l\fR option, \fBllvm-ld\fR first
-attempts to load a file with that name from the current directory. If that
-fails, it looks for lib\fIlibrary\fR.bc, lib\fIlibrary\fR.a, or lib\fIlibrary\fR.\fIshared
-library extension\fR, in that order, in each directory added to the library search
-path with the \fB\-L\fR option. These directories are searched in the order they
-are specified. If the library cannot be located, then \fBllvm-ld\fR looks in the
-directory specified by the \fB\s-1LLVM_LIB_SEARCH_PATH\s0\fR environment variable. If it
-does not find a library there, it fails.
-.PP
-The \fIshared library extension\fR may be \fI.so\fR, \fI.dyld\fR, \fI.dll\fR, or something
-different, depending upon the system.
-.PP
-The \fB\-L\fR option is global. It does not matter where it is specified in the
-list of command line arguments; the directory is simply added to the search path
-and is applied to all libraries, preceding or succeeding, in the command line.
-.SS "Link order"
-.IX Subsection "Link order"
-All object and bitcode files are linked first in the order they were
-specified on the command line. All library files are linked next.
-Some libraries may not be linked into the object program; see below.
-.SS "Library Linkage"
-.IX Subsection "Library Linkage"
-Object files and static bitcode objects are always linked into the output
-file. Library archives (.a files) load only the objects within the archive
-that define symbols needed by the output file. Hence, libraries should be
-listed after the object files and libraries which need them; otherwise, the
-library may not be linked in, and the dependent library will not have its
-undefined symbols defined.
-.SS "Native code generation"
-.IX Subsection "Native code generation"
-The \fBllvm-ld\fR program has limited support for native code generation, when
-using the \fB\-native\fR or \fB\-native\-cbe\fR options. Native code generation is
-performed by converting the linked bitcode into native assembly (.s) or C code
-and running the system compiler (typically gcc) on the result.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.SS "General Options"
-.IX Subsection "General Options"
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
-Print a summary of command line options.
-.IP "\fB\-v\fR" 4
-.IX Item "-v"
-Specifies verbose mode. In this mode the linker will print additional
-information about the actions it takes, programs it executes, etc.
-.IP "\fB\-stats\fR" 4
-.IX Item "-stats"
-Print statistics.
-.IP "\fB\-time\-passes\fR" 4
-.IX Item "-time-passes"
-Record the amount of time needed for each pass and print it to standard
-error.
-.SS "Input/Output Options"
-.IX Subsection "Input/Output Options"
-.IP "\fB\-o\fR \fIfilename\fR" 4
-.IX Item "-o filename"
-This overrides the default output file and specifies the name of the file that
-should be generated by the linker. By default, \fBllvm-ld\fR generates a file named
-\&\fIa.out\fR for compatibility with \fBld\fR. The output will be written to
-\&\fIfilename\fR.
-.IP "\fB\-b\fR \fIfilename\fR" 4
-.IX Item "-b filename"
-This option can be used to override the output bitcode file name. By default,
-the name of the bitcode output file is one more \*(L".bc\*(R" suffix added to the name
-specified by \fB\-o filename\fR option.
-.IP "\fB\-l\fR\fIname\fR" 4
-.IX Item "-lname"
-This option specifies the \fIname\fR of a library to search when resolving symbols
-for the program. Only the base name should be specified as \fIname\fR, without a
-\&\fIlib\fR prefix or any suffix.
-.IP "\fB\-L\fR\fIPath\fR" 4
-.IX Item "-LPath"
-This option tells \fBllvm-ld\fR to look in \fIPath\fR to find any library subsequently
-specified with the \fB\-l\fR option. The paths will be searched in the order in
-which they are specified on the command line. If the library is still not found,
-a small set of system specific directories will also be searched. Note that
-libraries specified with the \fB\-l\fR option that occur \fIbefore\fR any \fB\-L\fR options
-will not search the paths given by the \fB\-L\fR options following it.
-.IP "\fB\-link\-as\-library\fR" 4
-.IX Item "-link-as-library"
-Link the bitcode files together as a library, not an executable. In this mode,
-undefined symbols will be permitted.
-.IP "\fB\-r\fR" 4
-.IX Item "-r"
-An alias for \-link\-as\-library.
-.IP "\fB\-native\fR" 4
-.IX Item "-native"
-Generate a native machine code executable.
-.Sp
-When generating native executables, \fBllvm-ld\fR first checks for a bitcode
-version of the library and links it in, if necessary. If the library is
-missing, \fBllvm-ld\fR skips it. Then, \fBllvm-ld\fR links in the same
-libraries as native code.
-.Sp
-In this way, \fBllvm-ld\fR should be able to link in optimized bitcode
-subsets of common libraries and then link in any part of the library that
-hasn't been converted to bitcode.
-.IP "\fB\-native\-cbe\fR" 4
-.IX Item "-native-cbe"
-Generate a native machine code executable with the \s-1LLVM\s0 C backend.
-.Sp
-This option is identical to the \fB\-native\fR option, but uses the
-C backend to generate code for the program instead of an \s-1LLVM\s0 native
-code generator.
-.SS "Optimization Options"
-.IX Subsection "Optimization Options"
-.IP "\fB\-disable\-inlining\fR" 4
-.IX Item "-disable-inlining"
-Do not run the inlining pass. Functions will not be inlined into other
-functions.
-.IP "\fB\-disable\-opt\fR" 4
-.IX Item "-disable-opt"
-Completely disable optimization.
-.IP "\fB\-disable\-internalize\fR" 4
-.IX Item "-disable-internalize"
-Do not mark all symbols as internal.
-.IP "\fB\-verify\-each\fR" 4
-.IX Item "-verify-each"
-Run the verification pass after each of the passes to verify intermediate
-results.
-.IP "\fB\-strip\-all\fR" 4
-.IX Item "-strip-all"
-Strip all debug and symbol information from the executable to make it smaller.
-.IP "\fB\-strip\-debug\fR" 4
-.IX Item "-strip-debug"
-Strip all debug information from the executable to make it smaller.
-.IP "\fB\-s\fR" 4
-.IX Item "-s"
-An alias for \fB\-strip\-all\fR.
-.IP "\fB\-S\fR" 4
-.IX Item "-S"
-An alias for \fB\-strip\-debug\fR.
-.IP "\fB\-export\-dynamic\fR" 4
-.IX Item "-export-dynamic"
-An alias for \fB\-disable\-internalize\fR
-.IP "\fB\-post\-link\-opt\fR\fIPath\fR" 4
-.IX Item "-post-link-optPath"
-Run post-link optimization program. After linking is completed a bitcode file
-will be generated. It will be passed to the program specified by \fIPath\fR as the
-first argument. The second argument to the program will be the name of a
-temporary file into which the program should place its optimized output. For
-example, the \*(L"no-op optimization\*(R" would be a simple shell script:
-.Sp
-.Vb 2
-\& #!/bin/bash
-\& cp $1 $2
-.Ve
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-ld\fR succeeds, it will exit with 0 return code. If an error occurs,
-it will exit with a non-zero return code.
-.SH "ENVIRONMENT"
-.IX Header "ENVIRONMENT"
-The \f(CW\*(C`LLVM_LIB_SEARCH_PATH\*(C'\fR environment variable is used to find bitcode
-libraries. Any paths specified in this variable will be searched after the \f(CW\*(C`\-L\*(C'\fR
-options.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-llvm-link
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
diff --git a/usr.bin/clang/llvm-link/Makefile b/usr.bin/clang/llvm-link/Makefile
index 25d3313..bcd6a51 100644
--- a/usr.bin/clang/llvm-link/Makefile
+++ b/usr.bin/clang/llvm-link/Makefile
@@ -13,6 +13,7 @@ LIBDEPS=llvmasmparser \
llvmanalysis \
llvmtarget \
llvmmc \
+ llvmobject \
llvmarchive \
llvmbitreader \
llvmcore \
diff --git a/usr.bin/clang/llvm-link/llvm-link.1 b/usr.bin/clang/llvm-link/llvm-link.1
index ec75123..67e4cb7 100644
--- a/usr.bin/clang/llvm-link/llvm-link.1
+++ b/usr.bin/clang/llvm-link/llvm-link.1
@@ -1,190 +1,119 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-LINK" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-link \- LLVM linker
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-LINK 1"
-.TH LLVM-LINK 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-link \- LLVM linker
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-link\fR [\fIoptions\fR] \fIfilename ...\fR
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBllvm-link\fR takes several \s-1LLVM\s0 bitcode files and links them together into a
-single \s-1LLVM\s0 bitcode file. It writes the output file to standard output, unless
-the \fB\-o\fR option is used to specify a filename.
-.PP
-\&\fBllvm-link\fR attempts to load the input files from the current directory. If
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-link\fP [\fIoptions\fP] \fIfilename ...\fP
+.SH DESCRIPTION
+.sp
+\fBllvm\-link\fP takes several LLVM bitcode files and links them together into a
+single LLVM bitcode file. It writes the output file to standard output, unless
+the \fB\-o\fP option is used to specify a filename.
+.sp
+\fBllvm\-link\fP attempts to load the input files from the current directory. If
that fails, it looks for each file in each of the directories specified by the
-\&\fB\-L\fR options on the command line. The library search paths are global; each
+\fB\-L\fP options on the command line. The library search paths are global; each
one is searched for every input file if necessary. The directories are searched
in the order they were specified on the command line.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-L\fR \fIdirectory\fR" 4
-.IX Item "-L directory"
-Add the specified \fIdirectory\fR to the library search path. When looking for
-libraries, \fBllvm-link\fR will look in path name for libraries. This option can be
-specified multiple times; \fBllvm-link\fR will search inside these directories in
+.SH OPTIONS
+.sp
+\fB\-L\fP \fIdirectory\fP
+.INDENT 0.0
+.INDENT 3.5
+Add the specified \fIdirectory\fP to the library search path. When looking for
+libraries, \fBllvm\-link\fP will look in path name for libraries. This option can be
+specified multiple times; \fBllvm\-link\fP will search inside these directories in
the order in which they were specified on the command line.
-.IP "\fB\-f\fR" 4
-.IX Item "-f"
-Enable binary output on terminals. Normally, \fBllvm-link\fR will refuse to
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-f\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable binary output on terminals. Normally, \fBllvm\-link\fP will refuse to
write raw bitcode output if the output stream is a terminal. With this option,
-\&\fBllvm-link\fR will write raw bitcode regardless of the output device.
-.IP "\fB\-o\fR \fIfilename\fR" 4
-.IX Item "-o filename"
-Specify the output file name. If \fIfilename\fR is \f(CW\*(C`\-\*(C'\fR, then \fBllvm-link\fR will
+\fBllvm\-link\fP will write raw bitcode regardless of the output device.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-o\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Specify the output file name. If \fIfilename\fP is \fB\-\fP, then \fBllvm\-link\fP will
write its output to standard output.
-.IP "\fB\-S\fR" 4
-.IX Item "-S"
-Write output in \s-1LLVM\s0 intermediate language (instead of bitcode).
-.IP "\fB\-d\fR" 4
-.IX Item "-d"
-If specified, \fBllvm-link\fR prints a human-readable version of the output
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-S\fP
+.INDENT 0.0
+.INDENT 3.5
+Write output in LLVM intermediate language (instead of bitcode).
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-d\fP
+.INDENT 0.0
+.INDENT 3.5
+If specified, \fBllvm\-link\fP prints a human\-readable version of the output
bitcode file to standard error.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.IP "\fB\-v\fR" 4
-.IX Item "-v"
-Verbose mode. Print information about what \fBllvm-link\fR is doing. This
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-v\fP
+.INDENT 0.0
+.INDENT 3.5
+Verbose mode. Print information about what \fBllvm\-link\fP is doing. This
typically includes a message for each bitcode file linked in and for each
library found.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-link\fR succeeds, it will exit with 0. Otherwise, if an error
-occurs, it will exit with a non-zero value.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-gccld
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-link\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH SEE ALSO
+.sp
+gccld|gccld
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-mc/Makefile b/usr.bin/clang/llvm-mc/Makefile
index 3372182..1c08894 100644
--- a/usr.bin/clang/llvm-mc/Makefile
+++ b/usr.bin/clang/llvm-mc/Makefile
@@ -12,20 +12,20 @@ LIBDEPS=llvmmcdisassembler \
llvmarmasmparser \
llvmarmcodegen \
llvmarmdesc \
- llvmarminstprinter \
llvmarminfo \
+ llvmarminstprinter \
llvmmipscodegen \
+ llvmmipsdisassembler \
+ llvmmipsasmparser \
llvmmipsdesc \
- llvmmipsinstprinter \
llvmmipsinfo \
+ llvmmipsinstprinter \
llvmpowerpccodegen \
llvmpowerpcdesc \
- llvmpowerpcinstprinter \
llvmpowerpcinfo \
- llvmx86disassembler \
+ llvmpowerpcinstprinter \
llvmx86asmparser \
llvmx86codegen \
- llvmx86desc \
llvmselectiondag \
llvmasmprinter \
llvmmcparser \
@@ -35,12 +35,15 @@ LIBDEPS=llvmmcdisassembler \
llvmtransformutils \
llvmipa \
llvmanalysis \
+ llvmx86disassembler \
+ llvmx86desc \
+ llvmx86info \
llvmtarget \
llvmx86instprinter \
+ llvmmc \
+ llvmobject \
llvmx86utils \
llvmcore \
- llvmx86info \
- llvmmc \
llvmsupport
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-nm/llvm-nm.1 b/usr.bin/clang/llvm-nm/llvm-nm.1
index e2eeec3..8df8f3f 100644
--- a/usr.bin/clang/llvm-nm/llvm-nm.1
+++ b/usr.bin/clang/llvm-nm/llvm-nm.1
@@ -1,219 +1,213 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-NM" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-nm \- list LLVM bitcode and object file's symbol table
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-NM 1"
-.TH LLVM-NM 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-nm \- list LLVM bitcode file's symbol table
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-nm\fR [\fIoptions\fR] [\fIfilenames...\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllvm-nm\fR utility lists the names of symbols from the \s-1LLVM\s0 bitcode files,
-or \fBar\fR archives containing \s-1LLVM\s0 bitcode files, named on the command line.
-Each symbol is listed along with some simple information about its provenance.
-If no file name is specified, or \fI\-\fR is used as a file name, \fBllvm-nm\fR will
-process a bitcode file on its standard input stream.
-.PP
-\&\fBllvm-nm\fR's default output format is the traditional \s-1BSD\s0 \fBnm\fR output format.
-Each such output record consists of an (optional) 8\-digit hexadecimal address,
-followed by a type code character, followed by a name, for each symbol. One
-record is printed per line; fields are separated by spaces. When the address is
-omitted, it is replaced by 8 spaces.
-.PP
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-nm\fP [\fIoptions\fP] [\fIfilenames...\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-nm\fP utility lists the names of symbols from the LLVM bitcode
+files, object files, or \fBar\fP archives containing them, named on the
+command line. Each symbol is listed along with some simple information about its
+provenance. If no file name is specified, or \fI\-\fP is used as a file name,
+\fBllvm\-nm\fP will process a file on its standard input stream.
+.sp
+\fBllvm\-nm\fP\(aqs default output format is the traditional BSD \fBnm\fP
+output format. Each such output record consists of an (optional) 8\-digit
+hexadecimal address, followed by a type code character, followed by a name, for
+each symbol. One record is printed per line; fields are separated by spaces.
+When the address is omitted, it is replaced by 8 spaces.
+.sp
Type code characters currently supported, and their meanings, are as follows:
-.IP "U" 4
-.IX Item "U"
+.sp
+U
+.INDENT 0.0
+.INDENT 3.5
Named object is referenced but undefined in this bitcode file
-.IP "C" 4
-.IX Item "C"
+.UNINDENT
+.UNINDENT
+.sp
+C
+.INDENT 0.0
+.INDENT 3.5
Common (multiple definitions link together into one def)
-.IP "W" 4
-.IX Item "W"
+.UNINDENT
+.UNINDENT
+.sp
+W
+.INDENT 0.0
+.INDENT 3.5
Weak reference (multiple definitions link together into zero or one definitions)
-.IP "t" 4
-.IX Item "t"
+.UNINDENT
+.UNINDENT
+.sp
+t
+.INDENT 0.0
+.INDENT 3.5
Local function (text) object
-.IP "T" 4
-.IX Item "T"
+.UNINDENT
+.UNINDENT
+.sp
+T
+.INDENT 0.0
+.INDENT 3.5
Global function (text) object
-.IP "d" 4
-.IX Item "d"
+.UNINDENT
+.UNINDENT
+.sp
+d
+.INDENT 0.0
+.INDENT 3.5
Local data object
-.IP "D" 4
-.IX Item "D"
+.UNINDENT
+.UNINDENT
+.sp
+D
+.INDENT 0.0
+.INDENT 3.5
Global data object
-.IP "?" 4
+.UNINDENT
+.UNINDENT
+.sp
+?
+.INDENT 0.0
+.INDENT 3.5
Something unrecognizable
-.PP
-Because \s-1LLVM\s0 bitcode files typically contain objects that are not considered to
+.UNINDENT
+.UNINDENT
+.sp
+Because LLVM bitcode files typically contain objects that are not considered to
have addresses until they are linked into an executable image or dynamically
-compiled \*(L"just-in-time\*(R", \fBllvm-nm\fR does not print an address for any symbol,
-even symbols which are defined in the bitcode file.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-P\fR" 4
-.IX Item "-P"
-Use \s-1POSIX\s0.2 output format. Alias for \fB\-\-format=posix\fR.
-.IP "\fB\-B\fR (default)" 4
-.IX Item "-B (default)"
-Use \s-1BSD\s0 output format. Alias for \fB\-\-format=bsd\fR.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
-Print a summary of command-line options and their meanings.
-.IP "\fB\-\-defined\-only\fR" 4
-.IX Item "--defined-only"
-Print only symbols defined in this bitcode file (as opposed to
+compiled "just\-in\-time", \fBllvm\-nm\fP does not print an address for any
+symbol in a LLVM bitcode file, even symbols which are defined in the bitcode
+file.
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-B (default)
+Use BSD output format. Alias for \fI\-\-format=bsd\fP.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-P
+Use POSIX.2 output format. Alias for \fI\-\-format=posix\fP.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-debug\-syms, \-a
+Show all symbols, even debugger only.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-defined\-only
+Print only symbols defined in this file (as opposed to
symbols which may be referenced by objects in this file, but not
defined in this file.)
-.IP "\fB\-\-extern\-only\fR, \fB\-g\fR" 4
-.IX Item "--extern-only, -g"
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-dynamic, \-D
+Display dynamic symbols instead of normal symbols.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-extern\-only, \-g
Print only symbols whose definitions are external; that is, accessible
-from other bitcode files.
-.IP "\fB\-\-undefined\-only\fR, \fB\-u\fR" 4
-.IX Item "--undefined-only, -u"
-Print only symbols referenced but not defined in this bitcode file.
-.IP "\fB\-\-format=\fR\fIfmt\fR, \fB\-f\fR" 4
-.IX Item "--format=fmt, -f"
-Select an output format; \fIfmt\fR may be \fIsysv\fR, \fIposix\fR, or \fIbsd\fR. The
-default is \fIbsd\fR.
-.SH "BUGS"
-.IX Header "BUGS"
-\&\fBllvm-nm\fR cannot demangle \*(C+ mangled names, like \s-1GNU\s0 \fBnm\fR can.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-\&\fBllvm-nm\fR exits with an exit code of zero.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-llvm-dis, \fIar\fR\|(1), \fInm\fR\|(1)
-.SH "AUTHOR"
-.IX Header "AUTHOR"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+from other files.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-format=format, \-f format
+Select an output format; \fIformat\fP may be \fIsysv\fP, \fIposix\fP, or \fIbsd\fP. The default
+is \fIbsd\fP.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-help
+Print a summary of command\-line options and their meanings.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-no\-sort, \-p
+Shows symbols in order encountered.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-numeric\-sort, \-n, \-v
+Sort symbols by address.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-print\-file\-name, \-A, \-o
+Precede each symbol with the file it came from.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-print\-size, \-S
+Show symbol size instead of address.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-size\-sort
+Sort symbols by size.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-undefined\-only, \-u
+Print only symbols referenced but not defined in this file.
+.UNINDENT
+.SH BUGS
+.INDENT 0.0
+.INDENT 3.5
+.INDENT 0.0
+.IP \(bu 2
+\fBllvm\-nm\fP cannot demangle C++ mangled names, like GNU \fBnm\fP
+can.
+.IP \(bu 2
+\fBllvm\-nm\fP does not support the full set of arguments that GNU
+\fBnm\fP does.
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+\fBllvm\-nm\fP exits with an exit code of zero.
+.SH SEE ALSO
+.sp
+llvm\-dis|llvm\-dis, ar(1), nm(1)
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-objdump/Makefile b/usr.bin/clang/llvm-objdump/Makefile
index a98cae5..351c06c 100644
--- a/usr.bin/clang/llvm-objdump/Makefile
+++ b/usr.bin/clang/llvm-objdump/Makefile
@@ -8,27 +8,26 @@ SRCS= llvm-objdump.cpp \
MachODump.cpp \
MCFunction.cpp \
-LIBDEPS=llvmobject \
- llvmmcdisassembler \
+LIBDEPS=llvmmcdisassembler \
llvmdebuginfo \
llvmarmdisassembler \
llvmarmasmparser \
llvmarmcodegen \
llvmarmdesc \
- llvmarminstprinter \
llvmarminfo \
+ llvmarminstprinter \
llvmmipscodegen \
+ llvmmipsdisassembler \
+ llvmmipsasmparser \
llvmmipsdesc \
- llvmmipsinstprinter \
llvmmipsinfo \
+ llvmmipsinstprinter \
llvmpowerpccodegen \
llvmpowerpcdesc \
- llvmpowerpcinstprinter \
llvmpowerpcinfo \
- llvmx86disassembler \
+ llvmpowerpcinstprinter \
llvmx86asmparser \
llvmx86codegen \
- llvmx86desc \
llvmselectiondag \
llvmasmprinter \
llvmmcparser \
@@ -38,12 +37,15 @@ LIBDEPS=llvmobject \
llvmtransformutils \
llvmipa \
llvmanalysis \
+ llvmx86disassembler \
+ llvmx86desc \
+ llvmx86info \
llvmtarget \
llvmx86instprinter \
+ llvmmc \
+ llvmobject \
llvmx86utils \
llvmcore \
- llvmx86info \
- llvmmc \
llvmsupport
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-prof/Makefile b/usr.bin/clang/llvm-prof/Makefile
index fbe5df9..b7b29cd 100644
--- a/usr.bin/clang/llvm-prof/Makefile
+++ b/usr.bin/clang/llvm-prof/Makefile
@@ -8,6 +8,7 @@ SRCS= llvm-prof.cpp
LIBDEPS=llvmanalysis \
llvmtarget \
llvmmc \
+ llvmobject \
llvmbitreader \
llvmcore \
llvmsupport
diff --git a/usr.bin/clang/llvm-prof/llvm-prof.1 b/usr.bin/clang/llvm-prof/llvm-prof.1
index 1b07c24..fd34cd7 100644
--- a/usr.bin/clang/llvm-prof/llvm-prof.1
+++ b/usr.bin/clang/llvm-prof/llvm-prof.1
@@ -1,173 +1,86 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-PROF" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-prof \- print execution profile of LLVM program
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-PROF 1"
-.TH LLVM-PROF 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-prof \- print execution profile of LLVM program
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-prof\fR [\fIoptions\fR] [\fIbitcode file\fR] [\fIllvmprof.out\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllvm-prof\fR tool reads in an \fIllvmprof.out\fR file (which can
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-prof\fP [\fIoptions\fP] [\fIbitcode file\fP] [\fIllvmprof.out\fP]
+.SH DESCRIPTION
+.sp
+The \fBllvm\-prof\fP tool reads in an \fIllvmprof.out\fP file (which can
optionally use a specific file with the third program argument), a bitcode file
for the program, and produces a human readable report, suitable for determining
where the program hotspots are.
-.PP
-This program is often used in conjunction with the \fIutils/profile.pl\fR
-script. This script automatically instruments a program, runs it with the \s-1JIT\s0,
-then runs \fBllvm-prof\fR to format a report. To get more information about
-\&\fIutils/profile.pl\fR, execute it with the \fB\-help\fR option.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-\-annotated\-llvm\fR or \fB\-A\fR" 4
-.IX Item "--annotated-llvm or -A"
+.sp
+This program is often used in conjunction with the \fIutils/profile.pl\fP
+script. This script automatically instruments a program, runs it with the JIT,
+then runs \fBllvm\-prof\fP to format a report. To get more information about
+\fIutils/profile.pl\fP, execute it with the \fB\-help\fP option.
+.SH OPTIONS
+.sp
+\fB\-\-annotated\-llvm\fP or \fB\-A\fP
+.INDENT 0.0
+.INDENT 3.5
In addition to the normal report printed, print out the code for the
program, annotated with execution frequency information. This can be
particularly useful when trying to visualize how frequently basic blocks
are executed. This is most useful with basic block profiling
information or better.
-.IP "\fB\-\-print\-all\-code\fR" 4
-.IX Item "--print-all-code"
-Using this option enables the \fB\-\-annotated\-llvm\fR option, but it
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-print\-all\-code\fP
+.INDENT 0.0
+.INDENT 3.5
+Using this option enables the \fB\-\-annotated\-llvm\fP option, but it
prints the entire module, instead of just the most commonly executed
functions.
-.IP "\fB\-\-time\-passes\fR" 4
-.IX Item "--time-passes"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-\-time\-passes\fP
+.INDENT 0.0
+.INDENT 3.5
Record the amount of time needed for each pass and print it to standard
error.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-\&\fBllvm-prof\fR returns 1 if it cannot load the bitcode file or the profile
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+\fBllvm\-prof\fP returns 1 if it cannot load the bitcode file or the profile
information. Otherwise, it exits with zero.
-.SH "AUTHOR"
-.IX Header "AUTHOR"
-\&\fBllvm-prof\fR is maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-ranlib/llvm-ranlib.1 b/usr.bin/clang/llvm-ranlib/llvm-ranlib.1
index 844411d..60ada02 100644
--- a/usr.bin/clang/llvm-ranlib/llvm-ranlib.1
+++ b/usr.bin/clang/llvm-ranlib/llvm-ranlib.1
@@ -1,167 +1,80 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
+.TH "LLVM-RANLIB" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+llvm-ranlib \- Generate index for LLVM archive
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
-..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "LLVM-RANLIB 1"
-.TH LLVM-RANLIB 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-llvm\-ranlib \- Generate index for LLVM archive
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBllvm-ranlib\fR [\-\-version] [\-help] <archive\-file>
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBllvm-ranlib\fR command is similar to the common Unix utility, \f(CW\*(C`ranlib\*(C'\fR. It
-adds or updates the symbol table in an \s-1LLVM\s0 archive file. Note that using the
-\&\fBllvm-ar\fR modifier \fIs\fR is usually more efficient than running \fBllvm-ranlib\fR
-which is only provided only for completness and compatibility. Unlike other
-implementations of \f(CW\*(C`ranlib\*(C'\fR, \fBllvm-ranlib\fR indexes \s-1LLVM\s0 bitcode files, not
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBllvm\-ranlib\fP [\-\-version] [\-help] <archive\-file>
+.SH DESCRIPTION
+.sp
+The \fBllvm\-ranlib\fP command is similar to the common Unix utility, \fBranlib\fP. It
+adds or updates the symbol table in an LLVM archive file. Note that using the
+\fBllvm\-ar\fP modifier \fIs\fP is usually more efficient than running \fBllvm\-ranlib\fP
+which is only provided only for completness and compatibility. Unlike other
+implementations of \fBranlib\fP, \fBllvm\-ranlib\fP indexes LLVM bitcode files, not
native object modules. You can list the contents of the symbol table with the
-\&\f(CW\*(C`llvm\-nm \-s\*(C'\fR command.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fIarchive-file\fR" 4
-.IX Item "archive-file"
-Specifies the archive-file to which the symbol table is added or updated.
-.IP "\fI\-\-version\fR" 4
-.IX Item "--version"
-Print the version of \fBllvm-ranlib\fR and exit without building a symbol table.
-.IP "\fI\-help\fR" 4
-.IX Item "-help"
-Print usage help for \fBllvm-ranlib\fR and exit without building a symbol table.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBllvm-ranlib\fR succeeds, it will exit with 0. If an error occurs, a non-zero
+\fBllvm\-nm \-s\fP command.
+.SH OPTIONS
+.sp
+\fIarchive\-file\fP
+.INDENT 0.0
+.INDENT 3.5
+Specifies the archive\-file to which the symbol table is added or updated.
+.UNINDENT
+.UNINDENT
+.sp
+\fI\-\-version\fP
+.INDENT 0.0
+.INDENT 3.5
+Print the version of \fBllvm\-ranlib\fP and exit without building a symbol table.
+.UNINDENT
+.UNINDENT
+.sp
+\fI\-help\fP
+.INDENT 0.0
+.INDENT 3.5
+Print usage help for \fBllvm\-ranlib\fP and exit without building a symbol table.
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBllvm\-ranlib\fP succeeds, it will exit with 0. If an error occurs, a non\-zero
exit code will be returned.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-llvm-ar, \fIranlib\fR\|(1)
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.SH SEE ALSO
+.sp
+llvm\-ar|llvm\-ar, ranlib(1)
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/llvm-rtdyld/Makefile b/usr.bin/clang/llvm-rtdyld/Makefile
index 489307a..e3b5d87 100644
--- a/usr.bin/clang/llvm-rtdyld/Makefile
+++ b/usr.bin/clang/llvm-rtdyld/Makefile
@@ -9,25 +9,24 @@ SRCS= llvm-rtdyld.cpp
LIBDEPS=llvmjit \
llvmexecutionengine \
llvmruntimedyld \
- llvmobject \
llvmarmdisassembler \
llvmarmasmparser \
llvmarmcodegen \
llvmarmdesc \
- llvmarminstprinter \
llvmarminfo \
+ llvmarminstprinter \
llvmmipscodegen \
+ llvmmipsdisassembler \
+ llvmmipsasmparser \
llvmmipsdesc \
- llvmmipsinstprinter \
llvmmipsinfo \
+ llvmmipsinstprinter \
llvmpowerpccodegen \
llvmpowerpcdesc \
- llvmpowerpcinstprinter \
llvmpowerpcinfo \
- llvmx86disassembler \
+ llvmpowerpcinstprinter \
llvmx86asmparser \
llvmx86codegen \
- llvmx86desc \
llvmselectiondag \
llvmasmprinter \
llvmmcparser \
@@ -37,12 +36,15 @@ LIBDEPS=llvmjit \
llvmtransformutils \
llvmipa \
llvmanalysis \
+ llvmx86disassembler \
+ llvmx86desc \
+ llvmx86info \
llvmtarget \
llvmx86instprinter \
+ llvmmc \
+ llvmobject \
llvmx86utils \
llvmcore \
- llvmx86info \
- llvmmc \
llvmsupport
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/llvm-stub/Makefile b/usr.bin/clang/llvm-stub/Makefile
deleted file mode 100644
index 56e7660..0000000
--- a/usr.bin/clang/llvm-stub/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $FreeBSD$
-
-PROG= llvm-stub
-NO_MAN=
-
-SRCDIR= tools/llvm-stub
-SRCS= llvm-stub.c
-
-.include "../clang.prog.mk"
diff --git a/usr.bin/clang/opt/opt.1 b/usr.bin/clang/opt/opt.1
index 6d82aae..a69bb65 100644
--- a/usr.bin/clang/opt/opt.1
+++ b/usr.bin/clang/opt/opt.1
@@ -1,250 +1,219 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.TH "OPT" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+opt \- LLVM optimizer
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "OPT 1"
-.TH OPT 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-opt \- LLVM optimizer
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBopt\fR [\fIoptions\fR] [\fIfilename\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBopt\fR command is the modular \s-1LLVM\s0 optimizer and analyzer. It takes \s-1LLVM\s0
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBopt\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+The \fBopt\fP command is the modular LLVM optimizer and analyzer. It takes LLVM
source files as input, runs the specified optimizations or analyses on it, and then
-outputs the optimized file or the analysis results. The function of
-\&\fBopt\fR depends on whether the \fB\-analyze\fR option is given.
-.PP
-When \fB\-analyze\fR is specified, \fBopt\fR performs various analyses of the input
+outputs the optimized file or the analysis results. The function of
+\fBopt\fP depends on whether the \fB\-analyze\fP option is given.
+.sp
+When \fB\-analyze\fP is specified, \fBopt\fP performs various analyses of the input
source. It will usually print the results on standard output, but in a few
cases, it will print output to standard error or generate a file with the
analysis output, which is usually done when the output is meant for another
program.
-.PP
-While \fB\-analyze\fR is \fInot\fR given, \fBopt\fR attempts to produce an optimized
-output file. The optimizations available via \fBopt\fR depend upon what
-libraries were linked into it as well as any additional libraries that have
-been loaded with the \fB\-load\fR option. Use the \fB\-help\fR option to determine
+.sp
+While \fB\-analyze\fP is \fInot\fP given, \fBopt\fP attempts to produce an optimized
+output file. The optimizations available via \fBopt\fP depend upon what
+libraries were linked into it as well as any additional libraries that have
+been loaded with the \fB\-load\fP option. Use the \fB\-help\fP option to determine
what optimizations you can use.
-.PP
-If \fIfilename\fR is omitted from the command line or is \fI\-\fR, \fBopt\fR reads its
-input from standard input. Inputs can be in either the \s-1LLVM\s0 assembly language
-format (.ll) or the \s-1LLVM\s0 bitcode format (.bc).
-.PP
-If an output filename is not specified with the \fB\-o\fR option, \fBopt\fR
+.sp
+If \fIfilename\fP is omitted from the command line or is \fI\-\fP, \fBopt\fP reads its
+input from standard input. Inputs can be in either the LLVM assembly language
+format (.ll) or the LLVM bitcode format (.bc).
+.sp
+If an output filename is not specified with the \fB\-o\fP option, \fBopt\fP
writes its output to the standard output.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-f\fR" 4
-.IX Item "-f"
-Enable binary output on terminals. Normally, \fBopt\fR will refuse to
+.SH OPTIONS
+.sp
+\fB\-f\fP
+.INDENT 0.0
+.INDENT 3.5
+Enable binary output on terminals. Normally, \fBopt\fP will refuse to
write raw bitcode output if the output stream is a terminal. With this option,
-\&\fBopt\fR will write raw bitcode regardless of the output device.
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+\fBopt\fP will write raw bitcode regardless of the output device.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.IP "\fB\-o\fR \fIfilename\fR" 4
-.IX Item "-o filename"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-o\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
Specify the output filename.
-.IP "\fB\-S\fR" 4
-.IX Item "-S"
-Write output in \s-1LLVM\s0 intermediate language (instead of bitcode).
-.IP "\fB\-{passname}\fR" 4
-.IX Item "-{passname}"
-\&\fBopt\fR provides the ability to run any of \s-1LLVM\s0's optimization or analysis passes
-in any order. The \fB\-help\fR option lists all the passes available. The order in
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-S\fP
+.INDENT 0.0
+.INDENT 3.5
+Write output in LLVM intermediate language (instead of bitcode).
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-{passname}\fP
+.INDENT 0.0
+.INDENT 3.5
+\fBopt\fP provides the ability to run any of LLVM\(aqs optimization or analysis passes
+in any order. The \fB\-help\fP option lists all the passes available. The order in
which the options occur on the command line are the order in which they are
executed (within pass constraints).
-.IP "\fB\-std\-compile\-opts\fR" 4
-.IX Item "-std-compile-opts"
-This is short hand for a standard list of \fIcompile time optimization\fR passes.
-This is typically used to optimize the output from the llvm-gcc front end. It
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-std\-compile\-opts\fP
+.INDENT 0.0
+.INDENT 3.5
+This is short hand for a standard list of \fIcompile time optimization\fP passes.
+This is typically used to optimize the output from the llvm\-gcc front end. It
might be useful for other front end compilers as well. To discover the full set
of options available, use the following command:
-.Sp
-.Vb 1
-\& llvm\-as < /dev/null | opt \-std\-compile\-opts \-disable\-output \-debug\-pass=Arguments
-.Ve
-.IP "\fB\-disable\-inlining\fR" 4
-.IX Item "-disable-inlining"
-This option is only meaningful when \fB\-std\-compile\-opts\fR is given. It simply
+.sp
+.nf
+.ft C
+llvm\-as < /dev/null | opt \-std\-compile\-opts \-disable\-output \-debug\-pass=Arguments
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-disable\-inlining\fP
+.INDENT 0.0
+.INDENT 3.5
+This option is only meaningful when \fB\-std\-compile\-opts\fP is given. It simply
removes the inlining pass from the standard list.
-.IP "\fB\-disable\-opt\fR" 4
-.IX Item "-disable-opt"
-This option is only meaningful when \fB\-std\-compile\-opts\fR is given. It disables
-most, but not all, of the \fB\-std\-compile\-opts\fR. The ones that remain are
-\&\fB\-verify\fR, \fB\-lower\-setjmp\fR, and \fB\-funcresolve\fR.
-.IP "\fB\-strip\-debug\fR" 4
-.IX Item "-strip-debug"
-This option causes opt to strip debug information from the module before
-applying other optimizations. It is essentially the same as \fB\-strip\fR but it
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-disable\-opt\fP
+.INDENT 0.0
+.INDENT 3.5
+This option is only meaningful when \fB\-std\-compile\-opts\fP is given. It disables
+most, but not all, of the \fB\-std\-compile\-opts\fP. The ones that remain are
+\fB\-verify\fP, \fB\-lower\-setjmp\fP, and \fB\-funcresolve\fP.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-strip\-debug\fP
+.INDENT 0.0
+.INDENT 3.5
+This option causes opt to strip debug information from the module before
+applying other optimizations. It is essentially the same as \fB\-strip\fP but it
ensures that stripping of debug information is done first.
-.IP "\fB\-verify\-each\fR" 4
-.IX Item "-verify-each"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-verify\-each\fP
+.INDENT 0.0
+.INDENT 3.5
This option causes opt to add a verify pass after every pass otherwise specified
-on the command line (including \fB\-verify\fR). This is useful for cases where it
+on the command line (including \fB\-verify\fP). This is useful for cases where it
is suspected that a pass is creating an invalid module but it is not clear which
-pass is doing it. The combination of \fB\-std\-compile\-opts\fR and \fB\-verify\-each\fR
+pass is doing it. The combination of \fB\-std\-compile\-opts\fP and \fB\-verify\-each\fP
can quickly track down this kind of problem.
-.IP "\fB\-profile\-info\-file\fR \fIfilename\fR" 4
-.IX Item "-profile-info-file filename"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-profile\-info\-file\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
Specify the name of the file loaded by the \-profile\-loader option.
-.IP "\fB\-stats\fR" 4
-.IX Item "-stats"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-stats\fP
+.INDENT 0.0
+.INDENT 3.5
Print statistics.
-.IP "\fB\-time\-passes\fR" 4
-.IX Item "-time-passes"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-time\-passes\fP
+.INDENT 0.0
+.INDENT 3.5
Record the amount of time needed for each pass and print it to standard
error.
-.IP "\fB\-debug\fR" 4
-.IX Item "-debug"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-debug\fP
+.INDENT 0.0
+.INDENT 3.5
If this is a debug build, this option will enable debug printouts
-from passes which use the \fI\s-1\fIDEBUG\s0()\fI\fR macro. See the \fB\s-1LLVM\s0 Programmer's
-Manual\fR, section \fI#DEBUG\fR for more information.
-.IP "\fB\-load\fR=\fIplugin\fR" 4
-.IX Item "-load=plugin"
-Load the dynamic object \fIplugin\fR. This object should register new optimization
+from passes which use the \fIDEBUG()\fP macro. See the \fBLLVM Programmer\(aqs
+Manual\fP, section \fI#DEBUG\fP for more information.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-load\fP=\fIplugin\fP
+.INDENT 0.0
+.INDENT 3.5
+Load the dynamic object \fIplugin\fP. This object should register new optimization
or analysis passes. Once loaded, the object will add new command line options to
-enable various optimizations or analyses. To see the new complete list of
-optimizations, use the \fB\-help\fR and \fB\-load\fR options together. For example:
-.Sp
-.Vb 1
-\& opt \-load=plugin.so \-help
-.Ve
-.IP "\fB\-p\fR" 4
-.IX Item "-p"
+enable various optimizations or analyses. To see the new complete list of
+optimizations, use the \fB\-help\fP and \fB\-load\fP options together. For example:
+.sp
+.nf
+.ft C
+opt \-load=plugin.so \-help
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-p\fP
+.INDENT 0.0
+.INDENT 3.5
Print module after each transformation.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBopt\fR succeeds, it will exit with 0. Otherwise, if an error
-occurs, it will exit with a non-zero value.
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by the \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBopt\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/clang/tblgen/Makefile b/usr.bin/clang/tblgen/Makefile
index e2447a6..c74ad83 100644
--- a/usr.bin/clang/tblgen/Makefile
+++ b/usr.bin/clang/tblgen/Makefile
@@ -11,6 +11,7 @@ SRCS= AsmMatcherEmitter.cpp \
CodeGenDAGPatterns.cpp \
CodeGenInstruction.cpp \
CodeGenRegisters.cpp \
+ CodeGenSchedule.cpp \
CodeGenTarget.cpp \
DAGISelEmitter.cpp \
DAGISelMatcher.cpp \
@@ -27,7 +28,6 @@ SRCS= AsmMatcherEmitter.cpp \
PseudoLoweringEmitter.cpp \
RegisterInfoEmitter.cpp \
SetTheory.cpp \
- StringMatcher.cpp \
SubtargetEmitter.cpp \
TGValueTypes.cpp \
TableGen.cpp \
@@ -36,6 +36,7 @@ SRCS= AsmMatcherEmitter.cpp \
X86RecognizableInstr.cpp
LLVM_REQUIRES_EH=
-LIBDEPS=llvmtablegen llvmsupport
+LIBDEPS=llvmtablegen \
+ llvmsupport
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/tblgen/tblgen.1 b/usr.bin/clang/tblgen/tblgen.1
index 732f25a..d6d127e 100644
--- a/usr.bin/clang/tblgen/tblgen.1
+++ b/usr.bin/clang/tblgen/tblgen.1
@@ -1,233 +1,230 @@
.\" $FreeBSD$
-.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
+.TH "TBLGEN" "1" "2012-08-16" "3.2" "LLVM"
+.SH NAME
+tblgen \- Target Description To C++ Code Generator
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.ie \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
..
-. nr % 0
-. rr F
-.\}
-.el \{\
-. de IX
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\}
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "TBLGEN 1"
-.TH TBLGEN 1 "2012-04-05" "LLVM 3.1" "LLVM Command Guide"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-tblgen \- Target Description To C++ Code Generator
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBtblgen\fR [\fIoptions\fR] [\fIfilename\fR]
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBtblgen\fR translates from target description (.td) files into \*(C+ code that can
-be included in the definition of an \s-1LLVM\s0 target library. Most users of \s-1LLVM\s0 will
-not need to use this program. It is only for assisting with writing an \s-1LLVM\s0
+.\" Man page generated from reStructuredText.
+.
+.SH SYNOPSIS
+.sp
+\fBtblgen\fP [\fIoptions\fP] [\fIfilename\fP]
+.SH DESCRIPTION
+.sp
+\fBtblgen\fP translates from target description (.td) files into C++ code that can
+be included in the definition of an LLVM target library. Most users of LLVM will
+not need to use this program. It is only for assisting with writing an LLVM
target backend.
-.PP
-The input and output of \fBtblgen\fR is beyond the scope of this short
-introduction. Please see the \fICodeGeneration\fR page in the \s-1LLVM\s0 documentation.
-.PP
-The \fIfilename\fR argument specifies the name of a Target Description (.td) file
+.sp
+The input and output of \fBtblgen\fP is beyond the scope of this short
+introduction. Please see the \fICodeGeneration\fP page in the LLVM documentation.
+.sp
+The \fIfilename\fP argument specifies the name of a Target Description (.td) file
to read as input.
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.IP "\fB\-help\fR" 4
-.IX Item "-help"
+.SH OPTIONS
+.sp
+\fB\-help\fP
+.INDENT 0.0
+.INDENT 3.5
Print a summary of command line options.
-.IP "\fB\-o\fR \fIfilename\fR" 4
-.IX Item "-o filename"
-Specify the output file name. If \fIfilename\fR is \f(CW\*(C`\-\*(C'\fR, then \fBtblgen\fR
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-o\fP \fIfilename\fP
+.INDENT 0.0
+.INDENT 3.5
+Specify the output file name. If \fIfilename\fP is \fB\-\fP, then \fBtblgen\fP
sends its output to standard output.
-.IP "\fB\-I\fR \fIdirectory\fR" 4
-.IX Item "-I directory"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-I\fP \fIdirectory\fP
+.INDENT 0.0
+.INDENT 3.5
Specify where to find other target description files for inclusion. The
-\&\fIdirectory\fR value should be a full or partial path to a directory that contains
+\fIdirectory\fP value should be a full or partial path to a directory that contains
target description files.
-.IP "\fB\-asmparsernum\fR \fIN\fR" 4
-.IX Item "-asmparsernum N"
-Make \-gen\-asm\-parser emit assembly writer number \fIN\fR.
-.IP "\fB\-asmwriternum\fR \fIN\fR" 4
-.IX Item "-asmwriternum N"
-Make \-gen\-asm\-writer emit assembly writer number \fIN\fR.
-.IP "\fB\-class\fR \fIclass Name\fR" 4
-.IX Item "-class class Name"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-asmparsernum\fP \fIN\fP
+.INDENT 0.0
+.INDENT 3.5
+Make \-gen\-asm\-parser emit assembly writer number \fIN\fP.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-asmwriternum\fP \fIN\fP
+.INDENT 0.0
+.INDENT 3.5
+Make \-gen\-asm\-writer emit assembly writer number \fIN\fP.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-class\fP \fIclass Name\fP
+.INDENT 0.0
+.INDENT 3.5
Print the enumeration list for this class.
-.IP "\fB\-print\-records\fR" 4
-.IX Item "-print-records"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-print\-records\fP
+.INDENT 0.0
+.INDENT 3.5
Print all records to standard output (default).
-.IP "\fB\-print\-enums\fR" 4
-.IX Item "-print-enums"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-print\-enums\fP
+.INDENT 0.0
+.INDENT 3.5
Print enumeration values for a class.
-.IP "\fB\-print\-sets\fR" 4
-.IX Item "-print-sets"
-Print expanded sets for testing \s-1DAG\s0 exprs.
-.IP "\fB\-gen\-emitter\fR" 4
-.IX Item "-gen-emitter"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-print\-sets\fP
+.INDENT 0.0
+.INDENT 3.5
+Print expanded sets for testing DAG exprs.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-emitter\fP
+.INDENT 0.0
+.INDENT 3.5
Generate machine code emitter.
-.IP "\fB\-gen\-register\-info\fR" 4
-.IX Item "-gen-register-info"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-register\-info\fP
+.INDENT 0.0
+.INDENT 3.5
Generate registers and register classes info.
-.IP "\fB\-gen\-instr\-info\fR" 4
-.IX Item "-gen-instr-info"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-instr\-info\fP
+.INDENT 0.0
+.INDENT 3.5
Generate instruction descriptions.
-.IP "\fB\-gen\-asm\-writer\fR" 4
-.IX Item "-gen-asm-writer"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-asm\-writer\fP
+.INDENT 0.0
+.INDENT 3.5
Generate the assembly writer.
-.IP "\fB\-gen\-disassembler\fR" 4
-.IX Item "-gen-disassembler"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-disassembler\fP
+.INDENT 0.0
+.INDENT 3.5
Generate disassembler.
-.IP "\fB\-gen\-pseudo\-lowering\fR" 4
-.IX Item "-gen-pseudo-lowering"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-pseudo\-lowering\fP
+.INDENT 0.0
+.INDENT 3.5
Generate pseudo instruction lowering.
-.IP "\fB\-gen\-dag\-isel\fR" 4
-.IX Item "-gen-dag-isel"
-Generate a \s-1DAG\s0 (Directed Acycle Graph) instruction selector.
-.IP "\fB\-gen\-asm\-matcher\fR" 4
-.IX Item "-gen-asm-matcher"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-dag\-isel\fP
+.INDENT 0.0
+.INDENT 3.5
+Generate a DAG (Directed Acycle Graph) instruction selector.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-asm\-matcher\fP
+.INDENT 0.0
+.INDENT 3.5
Generate assembly instruction matcher.
-.IP "\fB\-gen\-dfa\-packetizer\fR" 4
-.IX Item "-gen-dfa-packetizer"
-Generate \s-1DFA\s0 Packetizer for \s-1VLIW\s0 targets.
-.IP "\fB\-gen\-fast\-isel\fR" 4
-.IX Item "-gen-fast-isel"
-Generate a \*(L"fast\*(R" instruction selector.
-.IP "\fB\-gen\-subtarget\fR" 4
-.IX Item "-gen-subtarget"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-dfa\-packetizer\fP
+.INDENT 0.0
+.INDENT 3.5
+Generate DFA Packetizer for VLIW targets.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-fast\-isel\fP
+.INDENT 0.0
+.INDENT 3.5
+Generate a "fast" instruction selector.
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-subtarget\fP
+.INDENT 0.0
+.INDENT 3.5
Generate subtarget enumerations.
-.IP "\fB\-gen\-intrinsic\fR" 4
-.IX Item "-gen-intrinsic"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-intrinsic\fP
+.INDENT 0.0
+.INDENT 3.5
Generate intrinsic information.
-.IP "\fB\-gen\-tgt\-intrinsic\fR" 4
-.IX Item "-gen-tgt-intrinsic"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-tgt\-intrinsic\fP
+.INDENT 0.0
+.INDENT 3.5
Generate target intrinsic information.
-.IP "\fB\-gen\-enhanced\-disassembly\-info\fR" 4
-.IX Item "-gen-enhanced-disassembly-info"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-gen\-enhanced\-disassembly\-info\fP
+.INDENT 0.0
+.INDENT 3.5
Generate enhanced disassembly info.
-.IP "\fB\-version\fR" 4
-.IX Item "-version"
+.UNINDENT
+.UNINDENT
+.sp
+\fB\-version\fP
+.INDENT 0.0
+.INDENT 3.5
Show the version number of this program.
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-If \fBtblgen\fR succeeds, it will exit with 0. Otherwise, if an error
-occurs, it will exit with a non-zero value.
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Maintained by The \s-1LLVM\s0 Team (<http://llvm.org/>).
+.UNINDENT
+.UNINDENT
+.SH EXIT STATUS
+.sp
+If \fBtblgen\fP succeeds, it will exit with 0. Otherwise, if an error
+occurs, it will exit with a non\-zero value.
+.SH AUTHOR
+Maintained by The LLVM Team (http://llvm.org/).
+.SH COPYRIGHT
+2012, LLVM Project
+.\" Generated by docutils manpage writer.
+.
diff --git a/usr.bin/cpio/Makefile b/usr.bin/cpio/Makefile
index 13579c1..d1a3cca 100644
--- a/usr.bin/cpio/Makefile
+++ b/usr.bin/cpio/Makefile
@@ -6,13 +6,13 @@ LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive
PROG= bsdcpio
-BSDCPIO_VERSION_STRING= 3.0.3
+BSDCPIO_VERSION_STRING= 3.0.4
.PATH: ${LIBARCHIVEDIR}/cpio
SRCS= cpio.c cmdline.c
.PATH: ${LIBARCHIVEDIR}/libarchive_fe
-SRCS+= err.c line_reader.c matching.c pathmatch.c
+SRCS+= err.c line_reader.c
CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\"
CFLAGS+= -DPLATFORM_CONFIG_H=\"${LIBARCHIVECONFDIR}/config_freebsd.h\"
diff --git a/usr.bin/cpio/test/Makefile b/usr.bin/cpio/test/Makefile
index 1da6b1c..3a17f8e 100644
--- a/usr.bin/cpio/test/Makefile
+++ b/usr.bin/cpio/test/Makefile
@@ -6,7 +6,7 @@ LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive
CPIO_SRCS= cmdline.c
.PATH: ${LIBARCHIVEDIR}/libarchive_fe
-CPIO_SRCS+= err.c pathmatch.c
+CPIO_SRCS+= err.c
.PATH: ${LIBARCHIVEDIR}/cpio/test
TESTS= \
@@ -35,8 +35,7 @@ TESTS= \
test_option_z.c \
test_owner_parse.c \
test_passthrough_dotdot.c \
- test_passthrough_reverse.c \
- test_pathmatch.c
+ test_passthrough_reverse.c
# Build the test program
SRCS= list.h \
@@ -50,8 +49,8 @@ NO_MAN=yes
PROG=bsdcpio_test
DPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBLZMA}
-CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../config_freebsd.h\"
-CFLAGS+= -I${.CURDIR}/..
+CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../../../lib/libarchive/config_freebsd.h\"
+CFLAGS+= -I${.CURDIR}/../../../lib/libarchive -I${.OBJDIR}
LDADD= -larchive -lz -lbz2 -llzma
#CFLAGS+= -static -g -O2 -Wall
CFLAGS+= -g -O2 -Wall
@@ -74,6 +73,6 @@ clean:
rm -f ${CLEANFILES}
rm -f *~
-chmod -R +w /tmp/bsdcpio_test.*
- rm -rf /tmp/bsdcpio_test
+ rm -rf /tmp/bsdcpio_test.*
.include <bsd.prog.mk>
diff --git a/usr.bin/csup/lister.c b/usr.bin/csup/lister.c
index b10dbd3..104963a 100644
--- a/usr.bin/csup/lister.c
+++ b/usr.bin/csup/lister.c
@@ -530,7 +530,7 @@ lister_dorcsdead(struct lister *l, struct coll *coll, struct statusrec *sr)
return (0);
config = l->config;
wr = l->wr;
- if (!coll->co_options & CO_TRUSTSTATUSFILE) {
+ if (!(coll->co_options & CO_TRUSTSTATUSFILE)) {
path = cvspath(coll->co_prefix, sr->sr_file, 1);
if (path == NULL) {
spath = coll_statuspath(coll);
diff --git a/usr.bin/csup/proto.c b/usr.bin/csup/proto.c
index 145deb3..6df1aa0 100644
--- a/usr.bin/csup/proto.c
+++ b/usr.bin/csup/proto.c
@@ -727,8 +727,10 @@ proto_printf(struct stream *wr, const char *format, ...)
while ((cp = strchr(fmt, '%')) != NULL) {
if (cp > fmt) {
n = stream_write(wr, fmt, cp - fmt);
- if (n == -1)
+ if (n == -1) {
+ va_end(ap);
return (-1);
+ }
}
if (*++cp == '\0')
goto done;
@@ -789,18 +791,24 @@ proto_printf(struct stream *wr, const char *format, ...)
case '%':
n = stream_write(wr, "%", 1);
- if (n == -1)
+ if (n == -1) {
+ va_end(ap);
return (-1);
+ }
break;
}
- if (rv == -1)
+ if (rv == -1) {
+ va_end(ap);
return (-1);
+ }
fmt = cp + 1;
}
if (*fmt != '\0') {
rv = stream_printf(wr, "%s", fmt);
- if (rv == -1)
+ if (rv == -1) {
+ va_end(ap);
return (-1);
+ }
}
done:
va_end(ap);
diff --git a/usr.bin/ctlstat/ctlstat.c b/usr.bin/ctlstat/ctlstat.c
index 4d73401..1462ab9 100644
--- a/usr.bin/ctlstat/ctlstat.c
+++ b/usr.bin/ctlstat/ctlstat.c
@@ -329,7 +329,7 @@ compute_stats(struct ctl_lun_io_stats *cur_stats,
#define PRINT_BINTIME(prefix, bt) \
printf("%s %jd s %ju frac\n", prefix, (intmax_t)(bt).sec, \
(uintmax_t)(bt).frac)
-const char *iotypes[] = {"NO IO", "READ", "WRITE"};
+static const char *iotypes[] = {"NO IO", "READ", "WRITE"};
static void
ctlstat_dump(struct ctlstat_context *ctx) {
diff --git a/usr.bin/cut/cut.1 b/usr.bin/cut/cut.1
index 3ea9362..d4e6876 100644
--- a/usr.bin/cut/cut.1
+++ b/usr.bin/cut/cut.1
@@ -68,7 +68,7 @@ The items specified by
.Ar list
can be in terms of column position or in terms of fields delimited
by a special character.
-Column numbering starts from 1.
+Column and field numbering start from 1.
.Pp
The
.Ar list
@@ -78,14 +78,14 @@ number ranges.
Number ranges consist of a number, a dash
.Pq Sq \- ,
and a second number
-and select the fields or columns from the first number to the second,
+and select the columns or fields from the first number to the second,
inclusive.
Numbers or number ranges may be preceded by a dash, which selects all
-fields or columns from 1 to the last number.
+columns or fields from 1 to the last number.
Numbers or number ranges may be followed by a dash, which selects all
-fields or columns from the last number to the end of the line.
+columns or fields from the last number to the end of the line.
Numbers and number ranges may be repeated, overlapping, and in any order.
-It is not an error to select fields or columns not present in the
+It is not an error to select columns or fields not present in the
input line.
.Pp
The options are as follows:
diff --git a/usr.bin/cut/cut.c b/usr.bin/cut/cut.c
index d32d4ab..0a3a2a9 100644
--- a/usr.bin/cut/cut.c
+++ b/usr.bin/cut/cut.c
@@ -164,7 +164,7 @@ get_list(char *list)
* set a byte in the positions array to indicate if a field or
* column is to be selected; use +1, it's 1-based, not 0-based.
* Numbers and number ranges may be overlapping, repeated, and in
- * any order. We handle "-3-5" although there's no real reason too.
+ * any order. We handle "-3-5" although there's no real reason to.
*/
for (; (p = strsep(&list, ", \t")) != NULL;) {
setautostart = start = stop = 0;
@@ -187,9 +187,9 @@ get_list(char *list)
}
}
if (*p)
- errx(1, "[-cf] list: illegal list value");
+ errx(1, "[-bcf] list: illegal list value");
if (!stop || !start)
- errx(1, "[-cf] list: values may not include zero");
+ errx(1, "[-bcf] list: values may not include zero");
if (maxval < stop) {
maxval = stop;
needpos(maxval + 1);
diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1
index 3db1367..d946f47 100644
--- a/usr.bin/du/du.1
+++ b/usr.bin/du/du.1
@@ -28,7 +28,7 @@
.\" @(#)du.1 8.2 (Berkeley) 4/1/94
.\" $FreeBSD$
.\"
-.Dd December 17, 2011
+.Dd July 18, 2012
.Dt DU 1
.Os
.Sh NAME
@@ -38,7 +38,7 @@
.Nm
.Op Fl Aclnx
.Op Fl H | L | P
-.Op Fl h | k | m
+.Op Fl g | h | k | m
.Op Fl a | s | d Ar depth
.Op Fl B Ar blocksize
.Op Fl I Ar mask
@@ -63,9 +63,9 @@ Calculate block counts in
.Ar blocksize
byte blocks.
This is different from the
-.Fl h, k
+.Fl h, k, m
and
-.Fl m
+.Fl g
options or setting
.Ev BLOCKSIZE
and gives an estimate of how much space the examined file hierarchy would
@@ -95,13 +95,15 @@ Display a grand total.
Display an entry for all files and directories
.Ar depth
directories deep.
+.It Fl g
+Display block counts in 1073741824-byte (1 GiB) blocks.
.It Fl h
.Dq Human-readable
output.
Use unit suffixes: Byte, Kilobyte, Megabyte,
Gigabyte, Terabyte and Petabyte.
.It Fl k
-Display block counts in 1024-byte (1-Kbyte) blocks.
+Display block counts in 1024-byte (1 kiB) blocks.
.It Fl l
If a file has multiple hard links, count its size multiple times.
The default behavior of
@@ -112,7 +114,7 @@ When the
option is specified, the hard link checks are disabled, and these files
are counted (and displayed) as many times as they are found.
.It Fl m
-Display block counts in 1048576-byte (1-Mbyte) blocks.
+Display block counts in 1048576-byte (1 MiB) blocks.
.It Fl n
Ignore files and directories with user
.Dq nodump
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 7b47b71..6194a12 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -109,7 +109,7 @@ main(int argc, char *argv[])
depth = INT_MAX;
SLIST_INIT(&ignores);
- while ((ch = getopt(argc, argv, "AB:HI:LPasd:chklmnrt:x")) != -1)
+ while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1)
switch (ch) {
case 'A':
Aflag = 1;
@@ -156,6 +156,10 @@ main(int argc, char *argv[])
case 'c':
cflag = 1;
break;
+ case 'g':
+ hflag = 0;
+ blocksize = 1073741824;
+ break;
case 'h':
hflag = 1;
break;
@@ -489,7 +493,7 @@ static void
usage(void)
{
(void)fprintf(stderr,
- "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] "
+ "usage: du [-Aclnx] [-H | -L | -P] [-g | -h | -k | -m] "
"[-a | -s | -d depth] [-B blocksize] [-I mask] "
"[-t threshold] [file ...]\n");
exit(EX_USAGE);
diff --git a/usr.bin/elfdump/elfdump.c b/usr.bin/elfdump/elfdump.c
index 99ae8bf..f966f84 100644
--- a/usr.bin/elfdump/elfdump.c
+++ b/usr.bin/elfdump/elfdump.c
@@ -83,7 +83,7 @@ enum elf_member {
typedef enum elf_member elf_member_t;
-int elf32_offsets[] = {
+static int elf32_offsets[] = {
0,
offsetof(Elf32_Dyn, d_tag), offsetof(Elf32_Dyn, d_un.d_ptr),
@@ -124,7 +124,7 @@ int elf32_offsets[] = {
offsetof(Elf32_Rela, r_addend)
};
-int elf64_offsets[] = {
+static int elf64_offsets[] = {
0,
offsetof(Elf64_Dyn, d_tag), offsetof(Elf64_Dyn, d_un.d_ptr),
@@ -266,23 +266,23 @@ e_machines(u_int mach)
return (machdesc);
}
-const char *e_types[] = {
+static const char *e_types[] = {
"ET_NONE", "ET_REL", "ET_EXEC", "ET_DYN", "ET_CORE"
};
-const char *ei_versions[] = {
+static const char *ei_versions[] = {
"EV_NONE", "EV_CURRENT"
};
-const char *ei_classes[] = {
+static const char *ei_classes[] = {
"ELFCLASSNONE", "ELFCLASS32", "ELFCLASS64"
};
-const char *ei_data[] = {
+static const char *ei_data[] = {
"ELFDATANONE", "ELFDATA2LSB", "ELFDATA2MSB"
};
-const char *ei_abis[256] = {
+static const char *ei_abis[256] = {
"ELFOSABI_SYSV", "ELFOSABI_HPUX", "ELFOSABI_NETBSD", "ELFOSABI_LINUX",
"ELFOSABI_HURD", "ELFOSABI_86OPEN", "ELFOSABI_SOLARIS", "ELFOSABI_AIX",
"ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64",
@@ -290,12 +290,12 @@ const char *ei_abis[256] = {
[255] = "ELFOSABI_STANDALONE"
};
-const char *p_types[] = {
+static const char *p_types[] = {
"PT_NULL", "PT_LOAD", "PT_DYNAMIC", "PT_INTERP", "PT_NOTE",
"PT_SHLIB", "PT_PHDR", "PT_TLS"
};
-const char *p_flags[] = {
+static const char *p_flags[] = {
"", "PF_X", "PF_W", "PF_X|PF_W", "PF_R", "PF_X|PF_R", "PF_W|PF_R",
"PF_X|PF_W|PF_R"
};
@@ -339,44 +339,47 @@ sh_types(u_int64_t sht) {
}
}
-const char *sh_flags[] = {
+static const char *sh_flags[] = {
"", "SHF_WRITE", "SHF_ALLOC", "SHF_WRITE|SHF_ALLOC", "SHF_EXECINSTR",
"SHF_WRITE|SHF_EXECINSTR", "SHF_ALLOC|SHF_EXECINSTR",
"SHF_WRITE|SHF_ALLOC|SHF_EXECINSTR"
};
-const char *st_types[] = {
+static const char *st_types[] = {
"STT_NOTYPE", "STT_OBJECT", "STT_FUNC", "STT_SECTION", "STT_FILE"
};
-const char *st_bindings[] = {
+static const char *st_bindings[] = {
"STB_LOCAL", "STB_GLOBAL", "STB_WEAK"
};
-char *dynstr;
-char *shstrtab;
-char *strtab;
-FILE *out;
-
-u_int64_t elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member);
-u_int64_t elf_get_quarter(Elf32_Ehdr *e, void *base, elf_member_t member);
-u_int64_t elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member);
-u_int64_t elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member);
-u_int64_t elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member);
-
-void elf_print_ehdr(Elf32_Ehdr *e);
-void elf_print_phdr(Elf32_Ehdr *e, void *p);
-void elf_print_shdr(Elf32_Ehdr *e, void *sh);
-void elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str);
-void elf_print_dynamic(Elf32_Ehdr *e, void *sh);
-void elf_print_rel(Elf32_Ehdr *e, void *r);
-void elf_print_rela(Elf32_Ehdr *e, void *ra);
-void elf_print_interp(Elf32_Ehdr *e, void *p);
-void elf_print_got(Elf32_Ehdr *e, void *sh);
-void elf_print_hash(Elf32_Ehdr *e, void *sh);
-void elf_print_note(Elf32_Ehdr *e, void *sh);
-
-void usage(void);
+static char *dynstr;
+static char *shstrtab;
+static char *strtab;
+static FILE *out;
+
+static u_int64_t elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member);
+static u_int64_t elf_get_quarter(Elf32_Ehdr *e, void *base,
+ elf_member_t member);
+#if 0
+static u_int64_t elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member);
+#endif
+static u_int64_t elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member);
+static u_int64_t elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member);
+
+static void elf_print_ehdr(Elf32_Ehdr *e);
+static void elf_print_phdr(Elf32_Ehdr *e, void *p);
+static void elf_print_shdr(Elf32_Ehdr *e, void *sh);
+static void elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str);
+static void elf_print_dynamic(Elf32_Ehdr *e, void *sh);
+static void elf_print_rel(Elf32_Ehdr *e, void *r);
+static void elf_print_rela(Elf32_Ehdr *e, void *ra);
+static void elf_print_interp(Elf32_Ehdr *e, void *p);
+static void elf_print_got(Elf32_Ehdr *e, void *sh);
+static void elf_print_hash(Elf32_Ehdr *e, void *sh);
+static void elf_print_note(Elf32_Ehdr *e, void *sh);
+
+static void usage(void);
int
main(int ac, char **av)
@@ -551,7 +554,7 @@ main(int ac, char **av)
return 0;
}
-void
+static void
elf_print_ehdr(Elf32_Ehdr *e)
{
u_int64_t class;
@@ -606,7 +609,7 @@ elf_print_ehdr(Elf32_Ehdr *e)
fprintf(out, "\te_shstrndx: %jd\n", (intmax_t)shstrndx);
}
-void
+static void
elf_print_phdr(Elf32_Ehdr *e, void *p)
{
u_int64_t phentsize;
@@ -648,7 +651,7 @@ elf_print_phdr(Elf32_Ehdr *e, void *p)
}
}
-void
+static void
elf_print_shdr(Elf32_Ehdr *e, void *sh)
{
u_int64_t shentsize;
@@ -696,7 +699,7 @@ elf_print_shdr(Elf32_Ehdr *e, void *sh)
}
}
-void
+static void
elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str)
{
u_int64_t offset;
@@ -735,7 +738,7 @@ elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str)
}
}
-void
+static void
elf_print_dynamic(Elf32_Ehdr *e, void *sh)
{
u_int64_t offset;
@@ -795,7 +798,7 @@ elf_print_dynamic(Elf32_Ehdr *e, void *sh)
}
}
-void
+static void
elf_print_rela(Elf32_Ehdr *e, void *sh)
{
u_int64_t offset;
@@ -827,7 +830,7 @@ elf_print_rela(Elf32_Ehdr *e, void *sh)
}
}
-void
+static void
elf_print_rel(Elf32_Ehdr *e, void *sh)
{
u_int64_t offset;
@@ -856,7 +859,7 @@ elf_print_rel(Elf32_Ehdr *e, void *sh)
}
}
-void
+static void
elf_print_interp(Elf32_Ehdr *e, void *p)
{
u_int64_t offset;
@@ -868,7 +871,7 @@ elf_print_interp(Elf32_Ehdr *e, void *p)
fprintf(out, "\t%s\n", s);
}
-void
+static void
elf_print_got(Elf32_Ehdr *e, void *sh)
{
u_int64_t offset;
@@ -891,12 +894,12 @@ elf_print_got(Elf32_Ehdr *e, void *sh)
}
}
-void
+static void
elf_print_hash(Elf32_Ehdr *e __unused, void *sh __unused)
{
}
-void
+static void
elf_print_note(Elf32_Ehdr *e, void *sh)
{
u_int64_t offset;
@@ -922,7 +925,7 @@ elf_print_note(Elf32_Ehdr *e, void *sh)
}
}
-u_int64_t
+static u_int64_t
elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member)
{
u_int64_t val;
@@ -942,7 +945,7 @@ elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member)
return val;
}
-u_int64_t
+static u_int64_t
elf_get_quarter(Elf32_Ehdr *e, void *base, elf_member_t member)
{
u_int64_t val;
@@ -982,7 +985,8 @@ elf_get_quarter(Elf32_Ehdr *e, void *base, elf_member_t member)
return val;
}
-u_int64_t
+#if 0
+static u_int64_t
elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member)
{
u_int64_t val;
@@ -1021,8 +1025,9 @@ elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member)
return val;
}
+#endif
-u_int64_t
+static u_int64_t
elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member)
{
u_int64_t val;
@@ -1062,7 +1067,7 @@ elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member)
return val;
}
-u_int64_t
+static u_int64_t
elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member)
{
u_int64_t val;
@@ -1102,7 +1107,7 @@ elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member)
return val;
}
-void
+static void
usage(void)
{
fprintf(stderr, "usage: elfdump -a | -cdeGhinprs [-w file] file\n");
diff --git a/usr.bin/fetch/Makefile b/usr.bin/fetch/Makefile
index 6f0db80..687f3ea 100644
--- a/usr.bin/fetch/Makefile
+++ b/usr.bin/fetch/Makefile
@@ -4,11 +4,12 @@
PROG= fetch
CSTD?= c99
+.if ${MK_OPENSSL} != "no"
+DPADD= ${LIBFETCH} ${LIBSSL} ${LIBCRYPTO}
+LDADD= -lfetch -lssl -lcrypto
+.else
DPADD= ${LIBFETCH} ${LIBMD}
LDADD= -lfetch -lmd
-.if ${MK_OPENSSL} != "no"
-DPADD+= ${LIBSSL} ${LIBCRYPTO}
-LDADD+= -lssl -lcrypto
.endif
.include <bsd.prog.mk>
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index e8b7318..3e897d7 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -51,47 +51,47 @@ __FBSDID("$FreeBSD$");
#define TIMEOUT 120
/* Option flags */
-int A_flag; /* -A: do not follow 302 redirects */
-int a_flag; /* -a: auto retry */
-off_t B_size; /* -B: buffer size */
-int b_flag; /*! -b: workaround TCP bug */
-char *c_dirname; /* -c: remote directory */
-int d_flag; /* -d: direct connection */
-int F_flag; /* -F: restart without checking mtime */
-char *f_filename; /* -f: file to fetch */
-char *h_hostname; /* -h: host to fetch from */
-int i_flag; /* -i: specify input file for mtime comparison */
-char *i_filename; /* name of input file */
-int l_flag; /* -l: link rather than copy file: URLs */
-int m_flag; /* -[Mm]: mirror mode */
-char *N_filename; /* -N: netrc file name */
-int n_flag; /* -n: do not preserve modification time */
-int o_flag; /* -o: specify output file */
-int o_directory; /* output file is a directory */
-char *o_filename; /* name of output file */
-int o_stdout; /* output file is stdout */
-int once_flag; /* -1: stop at first successful file */
-int p_flag; /* -[Pp]: use passive FTP */
-int R_flag; /* -R: don't delete partially transferred files */
-int r_flag; /* -r: restart previously interrupted transfer */
-off_t S_size; /* -S: require size to match */
-int s_flag; /* -s: show size, don't fetch */
-long T_secs; /* -T: transfer timeout in seconds */
-int t_flag; /*! -t: workaround TCP bug */
-int U_flag; /* -U: do not use high ports */
-int v_level = 1; /* -v: verbosity level */
-int v_tty; /* stdout is a tty */
-pid_t pgrp; /* our process group */
-long w_secs; /* -w: retry delay */
-int family = PF_UNSPEC; /* -[46]: address family to use */
-
-int sigalrm; /* SIGALRM received */
-int siginfo; /* SIGINFO received */
-int sigint; /* SIGINT received */
-
-long ftp_timeout = TIMEOUT; /* default timeout for FTP transfers */
-long http_timeout = TIMEOUT; /* default timeout for HTTP transfers */
-char *buf; /* transfer buffer */
+static int A_flag; /* -A: do not follow 302 redirects */
+static int a_flag; /* -a: auto retry */
+static off_t B_size; /* -B: buffer size */
+static int b_flag; /*! -b: workaround TCP bug */
+static char *c_dirname; /* -c: remote directory */
+static int d_flag; /* -d: direct connection */
+static int F_flag; /* -F: restart without checking mtime */
+static char *f_filename; /* -f: file to fetch */
+static char *h_hostname; /* -h: host to fetch from */
+static int i_flag; /* -i: specify file for mtime comparison */
+static char *i_filename; /* name of input file */
+static int l_flag; /* -l: link rather than copy file: URLs */
+static int m_flag; /* -[Mm]: mirror mode */
+static char *N_filename; /* -N: netrc file name */
+static int n_flag; /* -n: do not preserve modification time */
+static int o_flag; /* -o: specify output file */
+static int o_directory; /* output file is a directory */
+static char *o_filename; /* name of output file */
+static int o_stdout; /* output file is stdout */
+static int once_flag; /* -1: stop at first successful file */
+static int p_flag; /* -[Pp]: use passive FTP */
+static int R_flag; /* -R: don't delete partial files */
+static int r_flag; /* -r: restart previous transfer */
+static off_t S_size; /* -S: require size to match */
+static int s_flag; /* -s: show size, don't fetch */
+static long T_secs; /* -T: transfer timeout in seconds */
+static int t_flag; /*! -t: workaround TCP bug */
+static int U_flag; /* -U: do not use high ports */
+static int v_level = 1; /* -v: verbosity level */
+static int v_tty; /* stdout is a tty */
+static pid_t pgrp; /* our process group */
+static long w_secs; /* -w: retry delay */
+static int family = PF_UNSPEC; /* -[46]: address family to use */
+
+static int sigalrm; /* SIGALRM received */
+static int siginfo; /* SIGINFO received */
+static int sigint; /* SIGINT received */
+
+static long ftp_timeout = TIMEOUT; /* default timeout for FTP transfers */
+static long http_timeout = TIMEOUT;/* default timeout for HTTP transfers */
+static char *buf; /* transfer buffer */
/*
diff --git a/usr.bin/find/extern.h b/usr.bin/find/extern.h
index c1a2819..6fa25d2 100644
--- a/usr.bin/find/extern.h
+++ b/usr.bin/find/extern.h
@@ -58,6 +58,7 @@ creat_f c_flags;
creat_f c_follow;
creat_f c_fstype;
creat_f c_group;
+creat_f c_ignore_readdir_race;
creat_f c_inum;
creat_f c_links;
creat_f c_ls;
@@ -111,7 +112,8 @@ exec_f f_size;
exec_f f_type;
exec_f f_user;
-extern int ftsoptions, isdeprecated, isdepth, isoutput, issort, isxargs;
+extern int ftsoptions, ignore_readdir_race, isdeprecated, isdepth, isoutput;
+extern int issort, isxargs;
extern int mindepth, maxdepth;
extern int regexp_flags;
extern time_t now;
diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1
index 2209e4f..cf10bf2 100644
--- a/usr.bin/find/find.1
+++ b/usr.bin/find/find.1
@@ -31,7 +31,7 @@
.\" @(#)find.1 8.7 (Berkeley) 5/9/95
.\" $FreeBSD$
.\"
-.Dd September 28, 2011
+.Dd September 9, 2012
.Dt FIND 1
.Os
.Sh NAME
@@ -126,36 +126,15 @@ as an effective alternative.
.It Fl d
Cause
.Nm
-to perform a depth-first traversal, i.e., directories
-are visited in post-order and all entries in a directory will be acted
-on before the directory itself.
-By default,
-.Nm
-visits directories in pre-order, i.e., before their contents.
-Note, the default is
-.Em not
-a breadth-first traversal.
+to perform a depth-first traversal.
.Pp
-This option is equivalent to the
+This option is a BSD-specific equivalent of the
.Ic -depth
-primary of
+primary specified by
.St -p1003.1-2001 .
-The
-.Fl d
-option
-can be useful when
-.Nm
-is used with
-.Xr cpio 1
-to process files that are contained in directories with unusual permissions.
-It ensures that you have write permission while you are placing files in a
-directory, then sets the directory's permissions as the last thing.
-.It Fl f
-Specify a file hierarchy for
-.Nm
-to traverse.
-File hierarchies may also be specified as the operands immediately
-following the options.
+Refer to its description under
+.Sx PRIMARIES
+for more information.
.It Fl s
Cause
.Nm
@@ -301,7 +280,7 @@ Please refer to the
.Ic -atime
primary description for information on supported time units.
.It Ic -d
-Same as
+Non-portable, BSD-specific version of
.Ic depth .
GNU find implements this as a primary in mistaken emulation of
.Fx
@@ -319,12 +298,37 @@ character in its pathname relative to
.Dq Pa \&.
for security reasons.
Depth-first traversal processing is implied by this option.
+The
+.Ic -delete
+primary will fail to delete a directory if it is not empty.
Following symlinks is incompatible with this option.
.It Ic -depth
Always true;
-same as the
+same as the non-portable
.Fl d
option.
+Cause
+.Nm
+to perform a depth-first traversal, i.e., directories
+are visited in post-order and all entries in a directory will be acted
+on before the directory itself.
+By default,
+.Nm
+visits directories in pre-order, i.e., before their contents.
+Note, the default is
+.Em not
+a breadth-first traversal.
+.Pp
+The
+.Ic -depth
+primary
+can be useful when
+.Nm
+is used with
+.Xr cpio 1
+to process files that are contained in directories with unusual permissions.
+It ensures that you have write permission while you are placing files in a
+directory, then sets the directory's permissions as the last thing.
.It Ic -depth Ar n
True if the depth of the file relative to the starting point of the traversal
is
@@ -466,7 +470,9 @@ is numeric and there is no such group name, then
.Ar gname
is treated as a group ID.
.It Ic -ignore_readdir_race
-This option is for GNU find compatibility and is ignored.
+Ignore errors because a file or a directory is deleted
+after reading the name from a directory.
+This option does not affect errors occurring on starting points.
.It Ic -ilname Ar pattern
Like
.Ic -lname ,
@@ -614,7 +620,9 @@ is equivalent to
.It Ic -nogroup
True if the file belongs to an unknown group.
.It Ic -noignore_readdir_race
-This option is for GNU find compatibility and is ignored.
+Turn off the effect of
+.Ic -ignore_readdir_race .
+This is default behaviour.
.It Ic -noleaf
This option is for GNU find compatibility.
In GNU find it disables an optimization not relevant to
@@ -733,6 +741,10 @@ Note, the
primary has no effect if the
.Fl d
option was specified.
+.It Ic -quit
+Causes
+.Nm
+to immediately terminate successfully.
.It Ic -regex Ar pattern
True if the whole path of the file matches
.Ar pattern
diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c
index 3e0921e..8ad76c1 100644
--- a/usr.bin/find/find.c
+++ b/usr.bin/find/find.c
@@ -197,8 +197,12 @@ find_execute(PLAN *plan, char *paths[])
continue;
break;
case FTS_DNR:
- case FTS_ERR:
case FTS_NS:
+ if (ignore_readdir_race &&
+ entry->fts_errno == ENOENT && entry->fts_level > 0)
+ continue;
+ /* FALLTHROUGH */
+ case FTS_ERR:
(void)fflush(stdout);
warnx("%s: %s",
entry->fts_path, strerror(entry->fts_errno));
@@ -228,7 +232,7 @@ find_execute(PLAN *plan, char *paths[])
for (p = plan; p && (p->execute)(p, entry); p = p->next);
}
finish_execplus();
- if (errno)
+ if (errno && (!ignore_readdir_race || errno != ENOENT))
err(1, "fts_read");
return (rval);
}
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index eabb054..5f8f813 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -975,6 +975,25 @@ c_group(OPTION *option, char ***argvp)
}
/*
+ * -ignore_readdir_race functions --
+ *
+ * Always true. Ignore errors which occur if a file or a directory
+ * in a starting point gets deleted between reading the name and calling
+ * stat on it while find is traversing the starting point.
+ */
+
+PLAN *
+c_ignore_readdir_race(OPTION *option, char ***argvp __unused)
+{
+ if (strcmp(option->name, "-ignore_readdir_race") == 0)
+ ignore_readdir_race = 1;
+ else
+ ignore_readdir_race = 0;
+
+ return palloc(option);
+}
+
+/*
* -inum n functions --
*
* True if the file has inode # n.
diff --git a/usr.bin/find/ls.c b/usr.bin/find/ls.c
index 44d1852..082fd64 100644
--- a/usr.bin/find/ls.c
+++ b/usr.bin/find/ls.c
@@ -63,7 +63,7 @@ printlong(char *name, char *accpath, struct stat *sb)
{
char modep[15];
- (void)printf("%6lu %8"PRId64" ", (u_long) sb->st_ino, sb->st_blocks);
+ (void)printf("%6ju %8"PRId64" ", (uintmax_t)sb->st_ino, sb->st_blocks);
(void)strmode(sb->st_mode, modep);
(void)printf("%s %3u %-*s %-*s ", modep, sb->st_nlink, MAXLOGNAME - 1,
user_from_uid(sb->st_uid, 0), MAXLOGNAME - 1,
diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c
index 4f7064b..6284413 100644
--- a/usr.bin/find/main.c
+++ b/usr.bin/find/main.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
time_t now; /* time find was run */
int dotfd; /* starting directory */
int ftsoptions; /* options for the ftsopen(3) call */
+int ignore_readdir_race; /* ignore readdir race */
int isdeprecated; /* using deprecated syntax */
int isdepth; /* do directories on post-order visit */
int isoutput; /* user specified output operator */
@@ -150,7 +151,7 @@ main(int argc, char *argv[])
usage();
*p = NULL;
- if ((dotfd = open(".", O_RDONLY, 0)) < 0)
+ if ((dotfd = open(".", O_RDONLY | O_CLOEXEC, 0)) < 0)
err(1, ".");
exit(find_execute(find_formplan(argv), start));
diff --git a/usr.bin/find/option.c b/usr.bin/find/option.c
index f8745b2..b89420c 100644
--- a/usr.bin/find/option.c
+++ b/usr.bin/find/option.c
@@ -88,7 +88,7 @@ static OPTION const options[] = {
{ "-fstype", c_fstype, f_fstype, 0 },
{ "-gid", c_group, f_group, 0 },
{ "-group", c_group, f_group, 0 },
- { "-ignore_readdir_race",c_simple, f_always_true,0 },
+ { "-ignore_readdir_race",c_ignore_readdir_race, f_always_true,0 },
{ "-ilname", c_name, f_name, F_LINK | F_IGNCASE },
{ "-iname", c_name, f_name, F_IGNCASE },
{ "-inum", c_inum, f_inum, 0 },
@@ -127,7 +127,7 @@ static OPTION const options[] = {
{ "-newermm", c_newer, f_newer, 0 },
{ "-newermt", c_newer, f_newer, F_TIME2_T },
{ "-nogroup", c_nogroup, f_nogroup, 0 },
- { "-noignore_readdir_race",c_simple, f_always_true,0 },
+ { "-noignore_readdir_race",c_ignore_readdir_race, f_always_true,0 },
{ "-noleaf", c_simple, f_always_true, 0 },
{ "-not", c_simple, f_not, 0 },
{ "-nouser", c_nouser, f_nouser, 0 },
diff --git a/usr.bin/finger/finger.1 b/usr.bin/finger/finger.1
index c38aaa8..b430ab4 100644
--- a/usr.bin/finger/finger.1
+++ b/usr.bin/finger/finger.1
@@ -28,7 +28,7 @@
.\" @(#)finger.1 8.3 (Berkeley) 5/5/94
.\" $FreeBSD$
.\"
-.Dd April 11, 2007
+.Dd January 21, 2010
.Dt FINGER 1
.Os
.Sh NAME
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index 7519f15..0a4e952 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -87,7 +87,8 @@ __FBSDID("$FreeBSD$");
DB *db;
time_t now;
-int entries, gflag, kflag, lflag, mflag, pplan, sflag, oflag;
+static int kflag, mflag, sflag;
+int entries, gflag, lflag, pplan, oflag;
sa_family_t family = PF_UNSPEC;
int d_first = -1;
char tbuf[1024];
diff --git a/usr.bin/gencat/gencat.c b/usr.bin/gencat/gencat.c
index 40d68fc..031c27a 100644
--- a/usr.bin/gencat/gencat.c
+++ b/usr.bin/gencat/gencat.c
@@ -96,7 +96,7 @@ struct _setT {
LIST_ENTRY(_setT) entries;
};
-LIST_HEAD(sethead, _setT) sethead;
+static LIST_HEAD(sethead, _setT) sethead;
static struct _setT *curSet;
static char *curline = NULL;
diff --git a/usr.bin/getent/getent.c b/usr.bin/getent/getent.c
index 85857d8..7424577 100644
--- a/usr.bin/getent/getent.c
+++ b/usr.bin/getent/getent.c
@@ -277,7 +277,7 @@ hostsprint(const struct hostent *he)
static int
hosts(int argc, char *argv[])
{
- struct hostent *he;
+ struct hostent *he4, *he6;
char addr[IN6ADDRSZ];
int i, rv;
@@ -285,21 +285,31 @@ hosts(int argc, char *argv[])
assert(argv != NULL);
sethostent(1);
+ he4 = he6 = NULL;
rv = RV_OK;
if (argc == 2) {
- while ((he = gethostent()) != NULL)
- hostsprint(he);
+ while ((he4 = gethostent()) != NULL)
+ hostsprint(he4);
} else {
for (i = 2; i < argc; i++) {
- if (inet_pton(AF_INET6, argv[i], (void *)addr) > 0)
- he = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6);
- else if (inet_pton(AF_INET, argv[i], (void *)addr) > 0)
- he = gethostbyaddr(addr, INADDRSZ, AF_INET);
- else
- he = gethostbyname(argv[i]);
- if (he != NULL)
- hostsprint(he);
- else {
+ if (inet_pton(AF_INET6, argv[i], (void *)addr) > 0) {
+ he6 = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6);
+ if (he6 != NULL)
+ hostsprint(he6);
+ } else if (inet_pton(AF_INET, argv[i],
+ (void *)addr) > 0) {
+ he4 = gethostbyaddr(addr, INADDRSZ, AF_INET);
+ if (he4 != NULL)
+ hostsprint(he4);
+ } else {
+ he6 = gethostbyname2(argv[i], AF_INET6);
+ if (he6 != NULL)
+ hostsprint(he6);
+ he4 = gethostbyname(argv[i]);
+ if (he4 != NULL)
+ hostsprint(he4);
+ }
+ if ( he4 == NULL && he6 == NULL ) {
rv = RV_NOTFOUND;
break;
}
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 8133f44..43d9334 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -82,14 +82,15 @@ int eflags = REG_STARTEND;
bool matchall;
/* Searching patterns */
-unsigned int patterns, pattern_sz;
+unsigned int patterns;
+static unsigned int pattern_sz;
struct pat *pattern;
regex_t *r_pattern;
fastmatch_t *fg_pattern;
/* Filename exclusion/inclusion patterns */
-unsigned int fpatterns, fpattern_sz;
-unsigned int dpatterns, dpattern_sz;
+unsigned int fpatterns, dpatterns;
+static unsigned int fpattern_sz, dpattern_sz;
struct epat *dpattern, *fpattern;
/* For regex errors */
diff --git a/usr.bin/grep/regex/xmalloc.c b/usr.bin/grep/regex/xmalloc.c
index b1acc9c..0fc5cd2 100644
--- a/usr.bin/grep/regex/xmalloc.c
+++ b/usr.bin/grep/regex/xmalloc.c
@@ -39,9 +39,9 @@ typedef struct {
} hashTable;
static int xmalloc_peak;
-int xmalloc_current;
+static int xmalloc_current;
static int xmalloc_peak_blocks;
-int xmalloc_current_blocks;
+static int xmalloc_current_blocks;
static int xmalloc_fail_after;
#define TABLE_BITS 8
diff --git a/usr.bin/gzip/zmore.1 b/usr.bin/gzip/zmore.1
index 1235d40..b1f389c 100644
--- a/usr.bin/gzip/zmore.1
+++ b/usr.bin/gzip/zmore.1
@@ -20,7 +20,7 @@
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
.\" $FreeBSD$
-.Dd February 06, 2011
+.Dd February 6, 2011
.Dt ZMORE 1
.Os
.Sh NAME
diff --git a/usr.bin/gzip/zuncompress.c b/usr.bin/gzip/zuncompress.c
index f7f50af..f1b05fd 100644
--- a/usr.bin/gzip/zuncompress.c
+++ b/usr.bin/gzip/zuncompress.c
@@ -77,10 +77,9 @@ static char_type magic_header[] =
static char_type rmask[9] =
{0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
-/* XXX zuncompress global */
-off_t total_compressed_bytes;
-size_t compressed_prelen;
-char *compressed_pre;
+static off_t total_compressed_bytes;
+static size_t compressed_prelen;
+static char *compressed_pre;
struct s_zstate {
FILE *zs_fp; /* File stream for I/O */
diff --git a/usr.bin/kdump/kdump.1 b/usr.bin/kdump/kdump.1
index 0b4bcf4..f8e87e4 100644
--- a/usr.bin/kdump/kdump.1
+++ b/usr.bin/kdump/kdump.1
@@ -28,7 +28,7 @@
.\" @(#)kdump.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd April 20, 2012
+.Dd June 4, 2012
.Dt KDUMP 1
.Os
.Sh NAME
@@ -86,9 +86,9 @@ string.
Suppressing this feature yields a more consistent output format and is
easily amenable to further processing.
.It Fl p Ar pid
-Display only trace events that correspond to the process
+Display only trace events that correspond to the process or thread
.Ar pid .
-This may be useful when there are multiple processes recorded in the
+This may be useful when there are multiple processes or threads recorded in the
same trace file.
.It Fl R
Display relative timestamps (time since previous entry).
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 57f5ce2..bd3ceab 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -251,7 +251,8 @@ main(int argc, char *argv[])
}
}
if (trpoints & (1<<ktr_header.ktr_type))
- if (pid == 0 || ktr_header.ktr_pid == pid)
+ if (pid == 0 || ktr_header.ktr_pid == pid ||
+ ktr_header.ktr_tid == pid)
dumpheader(&ktr_header);
if ((ktrlen = ktr_header.ktr_len) < 0)
errx(1, "bogus length 0x%x", ktrlen);
@@ -266,7 +267,8 @@ main(int argc, char *argv[])
if (fetchprocinfo(&ktr_header, (u_int *)m) != 0)
continue;
sv_flags = abidump(&ktr_header);
- if (pid && ktr_header.ktr_pid != pid)
+ if (pid && ktr_header.ktr_pid != pid &&
+ ktr_header.ktr_tid != pid)
continue;
if ((trpoints & (1<<ktr_header.ktr_type)) == 0)
continue;
@@ -1240,11 +1242,15 @@ ktrpsig(struct ktr_psig *psig)
printf("SIG%s ", signames[psig->signo]);
else
printf("SIG %d ", psig->signo);
- if (psig->action == SIG_DFL)
- printf("SIG_DFL code=0x%x\n", psig->code);
- else {
- printf("caught handler=0x%lx mask=0x%x code=0x%x\n",
- (u_long)psig->action, psig->mask.__bits[0], psig->code);
+ if (psig->action == SIG_DFL) {
+ printf("SIG_DFL code=");
+ sigcodename(psig->signo, psig->code);
+ putchar('\n');
+ } else {
+ printf("caught handler=0x%lx mask=0x%x code=",
+ (u_long)psig->action, psig->mask.__bits[0]);
+ sigcodename(psig->signo, psig->code);
+ putchar('\n');
}
}
@@ -1414,8 +1420,6 @@ ktrsockaddr(struct sockaddr *sa)
TODO: Support additional address families
#include <netnatm/natm.h>
struct sockaddr_natm *natm;
- #include <netsmb/netbios.h>
- struct sockaddr_nb *nb;
*/
char addr[64];
diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr
index bc466d5..1b0df5e 100644
--- a/usr.bin/kdump/mksubr
+++ b/usr.bin/kdump/mksubr
@@ -388,7 +388,13 @@ auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+"
auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h"
auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
+auto_switch_type "sigbuscodename" "BUS_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigchldcodename" "CLD_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigfpecodename" "FPE_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigillcodename" "ILL_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigsegvcodename" "SEGV_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigtrapcodename" "TRAP_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h"
@@ -410,7 +416,7 @@ fcntlcmdname(int cmd, int arg, int decimal)
{
switch (cmd) {
_EOF_
-egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z]+[[:space:]]+[0-9]+[[:space:]]*" \
+egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]*" \
$include_dir/sys/fcntl.h | \
awk 'BEGIN { o=0 } { for (i = 1; i <= NF; i++) \
if ($i ~ /define/) \
@@ -501,4 +507,46 @@ cat <<_EOF_
printf(">");
}
+/*
+ * AUTO - Special
+ *
+ * Check general codes first, then defer to signal-specific codes.
+ */
+void
+sigcodename(int sig, int code)
+{
+ switch (code) {
_EOF_
+egrep "^#[[:space:]]*define[[:space:]]+SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?[[:space:]]*" \
+ $include_dir/sys/signal.h | grep -v SI_UNDEFINED | \
+ awk '{ for (i = 1; i <= NF; i++) \
+ if ($i ~ /define/) \
+ break; \
+ ++i; \
+ printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
+cat <<_EOF_
+ default:
+ switch (sig) {
+ case SIGILL:
+ sigillcodename(code);
+ break;
+ case SIGBUS:
+ sigbuscodename(code);
+ break;
+ case SIGSEGV:
+ sigsegvcodename(code);
+ break;
+ case SIGFPE:
+ sigfpecodename(code);
+ break;
+ case SIGTRAP:
+ sigtrapcodename(code);
+ break;
+ case SIGCHLD:
+ sigchldcodename(code);
+ break;
+ default:
+ printf("<invalid=%#x>", code);
+ }
+ }
+}
diff --git a/usr.bin/killall/killall.1 b/usr.bin/killall/killall.1
index 4529831..7beaadb 100644
--- a/usr.bin/killall/killall.1
+++ b/usr.bin/killall/killall.1
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 25, 2009
+.Dd June 27, 2012
.Dt KILLALL 1
.Os
.Sh NAME
@@ -34,6 +34,7 @@
.Nm
.Op Fl delmsvz
.Op Fl help
+.Op Fl I
.Op Fl j Ar jail
.Op Fl u Ar user
.Op Fl t Ar tty
@@ -71,6 +72,9 @@ processes specified with the
option.
.It Fl help
Give a help on the command usage and exit.
+.It Fl I
+Request confirmation before attempting to signal each
+process.
.It Fl l
List the names of the available signals and exit, like in
.Xr kill 1 .
diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c
index 28496a0..83e829a 100644
--- a/usr.bin/killall/killall.c
+++ b/usr.bin/killall/killall.c
@@ -53,7 +53,7 @@ static void __dead2
usage(void)
{
- fprintf(stderr, "usage: killall [-delmsvz] [-help] [-j jail]\n");
+ fprintf(stderr, "usage: killall [-delmsvz] [-help] [-I] [-j jail]\n");
fprintf(stderr,
" [-u user] [-t tty] [-c cmd] [-SIGNAL] [cmd]...\n");
fprintf(stderr, "At least one option or argument to specify processes must be given.\n");
@@ -90,13 +90,14 @@ nosig(char *name)
int
main(int ac, char **av)
{
- struct kinfo_proc *procs = NULL, *newprocs;
+ struct kinfo_proc *procs, *newprocs;
struct stat sb;
struct passwd *pw;
regex_t rgx;
regmatch_t pmatch;
- int i, j;
+ int i, j, ch;
char buf[256];
+ char first;
char *user = NULL;
char *tty = NULL;
char *cmd = NULL;
@@ -104,6 +105,7 @@ main(int ac, char **av)
int sflag = 0;
int dflag = 0;
int eflag = 0;
+ int Iflag = 0;
int jflag = 0;
int mflag = 0;
int zflag = 0;
@@ -141,6 +143,9 @@ main(int ac, char **av)
if (**av == '-') {
++*av;
switch (**av) {
+ case 'I':
+ Iflag = 1;
+ break;
case 'j':
++*av;
if (**av == '\0') {
@@ -273,9 +278,6 @@ main(int ac, char **av)
size = 0;
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
- mib[2] = KERN_PROC_PROC;
- mib[3] = 0;
- miblen = 3;
if (user) {
mib[2] = eflag ? KERN_PROC_UID : KERN_PROC_RUID;
@@ -285,16 +287,20 @@ main(int ac, char **av)
mib[2] = KERN_PROC_TTY;
mib[3] = tdev;
miblen = 4;
+ } else {
+ mib[2] = KERN_PROC_PROC;
+ mib[3] = 0;
+ miblen = 3;
}
+ procs = NULL;
st = sysctl(mib, miblen, NULL, &size, NULL, 0);
do {
size += size / 10;
newprocs = realloc(procs, size);
- if (newprocs == 0) {
- if (procs)
- free(procs);
- errx(1, "could not reallocate memory");
+ if (newprocs == NULL) {
+ free(procs);
+ err(1, "could not reallocate memory");
}
procs = newprocs;
st = sysctl(mib, miblen, procs, &size, NULL, 0);
@@ -304,7 +310,7 @@ main(int ac, char **av)
if (size % sizeof(struct kinfo_proc) != 0) {
fprintf(stderr, "proc size mismatch (%zu total, %zu chunks)\n",
size, sizeof(struct kinfo_proc));
- fprintf(stderr, "userland out of sync with kernel, recompile libkvm etc\n");
+ fprintf(stderr, "userland out of sync with kernel\n");
exit(1);
}
nprocs = size / sizeof(struct kinfo_proc);
@@ -313,7 +319,7 @@ main(int ac, char **av)
mypid = getpid();
for (i = 0; i < nprocs; i++) {
- if ((procs[i].ki_stat & SZOMB) == SZOMB && !zflag)
+ if (procs[i].ki_stat == SZOMB && !zflag)
continue;
thispid = procs[i].ki_pid;
strlcpy(thiscmd, procs[i].ki_comm, sizeof(thiscmd));
@@ -382,6 +388,16 @@ main(int ac, char **av)
if (matched)
break;
}
+ if (matched != 0 && Iflag) {
+ printf("Send signal %d to %s (pid %d uid %d)? ",
+ sig, thiscmd, thispid, thisuid);
+ fflush(stdout);
+ first = ch = getchar();
+ while (ch != '\n' && ch != EOF)
+ ch = getchar();
+ if (first != 'y' && first != 'Y')
+ matched = 0;
+ }
if (matched == 0)
continue;
if (dflag)
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c
index 5129545..d74b979 100644
--- a/usr.bin/ktrdump/ktrdump.c
+++ b/usr.bin/ktrdump/ktrdump.c
@@ -218,7 +218,7 @@ main(int ac, char **av)
* Now tear through the trace buffer.
*/
if (!iflag)
- i = (index - 1) & (entries - 1);
+ i = (index - 1) % entries;
tlast = -1;
for (;;) {
if (buf[i].ktr_desc == NULL)
@@ -286,7 +286,7 @@ next: if ((c = *p++) == '\0')
if (!iflag) {
if (i == index)
break;
- i = (i - 1) & (entries - 1);
+ i = (i - 1) % entries;
} else {
if (++i == entries)
break;
diff --git a/usr.bin/last/last.1 b/usr.bin/last/last.1
index 4ac12bf..6cb2e68 100644
--- a/usr.bin/last/last.1
+++ b/usr.bin/last/last.1
@@ -28,7 +28,7 @@
.\" @(#)last.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd July 27, 2003
+.Dd January 21, 2010
.Dt LAST 1
.Os
.Sh NAME
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index e587def..945cc41 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -72,12 +72,12 @@ typedef struct arg {
} ARG;
static ARG *arglist; /* head of linked list */
-static LIST_HEAD(idlisthead, idtab) idlist;
+static SLIST_HEAD(, idtab) idlist;
struct idtab {
time_t logout; /* log out time */
char id[sizeof ((struct utmpx *)0)->ut_id]; /* identifier */
- LIST_ENTRY(idtab) list;
+ SLIST_ENTRY(idtab) list;
};
static const char *crmsg; /* cause of last reboot */
@@ -206,7 +206,7 @@ wtmp(void)
char ct[80];
struct tm *tm;
- LIST_INIT(&idlist);
+ SLIST_INIT(&idlist);
(void)time(&t);
/* Load the last entries from the file. */
@@ -240,16 +240,14 @@ wtmp(void)
static void
doentry(struct utmpx *bp)
{
- struct idtab *tt, *ttx; /* idlist entry */
+ struct idtab *tt;
/* the machine stopped */
if (bp->ut_type == BOOT_TIME || bp->ut_type == SHUTDOWN_TIME) {
/* everybody just logged out */
- for (tt = LIST_FIRST(&idlist); tt;) {
- LIST_REMOVE(tt, list);
- ttx = tt;
- tt = LIST_NEXT(tt, list);
- free(ttx);
+ while ((tt = SLIST_FIRST(&idlist)) != NULL) {
+ SLIST_REMOVE_HEAD(&idlist, list);
+ free(tt);
}
currentout = -bp->ut_tv.tv_sec;
crmsg = bp->ut_type != SHUTDOWN_TIME ?
@@ -279,7 +277,7 @@ doentry(struct utmpx *bp)
return;
/* find associated identifier */
- LIST_FOREACH(tt, &idlist, list)
+ SLIST_FOREACH(tt, &idlist, list)
if (!memcmp(tt->id, bp->ut_id, sizeof bp->ut_id))
break;
@@ -290,7 +288,7 @@ doentry(struct utmpx *bp)
errx(1, "malloc failure");
tt->logout = currentout;
memcpy(tt->id, bp->ut_id, sizeof bp->ut_id);
- LIST_INSERT_HEAD(&idlist, tt, list);
+ SLIST_INSERT_HEAD(&idlist, tt, list);
}
/*
diff --git a/usr.bin/less/defines.h b/usr.bin/less/defines.h
index e9ee8c6..fe8f1bc 100644
--- a/usr.bin/less/defines.h
+++ b/usr.bin/less/defines.h
@@ -227,18 +227,12 @@
/* Define to 1 if you have the `fsync' function. */
#define HAVE_FSYNC 1
+/* GNU regex library */
+/* #undef HAVE_GNU_REGEX */
+
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
-/* Define to 1 if you have the `gen' library (-lgen). */
-/* #undef HAVE_LIBGEN */
-
-/* Define to 1 if you have the `intl' library (-lintl). */
-/* #undef HAVE_LIBINTL */
-
-/* Define to 1 if you have the `PW' library (-lPW). */
-/* #undef HAVE_LIBPW */
-
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
diff --git a/usr.bin/lex/NEWS b/usr.bin/lex/NEWS
index e632885..1f8a8cc 100644
--- a/usr.bin/lex/NEWS
+++ b/usr.bin/lex/NEWS
@@ -615,7 +615,7 @@ Changes between release 2.4.3 (03Dec93) and release 2.4.2:
sources. One side-effect of this change is that -+ and -CF
are now incompatible.
- - libfl.a now supplies private versions of the the <string.h>/
+ - libfl.a now supplies private versions of the <string.h>/
<strings.h> string routines needed by flex and the scanners
it generates, to enhance portability to some BSD systems.
diff --git a/usr.bin/lock/lock.c b/usr.bin/lock/lock.c
index 3f23a98..acc0e29 100644
--- a/usr.bin/lock/lock.c
+++ b/usr.bin/lock/lock.c
@@ -54,9 +54,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/stat.h>
-#include <sys/time.h>
#include <sys/signal.h>
#include <sys/consio.h>
+
#include <err.h>
#include <ctype.h>
#include <errno.h>
@@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <syslog.h>
#include <termios.h>
+#include <time.h>
#include <unistd.h>
#define TIMEOUT 15
@@ -89,10 +90,9 @@ int
main(int argc, char **argv)
{
struct passwd *pw;
- struct timeval timval;
- time_t timval_sec;
struct itimerval ntimer, otimer;
struct tm *timp;
+ time_t timval;
int ch, failures, sectimeout, usemine, vtylock;
char *ap, *cryptpw, *mypw, *ttynam, *tzn;
char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ];
@@ -129,7 +129,9 @@ main(int argc, char **argv)
}
timeout.tv_sec = sectimeout * 60;
- setuid(getuid()); /* discard privs */
+ /* discard privs */
+ if (setuid(getuid()) != 0)
+ errx(1, "setuid failed");
if (tcgetattr(0, &tty)) /* get information for header */
exit(1);
@@ -138,11 +140,9 @@ main(int argc, char **argv)
errx(1, "not a terminal?");
if (strncmp(ttynam, _PATH_DEV, strlen(_PATH_DEV)) == 0)
ttynam += strlen(_PATH_DEV);
- if (gettimeofday(&timval, (struct timezone *)NULL))
- err(1, "gettimeofday");
- nexttime = timval.tv_sec + (sectimeout * 60);
- timval_sec = timval.tv_sec;
- timp = localtime(&timval_sec);
+ timval = time(NULL);
+ nexttime = timval + (sectimeout * 60);
+ timp = localtime(&timval);
ap = asctime(timp);
tzn = timp->tm_zone;
@@ -256,17 +256,16 @@ usage(void)
static void
hi(int signo __unused)
{
- struct timeval timval;
+ time_t timval;
- if (!gettimeofday(&timval, (struct timezone *)NULL)) {
- (void)printf("lock: type in the unlock key. ");
- if (no_timeout) {
- (void)putchar('\n');
- } else {
- (void)printf("timeout in %jd:%jd minutes\n",
- (intmax_t)(nexttime - timval.tv_sec) / 60,
- (intmax_t)(nexttime - timval.tv_sec) % 60);
- }
+ timval = time(NULL);
+ (void)printf("lock: type in the unlock key. ");
+ if (no_timeout) {
+ (void)putchar('\n');
+ } else {
+ (void)printf("timeout in %jd:%jd minutes\n",
+ (intmax_t)(nexttime - timval) / 60,
+ (intmax_t)(nexttime - timval) % 60);
}
}
diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c
index d3c4786..49360f4 100644
--- a/usr.bin/logger/logger.c
+++ b/usr.bin/logger/logger.c
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
#define SYSLOG_NAMES
#include <syslog.h>
-static int decode(char *, CODE *);
+static int decode(char *, const CODE *);
static int pencode(char *);
static void logmessage(int, const char *, const char *, const char *,
const char *);
@@ -271,9 +271,9 @@ pencode(char *s)
}
static int
-decode(char *name, CODE *codetab)
+decode(char *name, const CODE *codetab)
{
- CODE *c;
+ const CODE *c;
if (isdigit(*name))
return (atoi(name));
diff --git a/usr.bin/login/login.1 b/usr.bin/login/login.1
index d80783d..a1a283a 100644
--- a/usr.bin/login/login.1
+++ b/usr.bin/login/login.1
@@ -137,8 +137,6 @@ message-of-the-day
system mailboxes
.It Pa \&.hushlogin
makes login quieter
-.It Pa /etc/auth.conf
-configure authentication services
.It Pa /etc/pam.d/login
.Xr pam 8
configuration file
diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile
index fefaf4d..ce50d6c 100644
--- a/usr.bin/m4/Makefile
+++ b/usr.bin/m4/Makefile
@@ -5,7 +5,7 @@
# if you want the paste & spaste macros.
PROG= m4
-CFLAGS+=-DEXTENDED -I${.CURDIR}/lib
+CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/lib
LDADD= -ly -ll -lm
# clang needs 1 while with gcc we can use 2
#WARNS= 1
diff --git a/usr.bin/m4/expr.c b/usr.bin/m4/expr.c
index 85bd8f1..8a64217 100644
--- a/usr.bin/m4/expr.c
+++ b/usr.bin/m4/expr.c
@@ -24,7 +24,7 @@ __FBSDID("$FreeBSD$");
#include "extern.h"
int32_t end_result;
-const char *copy_toeval;
+static const char *copy_toeval;
int yyerror(const char *msg);
extern void yy_scan_string(const char *);
diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h
index 9054d22..ccb2e77 100644
--- a/usr.bin/m4/extern.h
+++ b/usr.bin/m4/extern.h
@@ -43,6 +43,7 @@ extern unsigned long expansion_id;
/* expr.c */
extern int expr(const char *);
+extern int32_t end_result;
/* gnum4.c */
extern void addtoincludepath(const char *);
diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c
index 861279c..342751a 100644
--- a/usr.bin/m4/gnum4.c
+++ b/usr.bin/m4/gnum4.c
@@ -59,7 +59,7 @@ int mimic_gnu = 0;
* Then M4PATH env variable
*/
-struct path_entry {
+static struct path_entry {
char *name;
struct path_entry *next;
} *first, *last;
diff --git a/usr.bin/m4/lib/ohash_init.3 b/usr.bin/m4/lib/ohash_init.3
index b271115..19213f3 100644
--- a/usr.bin/m4/lib/ohash_init.3
+++ b/usr.bin/m4/lib/ohash_init.3
@@ -166,7 +166,7 @@ for (n = ohash_first(h, &i); n != NULL; n = ohash_next(h, &i))
points to an auxiliary unsigned integer used to record the current position
in the ohash table.
Those functions are safe to use even while entries are added to/removed
-from the table, but in such a case they don't guarantee that new entries
+from the table, but in such a case they do not guarantee that new entries
will be returned.
As a special case, they can safely be used to free elements in the table.
.Pp
diff --git a/usr.bin/m4/m4.1 b/usr.bin/m4/m4.1
index 71d208d..6d26111 100644
--- a/usr.bin/m4/m4.1
+++ b/usr.bin/m4/m4.1
@@ -97,7 +97,7 @@ You can change the quote characters with the
.Ic changequote
built-in macro.
.Pp
-Most built-ins don't make any sense without arguments, and hence are not
+Most built-ins do not make any sense without arguments, and hence are not
recognized as special when not followed by an open parenthesis.
.Pp
The options are as follows:
diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c
index 6b3cad4..c8de97c 100644
--- a/usr.bin/m4/main.c
+++ b/usr.bin/m4/main.c
@@ -85,7 +85,7 @@ struct keyblk {
int ktyp; /* keyword type */
};
-struct keyblk keywrds[] = { /* m4 keywords to be installed */
+static struct keyblk keywrds[] = { /* m4 keywords to be installed */
{ "include", INCLTYPE },
{ "sinclude", SINCTYPE },
{ "define", DEFITYPE },
diff --git a/usr.bin/m4/parser.y b/usr.bin/m4/parser.y
index 1495973..2239cf3 100644
--- a/usr.bin/m4/parser.y
+++ b/usr.bin/m4/parser.y
@@ -17,10 +17,17 @@
*
* $FreeBSD$
*/
+
#include <math.h>
+#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
+
+#include "mdef.h"
+#include "extern.h"
+
#define YYSTYPE int32_t
-extern int32_t end_result;
+
extern int yylex(void);
extern int yyerror(const char *);
%}
diff --git a/usr.bin/mail/util.c b/usr.bin/mail/util.c
index c90fe90..4e3a0f6 100644
--- a/usr.bin/mail/util.c
+++ b/usr.bin/mail/util.c
@@ -324,7 +324,7 @@ alter(char *name)
if (stat(name, &sb))
return;
- (void)gettimeofday(&tv[0], (struct timezone *)NULL);
+ (void)gettimeofday(&tv[0], NULL);
tv[0].tv_sec++;
TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtim);
(void)utimes(name, tv);
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 477c4a9..cbaea9e 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1421,6 +1421,7 @@ modifier_M(VarParser *vp, const char value[], char endc)
vp->ptr++;
}
*ptr = '\0';
+ DEBUGF(VAR, ("Pattern :%s\n", patt));
if (modifier == 'M') {
newValue = VarModify(value, VarMatch, patt);
@@ -1765,7 +1766,7 @@ ParseModifier(VarParser *vp, char startc, Var *v, Boolean *freeResult)
if ((vp->ptr[0] == 's') &&
(vp->ptr[1] == 'h') &&
(vp->ptr[2] == endc || vp->ptr[2] == ':')) {
- const char *error;
+ const char *error = NULL;
if (vp->execute) {
newStr = Buf_Peel(
diff --git a/usr.bin/makewhatis/makewhatis.c b/usr.bin/makewhatis/makewhatis.c
index f2ae370..45abc8f 100644
--- a/usr.bin/makewhatis/makewhatis.c
+++ b/usr.bin/makewhatis/makewhatis.c
@@ -693,7 +693,7 @@ enum { STATE_UNKNOWN, STATE_MANSTYLE, STATE_MDOCNAME, STATE_MDOCDESC };
static void
process_page(struct page_info *page, char *section_dir)
{
- gzFile *in;
+ gzFile in;
char buffer[4096];
char *line;
StringList *names;
diff --git a/usr.bin/man/man.conf.5 b/usr.bin/man/man.conf.5
index a7db849..f30a1c0 100644
--- a/usr.bin/man/man.conf.5
+++ b/usr.bin/man/man.conf.5
@@ -57,7 +57,7 @@ system for extending the manual set to support additional paths and locales.
is intended to be used by the local administrator to set additional policy.
.Pp
Currently supported configuration variables include:
-.Bl -tag -offset indent
+.Bl -tag -width 12n -offset indent
.It MANCONFIG
Overrides the default location to import additional manual configuration files.
Defaults to
@@ -70,7 +70,8 @@ Indicates support is available for the given locale.
.Pp
For pages in a given language, overriding the default toolset for
display is supported via the following definitions:
-.Bl -tag -offset indent -compact
+.Pp
+.Bl -tag -width 12n -offset indent -compact
.It EQN Ns _ Ns Va LANG
.It NROFF Ns _ Ns Va LANG
.It PIC Ns _ Ns Va LANG
@@ -87,7 +88,7 @@ section for how to use these variables.
The parser used for this utility is very basic and only supports comment
characters (#) at the beginning of a line.
.Sh FILES
-.Bl -tag -compact
+.Bl -tag -width "Pa /usr/local/etc/man.d/*.conf" -compact
.It Pa /etc/man.conf
System configuration file.
.It Pa /usr/local/etc/man.d/*.conf
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile
new file mode 100644
index 0000000..0995534
--- /dev/null
+++ b/usr.bin/mandoc/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+MDOCMLDIR= ${.CURDIR}/../../contrib/mdocml
+LIBMANDOC= ${.OBJDIR}/../../lib/libmandoc/libmandoc.a
+.PATH: ${MDOCMLDIR}
+
+PROG= mandoc
+FILES= example.style.css external.png style.css
+FILESDIR= ${SHAREDIR}/mdocml
+LINKS= mdocml
+MAN= mandoc.1 eqn.7 mandoc_char.7 tbl.7 # man.7 mdoc.7 roff.7
+MLINKS= mandoc.1 mdocml.1
+SRCS= eqn_html.c eqn_term.c html.c main.c man_html.c man_term.c mdoc_html.c \
+ mdoc_man.c mdoc_term.c out.c tbl_html.c tbl_term.c term.c \
+ term_ascii.c term_ps.c tree.c
+
+WARNS?= 3
+CFLAGS+= -DHAVE_CONFIG_H -DVERSION="\"1.12.1\""
+DPADD= ${LIBMANDOC}
+LDADD= ${LIBMANDOC}
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/minigzip/Makefile b/usr.bin/minigzip/Makefile
index 21b0924..b2cfc46 100644
--- a/usr.bin/minigzip/Makefile
+++ b/usr.bin/minigzip/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-SRCDIR= ${.CURDIR}/../../lib/libz
+SRCDIR= ${.CURDIR}/../../lib/libz/test
.PATH: ${SRCDIR}
PROG= minigzip
diff --git a/usr.bin/mkcsmapper/lex.l b/usr.bin/mkcsmapper/lex.l
index dd46caf..d8ab1b6 100644
--- a/usr.bin/mkcsmapper/lex.l
+++ b/usr.bin/mkcsmapper/lex.l
@@ -43,6 +43,7 @@
int line_number = 1;
%}
+%option noinput
%option nounput
%x COMMENT
@@ -57,7 +58,7 @@ int line_number = 1;
<COMMENT>[\n] { line_number++; }
<COMMENT>. { }
<COMMENT><<EOF>> {
- yyerror("unexpected file end (unterminate comment)\n");
+ yyerror("unexpected file end (unterminated comment)\n");
exit(1);
}
diff --git a/usr.bin/mkesdb/ldef.h b/usr.bin/mkesdb/ldef.h
index a14277c..0c5e76a 100644
--- a/usr.bin/mkesdb/ldef.h
+++ b/usr.bin/mkesdb/ldef.h
@@ -30,7 +30,6 @@
extern int line_number;
extern int yyerror(const char *);
extern int yylex(void);
-extern int yyparse(void);
struct named_csid {
STAILQ_ENTRY(named_csid) ci_entry;
diff --git a/usr.bin/mkesdb/lex.l b/usr.bin/mkesdb/lex.l
index 033897a..3e852b0 100644
--- a/usr.bin/mkesdb/lex.l
+++ b/usr.bin/mkesdb/lex.l
@@ -45,6 +45,7 @@
int line_number = 1;
%}
+%option noinput
%option nounput
%x COMMENT
@@ -59,7 +60,7 @@ int line_number = 1;
<COMMENT>[\n] { line_number++; }
<COMMENT>. { }
<COMMENT><<EOF>> {
- yyerror("unexpected file end (unterminate comment)\n");
+ yyerror("unexpected file end (unterminated comment)\n");
exit(1);
}
diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1
index 6d6830c..3ec7585 100644
--- a/usr.bin/mktemp/mktemp.1
+++ b/usr.bin/mktemp/mktemp.1
@@ -99,6 +99,14 @@ Care should
be taken to ensure that it is appropriate to use an environment variable
potentially supplied by the user.
.Pp
+If no arguments are passed or if only the
+.Fl d
+flag is passed
+.Nm
+behaves as if
+.Fl t Li tmp
+was supplied.
+.Pp
Any number of temporary files may be created in a single invocation,
including one based on the internal template resulting from the
.Fl t
diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c
index 72b89d6..277104f 100644
--- a/usr.bin/mktemp/mktemp.c
+++ b/usr.bin/mktemp/mktemp.c
@@ -87,6 +87,11 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
+ if (!tflag && argc < 1) {
+ tflag = 1;
+ prefix = "tmp";
+ }
+
if (tflag) {
tmpdir = getenv("TMPDIR");
if (tmpdir == NULL)
@@ -100,8 +105,6 @@ main(int argc, char **argv)
else
errx(1, "cannot generate template");
}
- } else if (argc < 1) {
- usage();
}
/* generate all requested files */
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c
index 8139b3f..c4c589e 100644
--- a/usr.bin/msgs/msgs.c
+++ b/usr.bin/msgs/msgs.c
@@ -105,47 +105,47 @@ __FBSDID("$FreeBSD$");
typedef char bool;
-FILE *msgsrc;
-FILE *newmsg;
-const char *sep = "-";
-char inbuf[BUFSIZ];
-char fname[MAXPATHLEN];
-char cmdbuf[MAXPATHLEN + MAXPATHLEN];
-char subj[128];
-char from[128];
-char date[128];
-char *ptr;
-char *in;
-bool local;
-bool ruptible;
-bool totty;
-bool seenfrom;
-bool seensubj;
-bool blankline;
-bool printing = NO;
-bool mailing = NO;
-bool quitit = NO;
-bool sending = NO;
-bool intrpflg = NO;
-uid_t uid;
-int msg;
-int prevmsg;
-int lct;
-int nlines;
-int Lpp = 0;
-time_t t;
-time_t keep;
+static FILE *msgsrc;
+static FILE *newmsg;
+static const char *sep = "-";
+static char inbuf[BUFSIZ];
+static char fname[MAXPATHLEN];
+static char cmdbuf[MAXPATHLEN + MAXPATHLEN];
+static char subj[128];
+static char from[128];
+static char date[128];
+static char *ptr;
+static char *in;
+static bool local;
+static bool ruptible;
+static bool totty;
+static bool seenfrom;
+static bool seensubj;
+static bool blankline;
+static bool printing = NO;
+static bool mailing = NO;
+static bool quitit = NO;
+static bool sending = NO;
+static bool intrpflg = NO;
+static uid_t uid;
+static int msg;
+static int prevmsg;
+static int lct;
+static int nlines;
+static int Lpp = 0;
+static time_t t;
+static time_t keep;
/* option initialization */
-bool hdrs = NO;
-bool qopt = NO;
-bool hush = NO;
-bool send_msg = NO;
-bool locomode = NO;
-bool use_pager = NO;
-bool clean = NO;
-bool lastcmd = NO;
-jmp_buf tstpbuf;
+static bool hdrs = NO;
+static bool qopt = NO;
+static bool hush = NO;
+static bool send_msg = NO;
+static bool locomode = NO;
+static bool use_pager = NO;
+static bool clean = NO;
+static bool lastcmd = NO;
+static jmp_buf tstpbuf;
static void ask(const char *);
static void gfrsub(FILE *);
@@ -155,7 +155,7 @@ static char *nxtfld(char *);
static void onsusp(int);
static void onintr(int);
static void prmesg(int);
-static void usage(void);
+static void usage(void);
int
main(int argc, char *argv[])
@@ -175,7 +175,8 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
time(&t);
- setuid(uid = getuid());
+ if (setuid(uid = getuid()) != 0)
+ err(1, "setuid failed");
ruptible = (signal(SIGINT, SIG_IGN) == SIG_DFL);
if (ruptible)
signal(SIGINT, SIG_DFL);
diff --git a/usr.bin/ncal/ncal.c b/usr.bin/ncal/ncal.c
index 02eb587..48b8c1a 100644
--- a/usr.bin/ncal/ncal.c
+++ b/usr.bin/ncal/ncal.c
@@ -24,10 +24,8 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
#include <calendar.h>
#include <ctype.h>
@@ -111,77 +109,81 @@ static struct djswitch {
{"YU", "Yugoslavia", {1919, 3, 4}}
};
-struct djswitch *dftswitch =
+static struct djswitch *dftswitch =
switches + sizeof(switches) / sizeof(struct djswitch) - 2;
/* default switch (should be "US") */
/* Table used to print day of month and week numbers */
-char daystr[] = " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
- " 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31"
- " 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47"
- " 48 49 50 51 52 53";
+static char daystr[] = " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
+ " 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31"
+ " 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47"
+ " 48 49 50 51 52 53";
/* Table used to print day of year and week numbers */
-char jdaystr[] = " 1 2 3 4 5 6 7 8 9"
- " 10 11 12 13 14 15 16 17 18 19"
- " 20 21 22 23 24 25 26 27 28 29"
- " 30 31 32 33 34 35 36 37 38 39"
- " 40 41 42 43 44 45 46 47 48 49"
- " 50 51 52 53 54 55 56 57 58 59"
- " 60 61 62 63 64 65 66 67 68 69"
- " 70 71 72 73 74 75 76 77 78 79"
- " 80 81 82 83 84 85 86 87 88 89"
- " 90 91 92 93 94 95 96 97 98 99"
- " 100 101 102 103 104 105 106 107 108 109"
- " 110 111 112 113 114 115 116 117 118 119"
- " 120 121 122 123 124 125 126 127 128 129"
- " 130 131 132 133 134 135 136 137 138 139"
- " 140 141 142 143 144 145 146 147 148 149"
- " 150 151 152 153 154 155 156 157 158 159"
- " 160 161 162 163 164 165 166 167 168 169"
- " 170 171 172 173 174 175 176 177 178 179"
- " 180 181 182 183 184 185 186 187 188 189"
- " 190 191 192 193 194 195 196 197 198 199"
- " 200 201 202 203 204 205 206 207 208 209"
- " 210 211 212 213 214 215 216 217 218 219"
- " 220 221 222 223 224 225 226 227 228 229"
- " 230 231 232 233 234 235 236 237 238 239"
- " 240 241 242 243 244 245 246 247 248 249"
- " 250 251 252 253 254 255 256 257 258 259"
- " 260 261 262 263 264 265 266 267 268 269"
- " 270 271 272 273 274 275 276 277 278 279"
- " 280 281 282 283 284 285 286 287 288 289"
- " 290 291 292 293 294 295 296 297 298 299"
- " 300 301 302 303 304 305 306 307 308 309"
- " 310 311 312 313 314 315 316 317 318 319"
- " 320 321 322 323 324 325 326 327 328 329"
- " 330 331 332 333 334 335 336 337 338 339"
- " 340 341 342 343 344 345 346 347 348 349"
- " 350 351 352 353 354 355 356 357 358 359"
- " 360 361 362 363 364 365 366";
-
-int flag_nohighlight; /* user doesn't want a highlighted today */
-int flag_weeks; /* user wants number of week */
-int nswitch; /* user defined switch date */
-int nswitchb; /* switch date for backward compatibility */
-int highlightdate;
-
-char *center(char *s, char *t, int w);
-wchar_t *wcenter(wchar_t *s, wchar_t *t, int w);
-int firstday(int y, int m);
-void highlight(char *dst, char *src, int len, int *extraletters);
-void mkmonthr(int year, int month, int jd_flag, struct monthlines * monthl);
-void mkmonthb(int year, int month, int jd_flag, struct monthlines * monthl);
-void mkweekdays(struct weekdays * wds);
-void monthranger(int year, int m, int jd_flag, int before, int after);
-void monthrangeb(int year, int m, int jd_flag, int before, int after);
-int parsemonth(const char *s, int *m, int *y);
-void printcc(void);
-void printeaster(int year, int julian, int orthodox);
-date *sdater(int ndays, struct date * d);
-date *sdateb(int ndays, struct date * d);
-int sndaysr(struct date * d);
-int sndaysb(struct date * d);
+static char jdaystr[] = " 1 2 3 4 5 6 7 8 9"
+ " 10 11 12 13 14 15 16 17 18 19"
+ " 20 21 22 23 24 25 26 27 28 29"
+ " 30 31 32 33 34 35 36 37 38 39"
+ " 40 41 42 43 44 45 46 47 48 49"
+ " 50 51 52 53 54 55 56 57 58 59"
+ " 60 61 62 63 64 65 66 67 68 69"
+ " 70 71 72 73 74 75 76 77 78 79"
+ " 80 81 82 83 84 85 86 87 88 89"
+ " 90 91 92 93 94 95 96 97 98 99"
+ " 100 101 102 103 104 105 106 107 108 109"
+ " 110 111 112 113 114 115 116 117 118 119"
+ " 120 121 122 123 124 125 126 127 128 129"
+ " 130 131 132 133 134 135 136 137 138 139"
+ " 140 141 142 143 144 145 146 147 148 149"
+ " 150 151 152 153 154 155 156 157 158 159"
+ " 160 161 162 163 164 165 166 167 168 169"
+ " 170 171 172 173 174 175 176 177 178 179"
+ " 180 181 182 183 184 185 186 187 188 189"
+ " 190 191 192 193 194 195 196 197 198 199"
+ " 200 201 202 203 204 205 206 207 208 209"
+ " 210 211 212 213 214 215 216 217 218 219"
+ " 220 221 222 223 224 225 226 227 228 229"
+ " 230 231 232 233 234 235 236 237 238 239"
+ " 240 241 242 243 244 245 246 247 248 249"
+ " 250 251 252 253 254 255 256 257 258 259"
+ " 260 261 262 263 264 265 266 267 268 269"
+ " 270 271 272 273 274 275 276 277 278 279"
+ " 280 281 282 283 284 285 286 287 288 289"
+ " 290 291 292 293 294 295 296 297 298 299"
+ " 300 301 302 303 304 305 306 307 308 309"
+ " 310 311 312 313 314 315 316 317 318 319"
+ " 320 321 322 323 324 325 326 327 328 329"
+ " 330 331 332 333 334 335 336 337 338 339"
+ " 340 341 342 343 344 345 346 347 348 349"
+ " 350 351 352 353 354 355 356 357 358 359"
+ " 360 361 362 363 364 365 366";
+
+static int flag_nohighlight; /* user doesn't want a highlighted today */
+static int flag_weeks; /* user wants number of week */
+static int nswitch; /* user defined switch date */
+static int nswitchb; /* switch date for backward compatibility */
+static int highlightdate;
+
+static char *center(char *s, char *t, int w);
+static wchar_t *wcenter(wchar_t *s, wchar_t *t, int w);
+static int firstday(int y, int m);
+static void highlight(char *dst, char *src, int len, int *extraletters);
+static void mkmonthr(int year, int month, int jd_flag,
+ struct monthlines * monthl);
+static void mkmonthb(int year, int month, int jd_flag,
+ struct monthlines * monthl);
+static void mkweekdays(struct weekdays * wds);
+static void monthranger(int year, int m, int jd_flag,
+ int before, int after);
+static void monthrangeb(int year, int m, int jd_flag,
+ int before, int after);
+static int parsemonth(const char *s, int *m, int *y);
+static void printcc(void);
+static void printeaster(int year, int julian, int orthodox);
+static date *sdater(int ndays, struct date * d);
+static date *sdateb(int ndays, struct date * d);
+static int sndaysr(struct date * d);
+static int sndaysb(struct date * d);
static void usage(void);
int
@@ -513,7 +515,7 @@ usage(void)
}
/* Print the assumed switches for all countries. */
-void
+static void
printcc(void)
{
struct djswitch *p;
@@ -534,7 +536,7 @@ printcc(void)
}
/* Print the date of easter sunday. */
-void
+static void
printeaster(int y, int julian, int orthodox)
{
date dt;
@@ -579,7 +581,7 @@ printeaster(int y, int julian, int orthodox)
#define M2M(m) (1 + (m) % 12)
/* Print all months for the period in the range [ before .. y-m .. after ]. */
-void
+static void
monthrangeb(int y, int m, int jd_flag, int before, int after)
{
struct monthlines year[12];
@@ -669,7 +671,7 @@ monthrangeb(int y, int m, int jd_flag, int before, int after)
}
}
-void
+static void
monthranger(int y, int m, int jd_flag, int before, int after)
{
struct monthlines year[12];
@@ -757,7 +759,7 @@ monthranger(int y, int m, int jd_flag, int before, int after)
return;
}
-void
+static void
mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
{
@@ -848,7 +850,7 @@ mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines)
}
}
-void
+static void
mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
{
@@ -945,7 +947,7 @@ mkmonthb(int y, int m, int jd_flag, struct monthlines *mlines)
}
/* Put the local names of weekdays into the wds. */
-void
+static void
mkweekdays(struct weekdays *wds)
{
int i, len, width = 0;
@@ -973,7 +975,7 @@ mkweekdays(struct weekdays *wds)
* Compute the day number of the first existing date after the first day in
* month. (the first day in month and even the month might not exist!)
*/
-int
+static int
firstday(int y, int m)
{
date dt;
@@ -997,7 +999,7 @@ firstday(int y, int m)
* Compute the number of days from date, obey the local switch from
* Julian to Gregorian if specified by the user.
*/
-int
+static int
sndaysr(struct date *d)
{
@@ -1014,7 +1016,7 @@ sndaysr(struct date *d)
* Compute the number of days from date, obey the switch from
* Julian to Gregorian as used by UK and her colonies.
*/
-int
+static int
sndaysb(struct date *d)
{
@@ -1025,7 +1027,7 @@ sndaysb(struct date *d)
}
/* Inverse of sndays. */
-struct date *
+static struct date *
sdater(int nd, struct date *d)
{
@@ -1036,7 +1038,7 @@ sdater(int nd, struct date *d)
}
/* Inverse of sndaysb. */
-struct date *
+static struct date *
sdateb(int nd, struct date *d)
{
@@ -1047,7 +1049,7 @@ sdateb(int nd, struct date *d)
}
/* Center string t in string s of length w by putting enough leading blanks. */
-char *
+static char *
center(char *s, char *t, int w)
{
char blanks[MAX_WIDTH];
@@ -1058,7 +1060,7 @@ center(char *s, char *t, int w)
}
/* Center string t in string s of length w by putting enough leading blanks. */
-wchar_t *
+static wchar_t *
wcenter(wchar_t *s, wchar_t *t, int w)
{
char blanks[MAX_WIDTH];
@@ -1068,7 +1070,7 @@ wcenter(wchar_t *s, wchar_t *t, int w)
return (s);
}
-int
+static int
parsemonth(const char *s, int *m, int *y)
{
int nm, ny;
@@ -1101,7 +1103,7 @@ parsemonth(const char *s, int *m, int *y)
return (1);
}
-void
+static void
highlight(char *dst, char *src, int len, int *extralen)
{
static int first = 1;
diff --git a/usr.bin/ncplist/ncplist.1 b/usr.bin/ncplist/ncplist.1
index 335fcc7..1c5eb89 100644
--- a/usr.bin/ncplist/ncplist.1
+++ b/usr.bin/ncplist/ncplist.1
@@ -1,5 +1,5 @@
.\" $FreeBSD$
-.Dd June 24, 1999
+.Dd January 21, 2010
.Dt NCPLIST 1
.Os
.Sh NAME
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile
index ce5cdab..1071f0e 100644
--- a/usr.bin/netstat/Makefile
+++ b/usr.bin/netstat/Makefile
@@ -13,6 +13,10 @@ CFLAGS+=-fno-strict-aliasing
CFLAGS+=-DIPSEC
CFLAGS+=-DSCTP
+.if ${MK_INET_SUPPORT} != "no"
+CFLAGS+=-DINET
+.endif
+
.if ${MK_INET6_SUPPORT} != "no"
SRCS+= inet6.c
CFLAGS+=-DINET6
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index c08fbf0..854844f 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -81,6 +81,32 @@ static void catchalarm(int);
static char addr_buf[NI_MAXHOST]; /* for getnameinfo() */
#endif
+static const char* pfsyncacts[] = {
+ /* PFSYNC_ACT_CLR */ "clear all request",
+ /* PFSYNC_ACT_INS */ "state insert",
+ /* PFSYNC_ACT_INS_ACK */ "state inserted ack",
+ /* PFSYNC_ACT_UPD */ "state update",
+ /* PFSYNC_ACT_UPD_C */ "compressed state update",
+ /* PFSYNC_ACT_UPD_REQ */ "uncompressed state request",
+ /* PFSYNC_ACT_DEL */ "state delete",
+ /* PFSYNC_ACT_DEL_C */ "compressed state delete",
+ /* PFSYNC_ACT_INS_F */ "fragment insert",
+ /* PFSYNC_ACT_DEL_F */ "fragment delete",
+ /* PFSYNC_ACT_BUS */ "bulk update mark",
+ /* PFSYNC_ACT_TDB */ "TDB replay counter update",
+ /* PFSYNC_ACT_EOF */ "end of frame mark",
+};
+
+static void
+pfsync_acts_stats(const char *fmt, uint64_t *a)
+{
+ int i;
+
+ for (i = 0; i < PFSYNC_ACT_MAX; i++, a++)
+ if (*a || sflag <= 1)
+ printf(fmt, *a, pfsyncacts[i], plural(*a));
+}
+
/*
* Dump pfsync statistics structure.
*/
@@ -106,11 +132,11 @@ pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
#define p(f, m) if (pfsyncstat.f || sflag <= 1) \
printf(m, (uintmax_t)pfsyncstat.f, plural(pfsyncstat.f))
-#define p2(f, m) if (pfsyncstat.f || sflag <= 1) \
- printf(m, (uintmax_t)pfsyncstat.f)
p(pfsyncs_ipackets, "\t%ju packet%s received (IPv4)\n");
p(pfsyncs_ipackets6, "\t%ju packet%s received (IPv6)\n");
+ pfsync_acts_stats("\t %ju %s%s received\n",
+ &pfsyncstat.pfsyncs_iacts[0]);
p(pfsyncs_badif, "\t\t%ju packet%s discarded for bad interface\n");
p(pfsyncs_badttl, "\t\t%ju packet%s discarded for bad ttl\n");
p(pfsyncs_hdrops, "\t\t%ju packet%s shorter than header\n");
@@ -123,10 +149,11 @@ pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
p(pfsyncs_badstate, "\t\t%ju failed state lookup/insert%s\n");
p(pfsyncs_opackets, "\t%ju packet%s sent (IPv4)\n");
p(pfsyncs_opackets6, "\t%ju packet%s sent (IPv6)\n");
- p2(pfsyncs_onomem, "\t\t%ju send failed due to mbuf memory error\n");
- p2(pfsyncs_oerrors, "\t\t%ju send error\n");
+ pfsync_acts_stats("\t %ju %s%s sent\n",
+ &pfsyncstat.pfsyncs_oacts[0]);
+ p(pfsyncs_onomem, "\t\t%ju failure%s due to mbuf memory error\n");
+ p(pfsyncs_oerrors, "\t\t%ju send error%s\n");
#undef p
-#undef p2
}
/*
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 50d2bdd..9d8c97e 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -461,7 +461,10 @@ protopr(u_long off, const char *name, int af1, int proto)
#endif
vchar = ((inp->inp_vflag & INP_IPV4) != 0) ?
"4 " : " ";
- printf("%-3.3s%-2.2s ", name, vchar);
+ if (istcp && (tp->t_flags & TF_TOE) != 0)
+ printf("%-3.3s%-2.2s ", "toe", vchar);
+ else
+ printf("%-3.3s%-2.2s ", name, vchar);
if (Lflag) {
char buf1[15];
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
index 7f65701..401a03c 100644
--- a/usr.bin/netstat/mbuf.c
+++ b/usr.bin/netstat/mbuf.c
@@ -67,16 +67,18 @@ mbpr(void *kvmd, u_long mbaddr)
struct memory_type_list *mtlp;
struct memory_type *mtp;
uintmax_t mbuf_count, mbuf_bytes, mbuf_free, mbuf_failures, mbuf_size;
+ uintmax_t mbuf_sleeps;
uintmax_t cluster_count, cluster_bytes, cluster_limit, cluster_free;
- uintmax_t cluster_failures, cluster_size;
+ uintmax_t cluster_failures, cluster_size, cluster_sleeps;
uintmax_t packet_count, packet_bytes, packet_free, packet_failures;
+ uintmax_t packet_sleeps;
uintmax_t tag_count, tag_bytes;
uintmax_t jumbop_count, jumbop_bytes, jumbop_limit, jumbop_free;
- uintmax_t jumbop_failures, jumbop_size;
+ uintmax_t jumbop_failures, jumbop_sleeps, jumbop_size;
uintmax_t jumbo9_count, jumbo9_bytes, jumbo9_limit, jumbo9_free;
- uintmax_t jumbo9_failures, jumbo9_size;
+ uintmax_t jumbo9_failures, jumbo9_sleeps, jumbo9_size;
uintmax_t jumbo16_count, jumbo16_bytes, jumbo16_limit, jumbo16_free;
- uintmax_t jumbo16_failures, jumbo16_size;
+ uintmax_t jumbo16_failures, jumbo16_sleeps, jumbo16_size;
uintmax_t bytes_inuse, bytes_incache, bytes_total;
int nsfbufs, nsfbufspeak, nsfbufsused;
struct mbstat mbstat;
@@ -121,6 +123,7 @@ mbpr(void *kvmd, u_long mbaddr)
mbuf_bytes = memstat_get_bytes(mtp);
mbuf_free = memstat_get_free(mtp);
mbuf_failures = memstat_get_failures(mtp);
+ mbuf_sleeps = memstat_get_sleeps(mtp);
mbuf_size = memstat_get_size(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_PACKET_MEM_NAME);
@@ -132,6 +135,7 @@ mbpr(void *kvmd, u_long mbaddr)
packet_count = memstat_get_count(mtp);
packet_bytes = memstat_get_bytes(mtp);
packet_free = memstat_get_free(mtp);
+ packet_sleeps = memstat_get_sleeps(mtp);
packet_failures = memstat_get_failures(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_CLUSTER_MEM_NAME);
@@ -145,6 +149,7 @@ mbpr(void *kvmd, u_long mbaddr)
cluster_limit = memstat_get_countlimit(mtp);
cluster_free = memstat_get_free(mtp);
cluster_failures = memstat_get_failures(mtp);
+ cluster_sleeps = memstat_get_sleeps(mtp);
cluster_size = memstat_get_size(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_MALLOC, MBUF_TAG_MEM_NAME);
@@ -167,6 +172,7 @@ mbpr(void *kvmd, u_long mbaddr)
jumbop_limit = memstat_get_countlimit(mtp);
jumbop_free = memstat_get_free(mtp);
jumbop_failures = memstat_get_failures(mtp);
+ jumbop_sleeps = memstat_get_sleeps(mtp);
jumbop_size = memstat_get_size(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBO9_MEM_NAME);
@@ -180,6 +186,7 @@ mbpr(void *kvmd, u_long mbaddr)
jumbo9_limit = memstat_get_countlimit(mtp);
jumbo9_free = memstat_get_free(mtp);
jumbo9_failures = memstat_get_failures(mtp);
+ jumbo9_sleeps = memstat_get_sleeps(mtp);
jumbo9_size = memstat_get_size(mtp);
mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBO16_MEM_NAME);
@@ -193,6 +200,7 @@ mbpr(void *kvmd, u_long mbaddr)
jumbo16_limit = memstat_get_countlimit(mtp);
jumbo16_free = memstat_get_free(mtp);
jumbo16_failures = memstat_get_failures(mtp);
+ jumbo16_sleeps = memstat_get_sleeps(mtp);
jumbo16_size = memstat_get_size(mtp);
printf("%ju/%ju/%ju mbufs in use (current/cache/total)\n",
@@ -279,7 +287,13 @@ mbpr(void *kvmd, u_long mbaddr)
printf("%ju/%ju/%ju requests for mbufs denied (mbufs/clusters/"
"mbuf+clusters)\n", mbuf_failures, cluster_failures,
packet_failures);
+ printf("%ju/%ju/%ju requests for mbufs delayed (mbufs/clusters/"
+ "mbuf+clusters)\n", mbuf_sleeps, cluster_sleeps,
+ packet_sleeps);
+ printf("%ju/%ju/%ju requests for jumbo clusters delayed "
+ "(%juk/9k/16k)\n", jumbop_sleeps, jumbo9_sleeps,
+ jumbo16_sleeps, jumbop_size / 1024);
printf("%ju/%ju/%ju requests for jumbo clusters denied "
"(%juk/9k/16k)\n", jumbop_failures, jumbo9_failures,
jumbo16_failures, jumbop_size / 1024);
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 996b471..270f6bd 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -1104,10 +1104,8 @@ ipx_phost(struct sockaddr *sa)
struct sockaddr_ipx work;
static union ipx_net ipx_zeronet;
char *p;
- struct ipx_addr in;
work = *sipx;
- in = work.sipx_addr;
work.sipx_addr.x_port = 0;
work.sipx_addr.x_net = ipx_zeronet;
diff --git a/usr.bin/netstat/sctp.c b/usr.bin/netstat/sctp.c
index 3f13b71..2f67b0c 100644
--- a/usr.bin/netstat/sctp.c
+++ b/usr.bin/netstat/sctp.c
@@ -107,6 +107,7 @@ struct xraddr_entry {
* If numeric_addr has been supplied, give
* numeric value, otherwise try for symbolic name.
*/
+#ifdef INET
static char *
inetname(struct in_addr *inp)
{
@@ -146,6 +147,7 @@ inetname(struct in_addr *inp)
}
return (line);
}
+#endif
#ifdef INET6
static char ntop_buf[INET6_ADDRSTRLEN];
@@ -197,9 +199,11 @@ sctp_print_address(union sctp_sockstore *address, int port, int num_port)
int width;
switch (address->sa.sa_family) {
+#ifdef INET
case AF_INET:
sprintf(line, "%.*s.", Wflag ? 39 : 16, inetname(&address->sin.sin_addr));
break;
+#endif
#ifdef INET6
case AF_INET6:
sprintf(line, "%.*s.", Wflag ? 39 : 16, inet6name(&address->sin6.sin6_addr));
diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c
index dc73a69..efbaed5 100644
--- a/usr.bin/nfsstat/nfsstat.c
+++ b/usr.bin/nfsstat/nfsstat.c
@@ -995,7 +995,6 @@ exp_sidewaysintpr(u_int interval, int clientOnly, int serverOnly)
);
}
printf("\n");
- lastst = nfsstats;
}
if (serverOnly) {
printf("%s %6d %6d %6d %6d %6d %6d %6d %6d",
@@ -1019,8 +1018,8 @@ exp_sidewaysintpr(u_int interval, int clientOnly, int serverOnly)
(nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS] -
lastst.srvrpccnt[NFSV4OP_READDIRPLUS]));
printf("\n");
- lastst = nfsstats;
}
+ lastst = nfsstats;
fflush(stdout);
sleep(interval);
}
diff --git a/usr.bin/passwd/passwd.1 b/usr.bin/passwd/passwd.1
index da540ca..dbb5a4d 100644
--- a/usr.bin/passwd/passwd.1
+++ b/usr.bin/passwd/passwd.1
@@ -221,8 +221,6 @@ a Version 7 format password file
temporary copy of the password file
.It Pa /etc/login.conf
login class capabilities database
-.It Pa /etc/auth.conf
-configure authentication services
.El
.Sh SEE ALSO
.Xr chpass 1 ,
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c
index 89149dcda..4b09342 100644
--- a/usr.bin/printf/printf.c
+++ b/usr.bin/printf/printf.c
@@ -64,6 +64,7 @@ static const char rcsid[] =
#define main printfcmd
#include "bltin/bltin.h"
#include "error.h"
+#include "options.h"
#endif
#define PF(f, func) do { \
@@ -101,15 +102,19 @@ int
main(int argc, char *argv[])
{
size_t len;
- int ch, chopped, end, rval;
+ int chopped, end, rval;
char *format, *fmt, *start;
-
#ifndef SHELL
+ int ch;
+
(void) setlocale(LC_ALL, "");
#endif
+
#ifdef SHELL
- optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
-#endif
+ nextopt("");
+ argc -= argptr - argv;
+ argv = argptr;
+#else
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
case '?':
@@ -119,6 +124,7 @@ main(int argc, char *argv[])
}
argc -= optind;
argv += optind;
+#endif
if (argc < 1) {
usage();
diff --git a/usr.bin/procstat/procstat.1 b/usr.bin/procstat/procstat.1
index 6587bd3..38681f8 100644
--- a/usr.bin/procstat/procstat.1
+++ b/usr.bin/procstat/procstat.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 23, 2012
+.Dd July 11, 2012
.Dt PROCSTAT 1
.Os
.Sh NAME
@@ -418,6 +418,8 @@ default
device
.It ph
physical
+.It sg
+scatter/gather
.It sw
swap
.It vn
@@ -433,6 +435,10 @@ copy-on-write
needs copy
.It S
one or more superpage mappings are used
+.It D
+grows down (top-down stack)
+.It U
+grows up (bottom-up stack)
.El
.Sh EXIT STATUS
.Ex -std
diff --git a/usr.bin/procstat/procstat_auxv.c b/usr.bin/procstat/procstat_auxv.c
index 9bf7afb..b78e13a 100644
--- a/usr.bin/procstat/procstat_auxv.c
+++ b/usr.bin/procstat/procstat_auxv.c
@@ -231,9 +231,11 @@ procstat_auxv(struct kinfo_proc *kipp)
else
PRINT(AT_STACKPROT, %s, "EXECUTABLE");
break;
- case AT_COUNT:
- PRINT(AT_COUNT, %ld, (long)auxv[i].a_un.a_val);
+#ifdef AT_TIMEKEEP
+ case AT_TIMEKEEP:
+ PRINT(AT_TIMEKEEP, %p, auxv[i].a_un.a_ptr);
break;
+#endif
default:
PRINT_UNKNOWN(auxv[i].a_type, auxv[i].a_un.a_val);
break;
diff --git a/usr.bin/procstat/procstat_files.c b/usr.bin/procstat/procstat_files.c
index 4c1905c..126ef7e 100644
--- a/usr.bin/procstat/procstat_files.c
+++ b/usr.bin/procstat/procstat_files.c
@@ -476,4 +476,5 @@ procstat_files(struct procstat *procstat, struct kinfo_proc *kipp)
printf("\n");
}
+ procstat_freefiles(procstat, head);
}
diff --git a/usr.bin/procstat/procstat_rlimit.c b/usr.bin/procstat/procstat_rlimit.c
index c5429c4..68230e5 100644
--- a/usr.bin/procstat/procstat_rlimit.c
+++ b/usr.bin/procstat/procstat_rlimit.c
@@ -66,8 +66,8 @@ static struct {
#error "Resource limits have grown. Add new entries to rlimit_param[]."
#endif
-static
-const char *humanize_rlimit(int indx, rlim_t limit)
+static const char *
+humanize_rlimit(int indx, rlim_t limit)
{
static char buf[14];
int scale;
diff --git a/usr.bin/procstat/procstat_vm.c b/usr.bin/procstat/procstat_vm.c
index 33d0759..66f29ae 100644
--- a/usr.bin/procstat/procstat_vm.c
+++ b/usr.bin/procstat/procstat_vm.c
@@ -50,7 +50,7 @@ procstat_vm(struct kinfo_proc *kipp)
ptrwidth = 2*sizeof(void *) + 2;
if (!hflag)
- printf("%5s %*s %*s %3s %4s %4s %3s %3s %3s %-2s %-s\n",
+ printf("%5s %*s %*s %3s %4s %4s %3s %3s %4s %-2s %-s\n",
"PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES",
"PRES", "REF", "SHD", "FL", "TP", "PATH");
@@ -72,7 +72,9 @@ procstat_vm(struct kinfo_proc *kipp)
printf("%-1s", kve->kve_flags & KVME_FLAG_COW ? "C" : "-");
printf("%-1s", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" :
"-");
- printf("%-1s ", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-");
+ printf("%-1s", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-");
+ printf("%-1s ", kve->kve_flags & KVME_FLAG_GROWS_UP ? "U" :
+ kve->kve_flags & KVME_FLAG_GROWS_DOWN ? "D" : "-");
switch (kve->kve_type) {
case KVME_TYPE_NONE:
str = "--";
diff --git a/usr.bin/rctl/rctl.8 b/usr.bin/rctl/rctl.8
index 0d6606b..e570f57 100644
--- a/usr.bin/rctl/rctl.8
+++ b/usr.bin/rctl/rctl.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 1, 2012
+.Dd October 26, 2012
.Dt RCTL 8
.Os
.Sh NAME
@@ -68,6 +68,10 @@ to the RCTL database.
.It Fl l Ar filter
Display rules applicable to the process defined by
.Ar filter .
+Note that this is different from showing the rules when called without
+any options, as it shows not just the rules with subject equal to that
+of process, but also rules for the user, jail, and login class applicable
+to the process.
.It Fl r Ar filter
Remove rules matching
.Ar filter
@@ -90,7 +94,8 @@ Subject defines the kind of entity the rule applies to.
It can be either process, user, login class, or jail.
.Pp
Subject ID identifies the subject.
-It can be user name, numerical user ID, login class name, or jail name.
+It can be a process ID, user name, numerical user ID, login class name,
+or jail name.
.Pp
Resource identifies the resource the rule controls.
.Pp
@@ -141,6 +146,7 @@ A filter that matches all defined rules for maxproc resource would be
.It nshm Ta "number of SysV shared memory segments"
.It shmsize Ta "SysV shared memory size, in bytes"
.It wallclock Ta "wallclock time, in seconds"
+.It pcpu Ta "%CPU, in percents of a single CPU core"
.El
.Sh ACTIONS
.Bl -column -offset 3n "pseudoterminals"
@@ -179,9 +185,7 @@ Display resource usage information for jail named "www".
.Pp
Display all the rules applicable to process with PID 512.
.Sh SEE ALSO
-.Xr rctl.conf 5 ,
-.Xr jailstat 8 ,
-.Xr userstat 8
+.Xr rctl.conf 5
.Sh HISTORY
The
.Nm
diff --git a/usr.bin/rlogin/rlogin.1 b/usr.bin/rlogin/rlogin.1
index f98fa24..8aea6bd 100644
--- a/usr.bin/rlogin/rlogin.1
+++ b/usr.bin/rlogin/rlogin.1
@@ -128,7 +128,6 @@ Determines the user's terminal type.
.Bl -tag -width /etc/hosts -compact
.It Pa /etc/hosts
.It Pa /etc/hosts.equiv
-.It Pa /etc/auth.conf
.It Ev $HOME Ns Pa /.rhosts
.El
.Sh SEE ALSO
@@ -138,7 +137,6 @@ Determines the user's terminal type.
.Xr setsockopt 2 ,
.Xr ruserok 3 ,
.Xr tty 4 ,
-.Xr auth.conf 5 ,
.Xr hosts 5 ,
.Xr hosts.equiv 5 ,
.Xr rlogind 8 ,
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c
index b134679..646630b 100644
--- a/usr.bin/rlogin/rlogin.c
+++ b/usr.bin/rlogin/rlogin.c
@@ -92,35 +92,35 @@ __FBSDID("$FreeBSD$");
#define SIGUSR1 30
#endif
-int eight, rem;
-struct termios deftty;
+static int eight, rem;
+static struct termios deftty;
-int family = PF_UNSPEC;
+static int family = PF_UNSPEC;
-int noescape;
-u_char escapechar = '~';
+static int noescape;
+static u_char escapechar = '~';
#define get_window_size(fd, wp) ioctl(fd, TIOCGWINSZ, wp)
-struct winsize winsize;
-
-void catch_child(int);
-void copytochild(int);
-void doit(long) __dead2;
-void done(int) __dead2;
-void echo(char);
-u_int getescape(const char *);
-void lostpeer(int);
-void mode(int);
-void msg(const char *);
-void oob(int);
-int reader(int);
-void sendwindow(void);
-void setsignal(int);
-void sigwinch(int);
-void stop(char);
-void usage(void) __dead2;
-void writer(void);
-void writeroob(int);
+static struct winsize winsize;
+
+static void catch_child(int);
+static void copytochild(int);
+static _Noreturn void doit(long);
+static _Noreturn void done(int);
+static void echo(char);
+static u_int getescape(const char *);
+static void lostpeer(int);
+static void mode(int);
+static void msg(const char *);
+static void oob(int);
+static int reader(int);
+static void sendwindow(void);
+static void setsignal(int);
+static void sigwinch(int);
+static void stop(char);
+static _Noreturn void usage(void);
+static void writer(void);
+static void writeroob(int);
int
main(int argc, char *argv[])
@@ -269,9 +269,9 @@ main(int argc, char *argv[])
/*NOTREACHED*/
}
-int child;
+static int child;
-void
+static void
doit(long omask)
{
@@ -309,7 +309,7 @@ doit(long omask)
}
/* trap a signal, unless it is being ignored. */
-void
+static void
setsignal(int sig)
{
int omask = sigblock(sigmask(sig));
@@ -319,7 +319,7 @@ setsignal(int sig)
(void)sigsetmask(omask);
}
-void
+static void
done(int status)
{
int w, wstatus;
@@ -334,14 +334,14 @@ done(int status)
exit(status);
}
-int dosigwinch;
+static int dosigwinch;
/*
* This is called when the reader process gets the out-of-band (urgent)
* request to turn on the window-changing protocol.
*/
/* ARGSUSED */
-void
+static void
writeroob(int signo __unused)
{
if (dosigwinch == 0) {
@@ -352,7 +352,7 @@ writeroob(int signo __unused)
}
/* ARGSUSED */
-void
+static void
catch_child(int signo __unused)
{
pid_t pid;
@@ -375,7 +375,7 @@ catch_child(int signo __unused)
* ~^Z suspend rlogin process.
* ~<delayed-suspend char> suspend rlogin process, but leave reader alone.
*/
-void
+static void
writer(void)
{
int bol, local, n;
@@ -432,7 +432,7 @@ writer(void)
}
}
-void
+static void
echo(char c)
{
char *p;
@@ -454,7 +454,7 @@ echo(char c)
(void)write(STDOUT_FILENO, buf, p - buf);
}
-void
+static void
stop(char cmdc)
{
mode(0);
@@ -466,7 +466,7 @@ stop(char cmdc)
}
/* ARGSUSED */
-void
+static void
sigwinch(int signo __unused)
{
struct winsize ws;
@@ -481,7 +481,7 @@ sigwinch(int signo __unused)
/*
* Send the window size to the server via the magic escape
*/
-void
+static void
sendwindow(void)
{
struct winsize ws;
@@ -506,13 +506,13 @@ sendwindow(void)
#define READING 1
#define WRITING 2
-jmp_buf rcvtop;
-int rcvcnt, rcvstate;
-pid_t ppid;
-char rcvbuf[8 * 1024];
+static jmp_buf rcvtop;
+static int rcvcnt, rcvstate;
+static pid_t ppid;
+static char rcvbuf[8 * 1024];
/* ARGSUSED */
-void
+static void
oob(int signo __unused)
{
struct termios tty;
@@ -593,7 +593,7 @@ oob(int signo __unused)
}
/* reader: read from remote: line -> 1 */
-int
+static int
reader(int omask)
{
int n, remaining;
@@ -636,7 +636,7 @@ reader(int omask)
}
}
-void
+static void
mode(int f)
{
struct termios tty;
@@ -667,7 +667,7 @@ mode(int f)
}
/* ARGSUSED */
-void
+static void
lostpeer(int signo __unused)
{
(void)signal(SIGPIPE, SIG_IGN);
@@ -677,19 +677,19 @@ lostpeer(int signo __unused)
/* copy SIGURGs to the child process via SIGUSR1. */
/* ARGSUSED */
-void
+static void
copytochild(int signo __unused)
{
(void)kill(child, SIGUSR1);
}
-void
+static void
msg(const char *str)
{
(void)fprintf(stderr, "rlogin: %s\r\n", str);
}
-void
+static void
usage(void)
{
(void)fprintf(stderr,
@@ -698,7 +698,7 @@ usage(void)
exit(1);
}
-u_int
+static u_int
getescape(const char *p)
{
long val;
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c
index a54c3e9..3755f4c 100644
--- a/usr.bin/rpcgen/rpc_main.c
+++ b/usr.bin/rpcgen/rpc_main.c
@@ -435,7 +435,7 @@ c_initialize(void)
}
-const char rpcgen_table_dcl[] = "struct rpcgen_table {\n\
+static const char rpcgen_table_dcl[] = "struct rpcgen_table {\n\
char *(*proc)(); \n\
xdrproc_t xdr_arg; \n\
unsigned len_arg; \n\
diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c
index 08cf94c..4b951a3 100644
--- a/usr.bin/rpcgen/rpc_svcout.c
+++ b/usr.bin/rpcgen/rpc_svcout.c
@@ -54,7 +54,7 @@ static char RESULT[] = "result";
static char ROUTINE[] = "local";
static char RETVAL[] = "retval";
-char _errbuf[256]; /* For all messages */
+static char _errbuf[256]; /* For all messages */
void internal_proctype( proc_list * );
static void write_real_program( definition * );
diff --git a/usr.bin/rpcgen/rpc_util.c b/usr.bin/rpcgen/rpc_util.c
index 9d1c85b..bf0ca5d 100644
--- a/usr.bin/rpcgen/rpc_util.c
+++ b/usr.bin/rpcgen/rpc_util.c
@@ -59,8 +59,8 @@ int linenum = 0; /* current line number */
const char *infilename; /* input filename */
#define NFILES 7
-const char *outfiles[NFILES]; /* output file names */
-int nfiles;
+static const char *outfiles[NFILES]; /* output file names */
+static int nfiles;
FILE *fout; /* file pointer of current output */
FILE *fin; /* file pointer of current input */
diff --git a/usr.bin/rpcinfo/rpcinfo.c b/usr.bin/rpcinfo/rpcinfo.c
index ed21cd7..884f80d 100644
--- a/usr.bin/rpcinfo/rpcinfo.c
+++ b/usr.bin/rpcinfo/rpcinfo.c
@@ -476,7 +476,7 @@ pmapdump(int argc, char **argv)
struct rpcent *rpc;
enum clnt_stat clnt_st;
struct rpc_err err;
- char *host;
+ char *host = NULL;
if (argc > 1)
usage();
@@ -513,10 +513,16 @@ pmapdump(int argc, char **argv)
if ((clnt_st == RPC_PROGVERSMISMATCH) ||
(clnt_st == RPC_PROGUNAVAIL)) {
CLNT_GETERR(client, &err);
- if (err.re_vers.low > PMAPVERS)
- warnx(
- "%s does not support portmapper. Try rpcinfo %s instead",
- host, host);
+ if (err.re_vers.low > PMAPVERS) {
+ if (host)
+ warnx("%s does not support portmapper."
+ "Try rpcinfo %s instead", host,
+ host);
+ else
+ warnx("local host does not support "
+ "portmapper. Try 'rpcinfo' "
+ "instead");
+ }
exit(1);
}
clnt_perror(client, "rpcinfo: can't contact portmapper");
diff --git a/usr.bin/rsh/rsh.1 b/usr.bin/rsh/rsh.1
index 6dbb90e..7cc64d2 100644
--- a/usr.bin/rsh/rsh.1
+++ b/usr.bin/rsh/rsh.1
@@ -125,14 +125,12 @@ to
.Sh FILES
.Bl -tag -width /etc/hosts -compact
.It Pa /etc/hosts
-.It Pa /etc/auth.conf
.El
.Sh SEE ALSO
.Xr rlogin 1 ,
.Xr setsockopt 2 ,
.Xr rcmd 3 ,
.Xr ruserok 3 ,
-.Xr auth.conf 5 ,
.Xr hosts 5 ,
.Xr hosts.equiv 5 ,
.Xr rlogind 8 ,
diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1
index 21bc2fd..df5ed24 100644
--- a/usr.bin/script/script.1
+++ b/usr.bin/script/script.1
@@ -28,7 +28,7 @@
.\" @(#)script.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd September 28, 2011
+.Dd Oct 27, 2012
.Dt SCRIPT 1
.Os
.Sh NAME
@@ -36,7 +36,7 @@
.Nd make typescript of terminal session
.Sh SYNOPSIS
.Nm
-.Op Fl akq
+.Op Fl adfkpqr
.Op Fl t Ar time
.Op Ar file Op Ar command ...
.Sh DESCRIPTION
@@ -72,10 +72,27 @@ Append the output to
or
.Pa typescript ,
retaining the prior contents.
+.It Fl d
+When playing back a session with the
+.Fl p
+flag, do not sleep between records when playing back a timestamped session.
+.It Fl f
+Create
+.Ar file.filemon
+or
+.Pa typescript.filemon
+using
+.Xr filemon 4 .
.It Fl k
Log keys sent to the program as well as output.
+.It Fl p
+Play back a session recorded with the
+.Fl r
+flag in real time.
.It Fl q
-Run in quiet mode, omit the start and stop status messages.
+Run in quiet mode, omit the start, stop and command status messages.
+.It Fl r
+Record a session with input, output, and timestamping.
.It Fl t Ar time
Specify the interval at which the script output file will be flushed
to disk, in seconds.
@@ -141,6 +158,7 @@ is assumed.
.El
.Sh SEE ALSO
.Xr csh 1
+.Xr filemon 4
.Po
for the
.Em history
@@ -151,6 +169,16 @@ The
.Nm
command appeared in
.Bx 3.0 .
+.Pp
+The
+.Fl d ,
+.Fl p
+and
+.Fl r
+options first appeared in
+.Nx 2.0
+and were ported to
+.Fx 10 .
.Sh BUGS
The
.Nm
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c
index cd577f7..515a10e 100644
--- a/usr.bin/script/script.c
+++ b/usr.bin/script/script.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2010, 2012 David E. O'Brien
* Copyright (c) 1980, 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -27,25 +28,24 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
+#include <sys/param.h>
__FBSDID("$FreeBSD$");
-
#ifndef lint
static const char copyright[] =
"@(#) Copyright (c) 1980, 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif
-
#ifndef lint
static const char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93";
#endif
-#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/endian.h>
+#include <dev/filemon/filemon.h>
#include <err.h>
#include <errno.h>
@@ -59,11 +59,22 @@ static const char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93";
#include <termios.h>
#include <unistd.h>
+#define DEF_BUF 65536
+
+struct stamp {
+ uint64_t scr_len; /* amount of data */
+ uint64_t scr_sec; /* time it arrived in seconds... */
+ uint32_t scr_usec; /* ...and microseconds */
+ uint32_t scr_direction; /* 'i', 'o', etc (also indicates endianness) */
+};
+
static FILE *fscript;
static int master, slave;
static int child;
static const char *fname;
-static int qflg, ttyflg;
+static char *fmfname;
+static int fflg, qflg, ttyflg;
+static int usesleep, rawout;
static struct termios tt;
@@ -71,6 +82,9 @@ static void done(int) __dead2;
static void doshell(char **);
static void fail(void);
static void finish(void);
+static void record(FILE *, char *, size_t, int);
+static void consume(FILE *, off_t, char *, int);
+static void playback(FILE *) __dead2;
static void usage(void);
int
@@ -79,27 +93,45 @@ main(int argc, char *argv[])
int cc;
struct termios rtt, stt;
struct winsize win;
- int aflg, kflg, ch, n;
struct timeval tv, *tvp;
time_t tvec, start;
char obuf[BUFSIZ];
char ibuf[BUFSIZ];
fd_set rfd;
- int flushtime = 30;
- int readstdin;
+ int aflg, kflg, pflg, ch, k, n;
+ int flushtime, readstdin;
+ int fm_fd, fm_log;
+
+ aflg = kflg = pflg = 0;
+ usesleep = 1;
+ rawout = 0;
+ flushtime = 30;
+ fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC
+ warning. (not needed w/clang) */
- aflg = kflg = 0;
- while ((ch = getopt(argc, argv, "aqkt:")) != -1)
+ while ((ch = getopt(argc, argv, "adfkpqrt:")) != -1)
switch(ch) {
case 'a':
aflg = 1;
break;
- case 'q':
- qflg = 1;
+ case 'd':
+ usesleep = 0;
+ break;
+ case 'f':
+ fflg = 1;
break;
case 'k':
kflg = 1;
break;
+ case 'p':
+ pflg = 1;
+ break;
+ case 'q':
+ qflg = 1;
+ break;
+ case 'r':
+ rawout = 1;
+ break;
case 't':
flushtime = atoi(optarg);
if (flushtime < 0)
@@ -119,9 +151,29 @@ main(int argc, char *argv[])
} else
fname = "typescript";
- if ((fscript = fopen(fname, aflg ? "a" : "w")) == NULL)
+ if ((fscript = fopen(fname, pflg ? "r" : aflg ? "a" : "w")) == NULL)
err(1, "%s", fname);
+ if (fflg) {
+ asprintf(&fmfname, "%s.filemon", fname);
+ if (!fmfname)
+ err(1, "%s.filemon", fname);
+ if ((fm_fd = open("/dev/filemon", O_RDWR)) == -1)
+ err(1, "open(\"/dev/filemon\", O_RDWR)");
+ if ((fm_log = open(fmfname, O_WRONLY | O_CREAT | O_TRUNC,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1)
+ err(1, "open(%s)", fmfname);
+ if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) < 0)
+ err(1, "Cannot set filemon log file descriptor");
+
+ /* Set up these two fd's to close on exec. */
+ (void)fcntl(fm_fd, F_SETFD, FD_CLOEXEC);
+ (void)fcntl(fm_log, F_SETFD, FD_CLOEXEC);
+ }
+
+ if (pflg)
+ playback(fscript);
+
if ((ttyflg = isatty(STDIN_FILENO)) != 0) {
if (tcgetattr(STDIN_FILENO, &tt) == -1)
err(1, "tcgetattr");
@@ -134,11 +186,28 @@ main(int argc, char *argv[])
err(1, "openpty");
}
+ if (rawout)
+ record(fscript, NULL, 0, 's');
+
if (!qflg) {
tvec = time(NULL);
(void)printf("Script started, output file is %s\n", fname);
- (void)fprintf(fscript, "Script started on %s", ctime(&tvec));
+ if (!rawout) {
+ (void)fprintf(fscript, "Script started on %s",
+ ctime(&tvec));
+ if (argv[0]) {
+ fprintf(fscript, "command: ");
+ for (k = 0 ; argv[k] ; ++k)
+ fprintf(fscript, "%s%s", k ? " " : "",
+ argv[k]);
+ fprintf(fscript, "\n");
+ }
+ }
fflush(fscript);
+ if (fflg) {
+ (void)printf("Filemon started, output file is %s\n",
+ fmfname);
+ }
}
if (ttyflg) {
rtt = tt;
@@ -156,6 +225,9 @@ main(int argc, char *argv[])
doshell(argv);
close(slave);
+ if (fflg && ioctl(fm_fd, FILEMON_SET_PID, &child) < 0)
+ err(1, "Cannot set filemon PID");
+
start = tvec = time(0);
readstdin = 1;
for (;;) {
@@ -163,15 +235,12 @@ main(int argc, char *argv[])
FD_SET(master, &rfd);
if (readstdin)
FD_SET(STDIN_FILENO, &rfd);
- if (!readstdin && ttyflg) {
- tv.tv_sec = 1;
+ if ((!readstdin && ttyflg) || flushtime > 0) {
+ tv.tv_sec = !readstdin && ttyflg ? 1 :
+ flushtime - (tvec - start);
tv.tv_usec = 0;
tvp = &tv;
readstdin = 1;
- } else if (flushtime > 0) {
- tv.tv_sec = flushtime - (tvec - start);
- tv.tv_usec = 0;
- tvp = &tv;
} else {
tvp = NULL;
}
@@ -190,6 +259,8 @@ main(int argc, char *argv[])
readstdin = 0;
}
if (cc > 0) {
+ if (rawout)
+ record(fscript, ibuf, cc, 'i');
(void)write(master, ibuf, cc);
if (kflg && tcgetattr(master, &stt) >= 0 &&
((stt.c_lflag & ECHO) == 0)) {
@@ -202,7 +273,10 @@ main(int argc, char *argv[])
if (cc <= 0)
break;
(void)write(STDOUT_FILENO, obuf, cc);
- (void)fwrite(obuf, 1, cc, fscript);
+ if (rawout)
+ record(fscript, obuf, cc, 'o');
+ else
+ (void)fwrite(obuf, 1, cc, fscript);
}
tvec = time(0);
if (tvec - start >= flushtime) {
@@ -218,7 +292,7 @@ static void
usage(void)
{
(void)fprintf(stderr,
- "usage: script [-akq] [-t time] [file [command ...]]\n");
+ "usage: script [-adfkpqr] [-t time] [file [command ...]]\n");
exit(1);
}
@@ -242,19 +316,14 @@ static void
doshell(char **av)
{
const char *shell;
- int k;
shell = getenv("SHELL");
if (shell == NULL)
shell = _PATH_BSHELL;
- if (av[0])
- for (k = 0 ; av[k] ; ++k)
- fprintf(fscript, "%s%s", k ? " " : "", av[k]);
- fprintf(fscript, "\r\n");
-
(void)close(master);
(void)fclose(fscript);
+ free(fmfname);
login_tty(slave);
setenv("SCRIPT", fname, 1);
if (av[0]) {
@@ -282,11 +351,148 @@ done(int eno)
if (ttyflg)
(void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &tt);
tvec = time(NULL);
+ if (rawout)
+ record(fscript, NULL, 0, 'e');
if (!qflg) {
- (void)fprintf(fscript,"\nScript done on %s", ctime(&tvec));
+ if (!rawout)
+ (void)fprintf(fscript,"\nScript done on %s",
+ ctime(&tvec));
(void)printf("\nScript done, output file is %s\n", fname);
+ if (fflg) {
+ (void)printf("Filemon done, output file is %s\n",
+ fmfname);
+ }
}
(void)fclose(fscript);
(void)close(master);
exit(eno);
}
+
+static void
+record(FILE *fp, char *buf, size_t cc, int direction)
+{
+ struct iovec iov[2];
+ struct stamp stamp;
+ struct timeval tv;
+
+ (void)gettimeofday(&tv, NULL);
+ stamp.scr_len = cc;
+ stamp.scr_sec = tv.tv_sec;
+ stamp.scr_usec = tv.tv_usec;
+ stamp.scr_direction = direction;
+ iov[0].iov_len = sizeof(stamp);
+ iov[0].iov_base = &stamp;
+ iov[1].iov_len = cc;
+ iov[1].iov_base = buf;
+ if (writev(fileno(fp), &iov[0], 2) == -1)
+ err(1, "writev");
+}
+
+static void
+consume(FILE *fp, off_t len, char *buf, int reg)
+{
+ size_t l;
+
+ if (reg) {
+ if (fseeko(fp, len, SEEK_CUR) == -1)
+ err(1, NULL);
+ }
+ else {
+ while (len > 0) {
+ l = MIN(DEF_BUF, len);
+ if (fread(buf, sizeof(char), l, fp) != l)
+ err(1, "cannot read buffer");
+ len -= l;
+ }
+ }
+}
+
+#define swapstamp(stamp) do { \
+ if (stamp.scr_direction > 0xff) { \
+ stamp.scr_len = bswap64(stamp.scr_len); \
+ stamp.scr_sec = bswap64(stamp.scr_sec); \
+ stamp.scr_usec = bswap32(stamp.scr_usec); \
+ stamp.scr_direction = bswap32(stamp.scr_direction); \
+ } \
+} while (0/*CONSTCOND*/)
+
+static void
+playback(FILE *fp)
+{
+ struct timespec tsi, tso;
+ struct stamp stamp;
+ struct stat pst;
+ char buf[DEF_BUF];
+ off_t nread, save_len;
+ size_t l;
+ time_t tclock;
+ int reg;
+
+ if (fstat(fileno(fp), &pst) == -1)
+ err(1, "fstat failed");
+
+ reg = S_ISREG(pst.st_mode);
+
+ for (nread = 0; !reg || nread < pst.st_size; nread += save_len) {
+ if (fread(&stamp, sizeof(stamp), 1, fp) != 1) {
+ if (reg)
+ err(1, "reading playback header");
+ else
+ break;
+ }
+ swapstamp(stamp);
+ save_len = sizeof(stamp);
+
+ if (reg && stamp.scr_len >
+ (uint64_t)(pst.st_size - save_len) - nread)
+ errx(1, "invalid stamp");
+
+ save_len += stamp.scr_len;
+ tclock = stamp.scr_sec;
+ tso.tv_sec = stamp.scr_sec;
+ tso.tv_nsec = stamp.scr_usec * 1000;
+
+ switch (stamp.scr_direction) {
+ case 's':
+ if (!qflg)
+ (void)printf("Script started on %s",
+ ctime(&tclock));
+ tsi = tso;
+ (void)consume(fp, stamp.scr_len, buf, reg);
+ break;
+ case 'e':
+ if (!qflg)
+ (void)printf("\nScript done on %s",
+ ctime(&tclock));
+ (void)consume(fp, stamp.scr_len, buf, reg);
+ break;
+ case 'i':
+ /* throw input away */
+ (void)consume(fp, stamp.scr_len, buf, reg);
+ break;
+ case 'o':
+ tsi.tv_sec = tso.tv_sec - tsi.tv_sec;
+ tsi.tv_nsec = tso.tv_nsec - tsi.tv_nsec;
+ if (tsi.tv_nsec < 0) {
+ tsi.tv_sec -= 1;
+ tsi.tv_nsec += 1000000000;
+ }
+ if (usesleep)
+ (void)nanosleep(&tsi, NULL);
+ tsi = tso;
+ while (stamp.scr_len > 0) {
+ l = MIN(DEF_BUF, stamp.scr_len);
+ if (fread(buf, sizeof(char), l, fp) != l)
+ err(1, "cannot read buffer");
+
+ (void)write(STDOUT_FILENO, buf, l);
+ stamp.scr_len -= l;
+ }
+ break;
+ default:
+ errx(1, "invalid direction");
+ }
+ }
+ (void)fclose(fp);
+ exit(0);
+}
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index 334fb93..c80c833 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -325,6 +325,7 @@ gather_inet(int proto)
}
inp = &xtp->xt_inp;
so = &xtp->xt_socket;
+ protoname = xtp->xt_tp.t_flags & TF_TOE ? "toe" : "tcp";
break;
case IPPROTO_UDP:
case IPPROTO_DIVERT:
@@ -732,7 +733,7 @@ static void
usage(void)
{
fprintf(stderr,
- "Usage: sockstat [-46cLlu] [-p ports] [-P protocols]\n");
+ "Usage: sockstat [-46cLlu] [-j jid] [-p ports] [-P protocols]\n");
exit(1);
}
diff --git a/usr.bin/sort/Makefile b/usr.bin/sort/Makefile
index 162df21..ea68c45 100644
--- a/usr.bin/sort/Makefile
+++ b/usr.bin/sort/Makefile
@@ -2,26 +2,16 @@
.include <bsd.own.mk>
-.if ${MK_BSD_SORT} == "yes"
PROG= sort
-.else
-PROG= bsdsort
-CLEANFILES+= bsdsort.1
-
-bsdsort.1: sort.1
- cp ${.ALLSRC} ${.TARGET}
-.endif
SRCS= bwstring.c coll.c file.c mem.c radixsort.c sort.c vsort.c
-WARNS= 6
-
sort.1: sort.1.in
/usr/bin/sed ${MAN_SUB} ${.ALLSRC} >${.TARGET}
CLEANFILES+= sort.1
-.if !defined(WITHOUT_THREADS)
+.if defined(WITH_THREADS)
CFLAGS+= -DSORT_THREADS
LDFLAGS+= -lpthread -lmd
MAN_SUB+= -e 's|%%THREADS%%||g'
@@ -39,7 +29,7 @@ NLSSRCDIR_${lang}= ${.CURDIR}/nls
.endfor
.else
CFLAGS+= -DWITHOUT_NLS
-MAN_SUB+= -e 's|%%THREADS%%|\.\\"|g'
+MAN_SUB+= -e 's|%%NLS%%|\.\\"|g'
.endif
.include <bsd.prog.mk>
diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c
index 5733732..121aec8 100644
--- a/usr.bin/sort/bwstring.c
+++ b/usr.bin/sort/bwstring.c
@@ -69,7 +69,7 @@ initialise_months(void)
continue;
if (debug_sort)
printf("month[%d]=%s\n", i, tmp);
- len = strlen(tmp);
+ len = strlen((char*)tmp);
if (len < 1)
continue;
while (isblank(*tmp))
@@ -95,13 +95,13 @@ initialise_months(void)
continue;
if (debug_sort)
printf("month[%d]=%s\n", i, tmp);
- len = strlen(tmp);
+ len = strlen((char*)tmp);
if (len < 1)
continue;
while (isblank(*tmp))
++tmp;
m = sort_malloc(SIZEOF_WCHAR_STRING(len + 1));
- if (mbstowcs(m, tmp, len) == ((size_t) -1))
+ if (mbstowcs(m, (char*)tmp, len) == ((size_t) -1))
continue;
m[len] = L'\0';
for (unsigned int j = 0; j < len; j++)
@@ -421,7 +421,7 @@ bwsnocpy(struct bwstring *dst, const struct bwstring *src, size_t offset,
* The output is ended either with '\n' (nl == true)
* or '\0' (nl == false).
*/
-int
+size_t
bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended)
{
@@ -442,11 +442,11 @@ bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended)
} else {
wchar_t eols;
- int printed = 0;
+ size_t printed = 0;
eols = zero_ended ? btowc('\0') : btowc('\n');
- while (printed < (int) BWSLEN(bws)) {
+ while (printed < BWSLEN(bws)) {
const wchar_t *s = bws->data.wstr + printed;
if (*s == L'\0') {
@@ -479,7 +479,7 @@ bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended)
struct bwstring *
bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb)
{
- wchar_t eols;
+ wint_t eols;
eols = zero_ended ? btowc('\0') : btowc('\n');
@@ -494,7 +494,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb)
return (NULL);
}
if (*len > 0) {
- if (ret[*len - 1] == eols)
+ if (ret[*len - 1] == (wchar_t)eols)
--(*len);
}
return (bwssbdup(ret, *len));
@@ -513,11 +513,9 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb)
if (ret[*len - 1] == '\n')
--(*len);
}
- return (bwscsbdup(ret, *len));
+ return (bwscsbdup((unsigned char*)ret, *len));
} else {
- wchar_t c = 0;
-
*len = 0;
if (feof(f))
@@ -532,6 +530,8 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb)
if (MB_CUR_MAX == 1)
while (!feof(f)) {
+ int c;
+
c = fgetc(f);
if (c == EOF) {
@@ -553,6 +553,8 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb)
}
else
while (!feof(f)) {
+ wint_t c = 0;
+
c = fgetwc(f);
if (c == WEOF) {
@@ -750,7 +752,7 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset)
} else if (s2[i] == 0)
return (+1);
- res = strcoll(s1 + i, s2 + i);
+ res = strcoll((const char*)(s1 + i), (const char*)(s2 + i));
if (res)
return (res);
@@ -872,7 +874,7 @@ bwstod(struct bwstring *s0, bool *empty)
return (0);
}
- ret = strtod(s, &ep);
+ ret = strtod((char*)s, &ep);
if ((unsigned char*) ep == s) {
*empty = true;
return (0);
@@ -923,11 +925,11 @@ bws_month_score(const struct bwstring *s0)
while (isblank(*s) && s < end)
++s;
- len = strlen(s);
+ len = strlen((const char*)s);
for (int i = 11; i >= 0; --i) {
if (cmonths[i] &&
- (s == (unsigned char*)strstr(s, cmonths[i])))
+ (s == (unsigned char*)strstr((const char*)s, (char*)(cmonths[i]))))
return (i);
}
diff --git a/usr.bin/sort/bwstring.h b/usr.bin/sort/bwstring.h
index 828704f..7359523 100644
--- a/usr.bin/sort/bwstring.h
+++ b/usr.bin/sort/bwstring.h
@@ -93,7 +93,7 @@ struct bwstring *bwsnocpy(struct bwstring *dst, const struct bwstring *src, size
int bwscmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset);
int bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset, size_t len);
int bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset);
-int bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended);
+size_t bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended);
struct bwstring *bwsfgetln(FILE *file, size_t *len, bool zero_ended, struct reader_buffer *rb);
static inline bwstring_iterator
diff --git a/usr.bin/sort/coll.c b/usr.bin/sort/coll.c
index 6d2d293..a619fcf 100644
--- a/usr.bin/sort/coll.c
+++ b/usr.bin/sort/coll.c
@@ -47,11 +47,11 @@ __FBSDID("$FreeBSD$");
struct key_specs *keys;
size_t keys_num = 0;
-wchar_t symbol_decimal_point = L'.';
+wint_t symbol_decimal_point = L'.';
/* there is no default thousands separator in collate rules: */
-wchar_t symbol_thousands_sep = 0;
-wchar_t symbol_negative_sign = L'-';
-wchar_t symbol_positive_sign = L'+';
+wint_t symbol_thousands_sep = 0;
+wint_t symbol_negative_sign = L'-';
+wint_t symbol_positive_sign = L'+';
static int wstrcoll(struct key_value *kv1, struct key_value *kv2, size_t offset);
static int gnumcoll(struct key_value*, struct key_value *, size_t offset);
@@ -260,7 +260,7 @@ skip_fields_to_start(const struct bwstring *s, size_t fields, bool *empty_field)
while (cpos < BWSLEN(s)) {
bool isblank;
- isblank = iswblank(BWS_GET(s,cpos));
+ isblank = iswblank(BWS_GET(s, cpos));
if (isblank && !pb) {
--fields;
@@ -277,7 +277,7 @@ skip_fields_to_start(const struct bwstring *s, size_t fields, bool *empty_field)
size_t cpos = 0;
while (cpos < BWSLEN(s)) {
- if (BWS_GET(s,cpos) == sort_opts_vals.field_sep) {
+ if (BWS_GET(s,cpos) == (wchar_t)sort_opts_vals.field_sep) {
--fields;
if (fields <= 1)
return (cpos + 1);
@@ -328,7 +328,7 @@ find_field_end(const struct bwstring *s, struct key_specs *ks)
next_field_start = skip_fields_to_start(s, f2 + 1,
&empty_field);
if ((next_field_start > 0) && sort_opts_vals.tflag &&
- (sort_opts_vals.field_sep == BWS_GET(s,
+ ((wchar_t)sort_opts_vals.field_sep == BWS_GET(s,
next_field_start - 1)))
--next_field_start;
} else
@@ -699,7 +699,7 @@ static void setsuffix(wchar_t c, unsigned char *si)
* point is in sfrac, tail is the pointer to the remainder of the string.
*/
static int
-read_number(struct bwstring *s0, int *sign, wchar_t *smain, int *main_len, wchar_t *sfrac, int *frac_len, unsigned char *si)
+read_number(struct bwstring *s0, int *sign, wchar_t *smain, size_t *main_len, wchar_t *sfrac, size_t *frac_len, unsigned char *si)
{
bwstring_iterator s;
@@ -711,7 +711,7 @@ read_number(struct bwstring *s0, int *sign, wchar_t *smain, int *main_len, wchar
while (iswblank(bws_get_iter_value(s)))
s = bws_iterator_inc(s, 1);
- if (bws_get_iter_value(s) == symbol_negative_sign) {
+ if (bws_get_iter_value(s) == (wchar_t)symbol_negative_sign) {
*sign = -1;
s = bws_iterator_inc(s, 1);
}
@@ -727,7 +727,7 @@ read_number(struct bwstring *s0, int *sign, wchar_t *smain, int *main_len, wchar
s = bws_iterator_inc(s, 1);
*main_len += 1;
} else if (symbol_thousands_sep &&
- (bws_get_iter_value(s) == symbol_thousands_sep))
+ (bws_get_iter_value(s) == (wchar_t)symbol_thousands_sep))
s = bws_iterator_inc(s, 1);
else
break;
@@ -735,7 +735,7 @@ read_number(struct bwstring *s0, int *sign, wchar_t *smain, int *main_len, wchar
smain[*main_len] = 0;
- if (bws_get_iter_value(s) == symbol_decimal_point) {
+ if (bws_get_iter_value(s) == (wchar_t)symbol_decimal_point) {
s = bws_iterator_inc(s, 1);
while (iswdigit(bws_get_iter_value(s)) &&
*frac_len < MAX_NUM_SIZE) {
@@ -792,12 +792,14 @@ cmpsuffix(unsigned char si1, unsigned char si2)
* Implements numeric sort for -n and -h.
*/
static int
-numcoll_impl(struct key_value *kv1, struct key_value *kv2, size_t offset, bool use_suffix)
+numcoll_impl(struct key_value *kv1, struct key_value *kv2,
+ size_t offset __unused, bool use_suffix)
{
struct bwstring *s1, *s2;
wchar_t sfrac1[MAX_NUM_SIZE + 1], sfrac2[MAX_NUM_SIZE + 1];
wchar_t smain1[MAX_NUM_SIZE + 1], smain2[MAX_NUM_SIZE + 1];
- int cmp_res, frac1, frac2, main1, main2, sign1, sign2;
+ int cmp_res, sign1, sign2;
+ size_t frac1, frac2, main1, main2;
unsigned char SI1, SI2;
bool e1, e2, key1_read, key2_read;
@@ -810,8 +812,6 @@ numcoll_impl(struct key_value *kv1, struct key_value *kv2, size_t offset, bool u
cmp_res = 0;
key1_read = key2_read = false;
- UNUSED_ARG(offset);
-
if (debug_sort) {
bwsprintf(stdout, s1, "; k1=<", ">");
bwsprintf(stdout, s2, ", k2=<", ">");
@@ -968,14 +968,13 @@ hnumcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
* Implements random sort (-R).
*/
static int
-randomcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
+randomcoll(struct key_value *kv1, struct key_value *kv2,
+ size_t offset __unused)
{
struct bwstring *s1, *s2;
MD5_CTX ctx1, ctx2;
char *b1, *b2;
- UNUSED_ARG(offset);
-
s1 = kv1->k;
s2 = kv2->k;
@@ -1022,12 +1021,11 @@ randomcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
* Implements version sort (-V).
*/
static int
-versioncoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
+versioncoll(struct key_value *kv1, struct key_value *kv2,
+ size_t offset __unused)
{
struct bwstring *s1, *s2;
- UNUSED_ARG(offset);
-
s1 = kv1->k;
s2 = kv2->k;
@@ -1098,7 +1096,8 @@ cmp_nans(double d1, double d2)
* Implements general numeric sort (-g).
*/
static int
-gnumcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
+gnumcoll(struct key_value *kv1, struct key_value *kv2,
+ size_t offset __unused)
{
double d1, d2;
int err1, err2;
@@ -1108,8 +1107,6 @@ gnumcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
err1 = err2 = 0;
key1_read = key2_read = false;
- UNUSED_ARG(offset);
-
if (debug_sort) {
bwsprintf(stdout, kv1->k, "; k1=<", ">");
bwsprintf(stdout, kv2->k, "; k2=<", ">");
@@ -1256,7 +1253,7 @@ gnumcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
* Implements month sort (-M).
*/
static int
-monthcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
+monthcoll(struct key_value *kv1, struct key_value *kv2, size_t offset __unused)
{
int val1, val2;
bool key1_read, key2_read;
@@ -1264,8 +1261,6 @@ monthcoll(struct key_value *kv1, struct key_value *kv2, size_t offset)
val1 = val2 = 0;
key1_read = key2_read = false;
- UNUSED_ARG(offset);
-
if (debug_sort) {
bwsprintf(stdout, kv1->k, "; k1=<", ">");
bwsprintf(stdout, kv2->k, "; k2=<", ">");
diff --git a/usr.bin/sort/coll.h b/usr.bin/sort/coll.h
index c020e74..a3ceaaf 100644
--- a/usr.bin/sort/coll.h
+++ b/usr.bin/sort/coll.h
@@ -133,12 +133,12 @@ extern struct key_specs *keys;
extern size_t keys_num;
/*
- * Main localised symbols
+ * Main localised symbols. These must be wint_t as they may hold WEOF.
*/
-extern wchar_t symbol_decimal_point;
-extern wchar_t symbol_thousands_sep;
-extern wchar_t symbol_negative_sign;
-extern wchar_t symbol_positive_sign;
+extern wint_t symbol_decimal_point;
+extern wint_t symbol_thousands_sep;
+extern wint_t symbol_negative_sign;
+extern wint_t symbol_positive_sign;
/* funcs */
diff --git a/usr.bin/sort/file.c b/usr.bin/sort/file.c
index 68c3f54..2d185e4 100644
--- a/usr.bin/sort/file.c
+++ b/usr.bin/sort/file.c
@@ -229,7 +229,7 @@ read_file0_line(struct file0_reader *f0r)
char *
new_tmp_file_name(void)
{
- static unsigned int tfcounter = 0;
+ static size_t tfcounter = 0;
static const char *fn = ".bsdsort.";
char *ret;
size_t sz;
@@ -237,7 +237,7 @@ new_tmp_file_name(void)
sz = strlen(tmpdir) + 1 + strlen(fn) + 32 + 1;
ret = sort_malloc(sz);
- sprintf(ret, "%s/%s%d.%u", tmpdir, fn, (int) getpid(), tfcounter++);
+ sprintf(ret, "%s/%s%d.%lu", tmpdir, fn, (int) getpid(), (unsigned long)(tfcounter++));
tmp_file_atexit(ret);
return (ret);
}
@@ -300,7 +300,7 @@ file_list_clean(struct file_list *fl)
if (fl) {
if (fl->fns) {
- int i;
+ size_t i;
for (i = 0; i < fl->count; i++) {
if (fl->fns[i]) {
@@ -345,7 +345,7 @@ sort_list_add(struct sort_list *l, struct bwstring *str)
size_t indx = l->count;
if ((l->list == NULL) || (indx >= l->size)) {
- int newsize = (l->size + 1) + 1024;
+ size_t newsize = (l->size + 1) + 1024;
l->list = sort_realloc(l->list,
sizeof(struct sort_list_item*) * newsize);
@@ -439,7 +439,8 @@ check(const char *fn)
struct bwstring *s1, *s2, *s1disorder, *s2disorder;
struct file_reader *fr;
struct keys_array *ka1, *ka2;
- int res, pos, posdisorder;
+ int res;
+ size_t pos, posdisorder;
s1 = s2 = s1disorder = s2disorder = NULL;
ka1 = ka2 = NULL;
@@ -979,7 +980,7 @@ file_header_close(struct file_header **fh)
* Swap two array elements
*/
static void
-file_header_swap(struct file_header **fh, int i1, int i2)
+file_header_swap(struct file_header **fh, size_t i1, size_t i2)
{
struct file_header *tmp;
@@ -995,11 +996,11 @@ file_header_swap(struct file_header **fh, int i1, int i2)
* "Raises" last element to its right place
*/
static void
-file_header_heap_swim(struct file_header **fh, int indx)
+file_header_heap_swim(struct file_header **fh, size_t indx)
{
if (indx > 0) {
- int parent_index;
+ size_t parent_index;
parent_index = (indx - 1) >> 1;
@@ -1015,16 +1016,16 @@ file_header_heap_swim(struct file_header **fh, int indx)
* Sink the top element to its correct position
*/
static void
-file_header_heap_sink(struct file_header **fh, int indx, int size)
+file_header_heap_sink(struct file_header **fh, size_t indx, size_t size)
{
- int left_child_index;
- int right_child_index;
+ size_t left_child_index;
+ size_t right_child_index;
left_child_index = indx + indx + 1;
right_child_index = left_child_index + 1;
if (left_child_index < size) {
- int min_child_index;
+ size_t min_child_index;
min_child_index = left_child_index;
@@ -1045,7 +1046,7 @@ file_header_heap_sink(struct file_header **fh, int indx, int size)
* Adds element to the "left" end
*/
static void
-file_header_list_rearrange_from_header(struct file_header **fh, int size)
+file_header_list_rearrange_from_header(struct file_header **fh, size_t size)
{
file_header_heap_sink(fh, 0, size);
@@ -1055,7 +1056,7 @@ file_header_list_rearrange_from_header(struct file_header **fh, int size)
* Adds element to the "right" end
*/
static void
-file_header_list_push(struct file_header *f, struct file_header **fh, int size)
+file_header_list_push(struct file_header *f, struct file_header **fh, size_t size)
{
fh[size++] = f;
@@ -1118,10 +1119,10 @@ file_header_read_next(struct file_header *fh)
* Merge array of "files headers"
*/
static void
-file_headers_merge(int fnum, struct file_header **fh, FILE *f_out)
+file_headers_merge(size_t fnum, struct file_header **fh, FILE *f_out)
{
struct last_printed lp;
- int i;
+ size_t i;
memset(&lp, 0, sizeof(lp));
@@ -1149,13 +1150,13 @@ file_headers_merge(int fnum, struct file_header **fh, FILE *f_out)
* stdout.
*/
static void
-merge_files_array(int argc, char **argv, const char *fn_out)
+merge_files_array(size_t argc, char **argv, const char *fn_out)
{
if (argv && fn_out) {
struct file_header **fh;
FILE *f_out;
- int i;
+ size_t i;
f_out = openfile(fn_out, "w");
@@ -1189,12 +1190,12 @@ shrink_file_list(struct file_list *fl)
return (0);
else {
struct file_list new_fl;
- int indx = 0;
+ size_t indx = 0;
file_list_init(&new_fl, true);
while (indx < fl->count) {
char *fnew;
- int num;
+ size_t num;
num = fl->count - indx;
fnew = new_tmp_file_name();
@@ -1203,7 +1204,7 @@ shrink_file_list(struct file_list *fl)
num = max_open_files - 1;
merge_files_array(num, fl->fns + indx, fnew);
if (fl->tmp) {
- int i;
+ size_t i;
for (i = 0; i < num; i++)
unlink(fl->fns[indx + i]);
@@ -1297,7 +1298,7 @@ sort_list_to_file(struct sort_list *list, const char *outfile)
}
if (sort_opts_vals.sort_method == SORT_DEFAULT)
- sort_opts_vals.sort_method = SORT_QSORT;
+ sort_opts_vals.sort_method = DEFAULT_SORT_ALGORITHM;
if (debug_sort)
printf("sort_method=%s\n",
@@ -1314,9 +1315,12 @@ sort_list_to_file(struct sort_list *list, const char *outfile)
case SORT_HEAPSORT:
mt_sort(list, heapsort, outfile);
break;
- default:
+ case SORT_QSORT:
mt_sort(list, sort_qsort, outfile);
break;
+ default:
+ mt_sort(list, DEFAULT_SORT_FUNC, outfile);
+ break;
}
}
@@ -1376,7 +1380,7 @@ sub_list_cmp(struct sort_list *l1, struct sort_list *l2)
* Swap two array elements
*/
static void
-sub_list_swap(struct sort_list **sl, int i1, int i2)
+sub_list_swap(struct sort_list **sl, size_t i1, size_t i2)
{
struct sort_list *tmp;
@@ -1392,11 +1396,11 @@ sub_list_swap(struct sort_list **sl, int i1, int i2)
* "Raises" last element to its right place
*/
static void
-sub_list_swim(struct sort_list **sl, int indx)
+sub_list_swim(struct sort_list **sl, size_t indx)
{
if (indx > 0) {
- int parent_index;
+ size_t parent_index;
parent_index = (indx - 1) >> 1;
@@ -1412,16 +1416,16 @@ sub_list_swim(struct sort_list **sl, int indx)
* Sink the top element to its correct position
*/
static void
-sub_list_sink(struct sort_list **sl, int indx, int size)
+sub_list_sink(struct sort_list **sl, size_t indx, size_t size)
{
- int left_child_index;
- int right_child_index;
+ size_t left_child_index;
+ size_t right_child_index;
left_child_index = indx + indx + 1;
right_child_index = left_child_index + 1;
if (left_child_index < size) {
- int min_child_index;
+ size_t min_child_index;
min_child_index = left_child_index;
@@ -1442,7 +1446,7 @@ sub_list_sink(struct sort_list **sl, int indx, int size)
* Adds element to the "right" end
*/
static void
-sub_list_push(struct sort_list *s, struct sort_list **sl, int size)
+sub_list_push(struct sort_list *s, struct sort_list **sl, size_t size)
{
sl[size++] = s;
diff --git a/usr.bin/sort/file.h b/usr.bin/sort/file.h
index 47c2299..8e95fdb 100644
--- a/usr.bin/sort/file.h
+++ b/usr.bin/sort/file.h
@@ -39,6 +39,9 @@
#define SORT_HEAPSORT 3
#define SORT_RADIXSORT 4
+#define DEFAULT_SORT_ALGORITHM SORT_HEAPSORT
+#define DEFAULT_SORT_FUNC heapsort
+
/*
* List of data to be sorted.
*/
@@ -62,8 +65,8 @@ struct file_reader;
struct file_list
{
char **fns;
- int count;
- int sz;
+ size_t count;
+ size_t sz;
bool tmp;
};
diff --git a/usr.bin/sort/radixsort.c b/usr.bin/sort/radixsort.c
index ccaa994..b370723 100644
--- a/usr.bin/sort/radixsort.c
+++ b/usr.bin/sort/radixsort.c
@@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
#include "coll.h"
#include "radixsort.h"
+#define DEFAULT_SORT_FUNC_RADIXSORT mergesort
+
#define TINY_NODE(sl) ((sl)->tosort_num < 65)
#define SMALL_NODE(sl) ((sl)->tosort_num < 5)
@@ -201,7 +203,7 @@ pop_ls_mt(void)
}
static void
-add_to_sublevel(struct sort_level *sl, struct sort_list_item *item, int indx)
+add_to_sublevel(struct sort_level *sl, struct sort_list_item *item, size_t indx)
{
struct sort_level *ssl;
@@ -349,7 +351,7 @@ run_sort_level_next(struct sort_level *sl)
/* NOTREACHED */
err(2, "Radix sort error 3");
} else
- qsort(sl->leaves, sl->leaves_num,
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
sizeof(struct sort_list_item *),
(int(*)(const void *, const void *)) func);
@@ -389,12 +391,12 @@ run_sort_level_next(struct sort_level *sl)
sizeof(struct sort_list_item *),
(int(*)(const void *, const void *)) list_coll);
} else {
- qsort(sl->leaves, sl->leaves_num,
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
sizeof(struct sort_list_item *),
(int(*)(const void *, const void *)) list_coll);
}
} else if (!sort_opts_vals.sflag && sort_opts_vals.complex_sort) {
- qsort(sl->leaves, sl->leaves_num,
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
sizeof(struct sort_list_item *),
(int(*)(const void *, const void *)) list_coll_by_str_only);
}
@@ -541,12 +543,12 @@ run_top_sort_level(struct sort_level *sl)
sizeof(struct sort_list_item *),
(int(*)(const void *, const void *)) list_coll);
} else {
- qsort(sl->leaves, sl->leaves_num,
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
sizeof(struct sort_list_item *),
(int(*)(const void *, const void *)) list_coll);
}
} else if (!sort_opts_vals.sflag && sort_opts_vals.complex_sort) {
- qsort(sl->leaves, sl->leaves_num,
+ DEFAULT_SORT_FUNC_RADIXSORT(sl->leaves, sl->leaves_num,
sizeof(struct sort_list_item *),
(int(*)(const void *, const void *)) list_coll_by_str_only);
}
diff --git a/usr.bin/sort/sort.1.in b/usr.bin/sort/sort.1.in
index 8980061..6dd7657 100644
--- a/usr.bin/sort/sort.1.in
+++ b/usr.bin/sort/sort.1.in
@@ -33,7 +33,7 @@
.\"
.\" @(#)sort.1 8.1 (Berkeley) 6/6/93
.\"
-.Dd May 25, 2012
+.Dd July 3, 2012
.Dt SORT 1
.Os
.Sh NAME
@@ -313,8 +313,8 @@ without arguments.
When called with argument
.Fl d
it must decompress standard input to standard output.
-If PROGRAM fails,
-.Nm
+If PROGRAM fails,
+.Nm
must exit with error.
An example of PROGRAM that can be used here is bzip2.
.It Fl Fl random-source Ns = Ns Ar filename
@@ -329,7 +329,7 @@ is used.
.It Fl Fl debug
Print some extra information about the sorting process to the
standard output.
-%%THREADS%%.It Fl Fl nthreads
+%%THREADS%%.It Fl Fl parallel
%%THREADS%%Set the maximum number of execution threads.
%%THREADS%%Default number equals to the number of CPUs.
.It Fl Fl files0-from Ns = Ns Ar filename
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index dd0ed68..9277de0 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -91,7 +91,7 @@ const char *nlsstr[] = { "",
"[--heapsort] [--mergesort] [--radixsort] [--qsort] "
"[--mmap] "
#if defined(SORT_THREADS)
- "[--nthreads thread_no] "
+ "[--parallel thread_no] "
#endif
"[--human-numeric-sort] "
"[--version-sort] [--random-sort [--random-source file]] "
@@ -117,7 +117,7 @@ static bool print_symbols_on_debug;
/*
* Arguments from file (when file0-from option is used:
*/
-static int argc_from_file0 = -1;
+static size_t argc_from_file0 = (size_t)-1;
static char **argv_from_file0;
/*
@@ -132,7 +132,7 @@ enum
VERSION_OPT,
DEBUG_OPT,
#if defined(SORT_THREADS)
- NTHREADS_OPT,
+ PARALLEL_OPT,
#endif
RANDOMSOURCE_OPT,
COMPRESSPROGRAM_OPT,
@@ -146,7 +146,7 @@ enum
#define NUMBER_OF_MUTUALLY_EXCLUSIVE_FLAGS 6
static const char mutually_exclusive_flags[NUMBER_OF_MUTUALLY_EXCLUSIVE_FLAGS] = { 'M', 'n', 'g', 'R', 'h', 'V' };
-struct option long_options[] = {
+static struct option long_options[] = {
{ "batch-size", required_argument, NULL, BS_OPT },
{ "buffer-size", required_argument, NULL, 'S' },
{ "check", optional_argument, NULL, 'c' },
@@ -171,7 +171,7 @@ struct option long_options[] = {
{ "numeric-sort", no_argument, NULL, 'n' },
{ "output", required_argument, NULL, 'o' },
#if defined(SORT_THREADS)
- { "nthreads", required_argument, NULL, NTHREADS_OPT },
+ { "parallel", required_argument, NULL, PARALLEL_OPT },
#endif
{ "qsort", no_argument, NULL, QSORT_OPT },
{ "radixsort", no_argument, NULL, RADIXSORT_OPT },
@@ -244,9 +244,9 @@ read_fns_from_file0(const char *fn)
char *line = read_file0_line(&f0r);
if (line && *line) {
+ if (argc_from_file0 == (size_t)-1)
+ argc_from_file0 = 0;
++argc_from_file0;
- if (argc_from_file0 < 1)
- argc_from_file0 = 1;
argv_from_file0 = sort_realloc(argv_from_file0,
argc_from_file0 * sizeof(char *));
if (argv_from_file0 == NULL)
@@ -1119,7 +1119,7 @@ main(int argc, char **argv)
}
break;
#if defined(SORT_THREADS)
- case NTHREADS_OPT:
+ case PARALLEL_OPT:
nthreads = (size_t)(atoi(optarg));
if (nthreads < 1)
nthreads = 1;
@@ -1221,7 +1221,7 @@ main(int argc, char **argv)
ks->sm.func = get_sort_func(&(ks->sm));
}
- if (argc_from_file0 >= 0) {
+ if (argv_from_file0) {
argc = argc_from_file0;
argv = argv_from_file0;
}
diff --git a/usr.bin/sort/sort.h b/usr.bin/sort/sort.h
index f6505c9..f5b48bd 100644
--- a/usr.bin/sort/sort.h
+++ b/usr.bin/sort/sort.h
@@ -41,8 +41,6 @@
#define VERSION "2.3-FreeBSD"
-#define UNUSED_ARG(A) do { A=A; } while(0)
-
#ifdef WITHOUT_NLS
#define getstr(n) nlsstr[n]
#else
@@ -79,7 +77,7 @@ extern MD5_CTX md5_ctx;
*/
struct sort_opts
{
- wchar_t field_sep;
+ wint_t field_sep;
int sort_method;
bool cflag;
bool csilentflag;
diff --git a/usr.bin/ssh-copy-id/Makefile b/usr.bin/ssh-copy-id/Makefile
new file mode 100644
index 0000000..033c435
--- /dev/null
+++ b/usr.bin/ssh-copy-id/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+SCRIPTS= ssh-copy-id.sh
+MAN= ssh-copy-id.1
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.1 b/usr.bin/ssh-copy-id/ssh-copy-id.1
new file mode 100644
index 0000000..2b2bbc2
--- /dev/null
+++ b/usr.bin/ssh-copy-id/ssh-copy-id.1
@@ -0,0 +1,80 @@
+.\"-
+.\" Copyright (c) 2012 Eitan Adler
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 3, 2012
+.Dt SSH-COPY-ID 1
+.Os
+.Sh NAME
+.Nm ssh-copy-id
+.Nd copy public keys to a remote host
+.Sh SYNOPSIS
+.Nm
+.Op Fl l
+.Op Fl i Ar keyfile
+.Op Fl o Ar option
+.Op Fl p Ar port
+.Oo Ar user Ns @ Oc Ns Ar hostname
+.Sh DESCRIPTION
+The
+.Nm
+utility copies public keys to a remote host's
+.Pa authorized_keys
+file.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl i Ar file
+Copy the key contained in
+.Ar file .
+This option can be specified multiple times and can be combined with
+the
+.Fl l
+option.
+.It Fl l
+Copy the keys currently held by
+.Xr ssh-agent 1 .
+This is the default if the
+.Fl i
+option was not specified.
+.It Fl o Ar ssh-option
+Pass this option directly to
+.Xr ssh 1 .
+This option can be specified multiple times.
+.It Fl p Ar port
+Connect to the specified port on the remote host instead of the
+default.
+.El
+.Pp
+The remaining arguments are a list of remote hosts to connect to,
+each one optionally qualified by a user name.
+.Sh HISTORY
+The
+.Nm
+utility was written by
+.An Eitan Adler Aq eadler@FreeBSD.org
+as a drop-in replacement for an existing utility included with
+OpenSSH.
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.sh b/usr.bin/ssh-copy-id/ssh-copy-id.sh
new file mode 100755
index 0000000..8f087d3
--- /dev/null
+++ b/usr.bin/ssh-copy-id/ssh-copy-id.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+#-
+# Copyright (c) 2012 Eitan Adler
+# All rights reserved.
+#
+# 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
+# in this position and unchanged.
+# 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.
+#
+# $FreeBSD$
+
+usage() {
+ echo "usage: ssh-copy-id [-l] [-i keyfile] [-o option] [-p port] [user@]hostname" >&2
+ exit 1
+}
+
+sendkey() {
+ local h="$1"
+ shift 1
+ local k="$@"
+ echo "$k" | ssh $port -S none $options "$user$h" /bin/sh -c \''
+ set -e;
+ umask 077;
+ keyfile=$HOME/.ssh/authorized_keys ;
+ mkdir -p $HOME/.ssh/ ;
+ while read alg key comment ; do
+ if ! grep -sqwF "$key" "$keyfile"; then
+ echo "$alg $key $comment" |
+ tee -a "$keyfile" >/dev/null ;
+ fi ;
+ done
+ '\'
+}
+
+agentKeys() {
+ keys="$(ssh-add -L | grep -v 'The agent has no identities.')$nl$keys"
+}
+
+keys=""
+host=""
+hasarg=""
+user=""
+port=""
+nl="
+"
+options=""
+
+while getopts 'i:lo:p:' arg; do
+ case $arg in
+ i)
+ hasarg="x"
+ if [ -f "$OPTARG" ]; then
+ keys="$(cat $OPTARG)$nl$keys"
+ fi
+ ;;
+ l)
+ hasarg="x"
+ agentKeys
+ ;;
+ p)
+ port="-p $OPTARG"
+ ;;
+ o)
+ options="$options -o '$OPTARG'"
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done >&2
+
+shift $((OPTIND-1))
+
+if [ -z "$hasarg" ]; then
+ agentKeys
+fi
+if [ -z "$keys" -o "$keys" = "$nl" ]; then
+ echo "no keys found" >&2
+ exit 1
+fi
+if [ -z "$@" ]; then
+ usage
+fi
+
+for host in "$@"; do
+ sendkey "$host" "$keys"
+done
diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c
index 31e2bd9..984ec7b 100644
--- a/usr.bin/stat/stat.c
+++ b/usr.bin/stat/stat.c
@@ -189,8 +189,8 @@ int format1(const struct stat *, /* stat info */
char *xfflagstostr(unsigned long);
#endif
-const char *timefmt;
-int linkfail;
+static const char *timefmt;
+static int linkfail;
#define addchar(s, c, nl) \
do { \
diff --git a/usr.bin/stdbuf/Makefile b/usr.bin/stdbuf/Makefile
index ccf139d..8842a1f 100644
--- a/usr.bin/stdbuf/Makefile
+++ b/usr.bin/stdbuf/Makefile
@@ -3,6 +3,4 @@
PROG= stdbuf
SRCS= stdbuf.c
-WARNS?= 6
-
.include <bsd.prog.mk>
diff --git a/usr.bin/systat/cmds.c b/usr.bin/systat/cmds.c
index 6ad7443..46b3931 100644
--- a/usr.bin/systat/cmds.c
+++ b/usr.bin/systat/cmds.c
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
static const char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95";
#endif
+#include <sys/param.h>
+
#include <ctype.h>
#include <signal.h>
#include <stdlib.h>
@@ -49,10 +51,9 @@ command(const char *cmd)
{
struct cmdtab *p;
char *cp, *tmpstr, *tmpstr1;
- int interval, omask;
+ double t;
tmpstr = tmpstr1 = strdup(cmd);
- omask = sigblock(sigmask(SIGALRM));
for (cp = tmpstr1; *cp && !isspace(*cp); cp++)
;
if (*cp)
@@ -68,7 +69,7 @@ command(const char *cmd)
goto done;
}
if (strcmp(tmpstr1, "stop") == 0) {
- alarm(0);
+ delay = 0;
mvaddstr(CMDLINE, 0, "Refresh disabled.");
clrtoeol();
goto done;
@@ -88,19 +89,23 @@ command(const char *cmd)
clrtoeol();
goto done;
}
- interval = atoi(tmpstr1);
- if (interval <= 0 &&
- (strcmp(tmpstr1, "start") == 0 || strcmp(tmpstr1, "interval") == 0)) {
- interval = *cp ? atoi(cp) : naptime;
- if (interval <= 0) {
- error("%d: bad interval.", interval);
- goto done;
+ t = strtod(tmpstr1, NULL) * 1000000.0;
+ if (t > 0 && t < (double)UINT_MAX)
+ delay = (unsigned int)t;
+ if ((t <= 0 || t > (double)UINT_MAX) &&
+ (strcmp(tmpstr1, "start") == 0 ||
+ strcmp(tmpstr1, "interval") == 0)) {
+ if (*cp != '\0') {
+ t = strtod(cp, NULL) * 1000000.0;
+ if (t <= 0 || t >= (double)UINT_MAX) {
+ error("%d: bad interval.", (int)t);
+ goto done;
+ }
}
}
- if (interval > 0) {
- alarm(0);
- naptime = interval;
- display(0);
+ if (t > 0) {
+ delay = (unsigned int)t;
+ display();
status();
goto done;
}
@@ -112,7 +117,6 @@ command(const char *cmd)
if (p) {
if (curcmd == p)
goto done;
- alarm(0);
(*curcmd->c_close)(wnd);
curcmd->c_flags &= ~CF_INIT;
wnd = (*p->c_open)();
@@ -133,14 +137,13 @@ command(const char *cmd)
}
curcmd = p;
labels();
- display(0);
+ display();
status();
goto done;
}
if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(tmpstr1, cp))
error("%s: Unknown command.", tmpstr1);
done:
- sigsetmask(omask);
free(tmpstr);
}
@@ -177,7 +180,7 @@ status(void)
{
error("Showing %s, refresh every %d seconds.",
- curcmd->c_name, naptime);
+ curcmd->c_name, delay / 1000000);
}
int
diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h
index 9ab8a3a..393fa1c 100644
--- a/usr.bin/systat/extern.h
+++ b/usr.bin/systat/extern.h
@@ -49,11 +49,12 @@ extern int CMDLINE;
extern int dk_ndrive;
extern int hz, stathz;
extern double hertz; /* sampling frequency for cp_time and dk_time */
-extern int naptime, col;
+extern int col;
extern int nhosts;
extern int nports;
extern int protos;
extern int verbose;
+extern unsigned int delay;
struct inpcb;
@@ -87,7 +88,7 @@ int cmdnetstat(const char *, const char *);
struct cmdtab *lookup(const char *);
void command(const char *);
void die(int);
-void display(int);
+void display(void);
int dkinit(void);
int dkcmd(char *, char *);
void error(const char *fmt, ...) __printflike(1, 2);
diff --git a/usr.bin/systat/icmp.c b/usr.bin/systat/icmp.c
index e3a5280..6085a90 100644
--- a/usr.bin/systat/icmp.c
+++ b/usr.bin/systat/icmp.c
@@ -138,7 +138,7 @@ domode(struct icmpstat *ret)
switch(currentmode) {
case display_RATE:
sub = &oldstat;
- divisor = naptime;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
break;
case display_DELTA:
sub = &oldstat;
diff --git a/usr.bin/systat/icmp6.c b/usr.bin/systat/icmp6.c
index 366d026..2a3bbb7 100644
--- a/usr.bin/systat/icmp6.c
+++ b/usr.bin/systat/icmp6.c
@@ -137,7 +137,7 @@ domode(struct icmp6stat *ret)
switch(currentmode) {
case display_RATE:
sub = &oldstat;
- divisor = naptime;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
break;
case display_DELTA:
sub = &oldstat;
diff --git a/usr.bin/systat/ifstat.c b/usr.bin/systat/ifstat.c
index fc853b0..3e45499 100644
--- a/usr.bin/systat/ifstat.c
+++ b/usr.bin/systat/ifstat.c
@@ -247,8 +247,7 @@ fetchifstat(void)
old_outb = ifp->if_mib.ifmd_data.ifi_obytes;
ifp->tv_lastchanged = ifp->if_mib.ifmd_data.ifi_lastchange;
- if (gettimeofday(&new_tv, (struct timezone *)0) != 0)
- IFSTAT_ERR(2, "error getting time of day");
+ (void)gettimeofday(&new_tv, NULL);
(void)getifmibdata(ifp->if_row, &ifp->if_mib);
new_inb = ifp->if_mib.ifmd_data.ifi_ibytes;
diff --git a/usr.bin/systat/ip.c b/usr.bin/systat/ip.c
index cad79b7..8e12a6a 100644
--- a/usr.bin/systat/ip.c
+++ b/usr.bin/systat/ip.c
@@ -146,7 +146,7 @@ domode(struct stat *ret)
switch(currentmode) {
case display_RATE:
sub = &oldstat;
- divisor = naptime;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
break;
case display_DELTA:
sub = &oldstat;
diff --git a/usr.bin/systat/ip6.c b/usr.bin/systat/ip6.c
index 4702885..5d2c210 100644
--- a/usr.bin/systat/ip6.c
+++ b/usr.bin/systat/ip6.c
@@ -142,7 +142,7 @@ domode(struct ip6stat *ret)
switch(currentmode) {
case display_RATE:
sub = &oldstat;
- divisor = naptime;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
break;
case display_DELTA:
sub = &oldstat;
diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c
index e7e0014..d6d793a 100644
--- a/usr.bin/systat/keyboard.c
+++ b/usr.bin/systat/keyboard.c
@@ -35,88 +35,146 @@ __FBSDID("$FreeBSD$");
static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93";
#endif
+#include <sys/select.h>
+#include <sys/time.h>
+
#include <errno.h>
#include <ctype.h>
-#include <signal.h>
#include <stdlib.h>
#include <termios.h>
+#include <unistd.h>
#include "systat.h"
#include "extern.h"
+static char line[80];
+static int keyboard_dispatch(int ch);
+
int
keyboard(void)
{
- char line[80];
- int ch, oldmask;
+ int ch, n;
+ struct timeval last, intvl, now, tm;
+ fd_set rfds;
+ /* Set initial timings */
+ gettimeofday(&last, NULL);
+ intvl.tv_sec = delay / 1000000;
+ intvl.tv_usec = delay % 1000000;
for (;;) {
col = 0;
move(CMDLINE, 0);
- do {
- refresh();
- ch = getch();
- if (ch == ERR) {
- if (errno == EINTR)
- continue;
- exit(1);
+ for (;;) {
+ /* Determine interval to sleep */
+ (void)gettimeofday(&now, NULL);
+ tm.tv_sec = last.tv_sec + intvl.tv_sec - now.tv_sec;
+ tm.tv_usec = last.tv_usec + intvl.tv_usec - now.tv_usec;
+ while (tm.tv_usec < 0) {
+ tm.tv_usec += 1000000;
+ tm.tv_sec--;
}
- if (ch >= 'A' && ch <= 'Z')
- ch += 'a' - 'A';
- if (col == 0) {
-#define mask(s) (1 << ((s) - 1))
- if (ch == CTRL('l')) {
- oldmask = sigblock(mask(SIGALRM));
- wrefresh(curscr);
- sigsetmask(oldmask);
- continue;
- }
- if (ch == CTRL('g')) {
- oldmask = sigblock(mask(SIGALRM));
- status();
- sigsetmask(oldmask);
- continue;
- }
- if (ch != ':')
- continue;
- move(CMDLINE, 0);
- clrtoeol();
+ while (tm.tv_usec >= 1000000) {
+ tm.tv_usec -= 1000000;
+ tm.tv_sec++;
}
- if (ch == erasechar() && col > 0) {
- if (col == 1 && line[0] == ':')
- continue;
- col--;
- goto doerase;
- }
- if (ch == CTRL('w') && col > 0) {
- while (--col >= 0 && isspace(line[col]))
- ;
- col++;
- while (--col >= 0 && !isspace(line[col]))
- if (col == 0 && line[0] == ':')
- break;
- col++;
- goto doerase;
- }
- if (ch == killchar() && col > 0) {
- col = 0;
- if (line[0] == ':')
- col++;
- doerase:
- move(CMDLINE, col);
- clrtoeol();
+ if (tm.tv_sec < 0) {
+ /* We have to update screen immediately */
+ display();
+ gettimeofday(&last, NULL);
continue;
}
- if (isprint(ch) || ch == ' ') {
- line[col] = ch;
- mvaddch(CMDLINE, col, ch);
- col++;
+
+ /* Prepare select */
+ FD_ZERO(&rfds);
+ FD_SET(STDIN_FILENO, &rfds);
+ n = select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tm);
+
+ if (n > 0) {
+ /* Read event on stdin */
+ ch = getch();
+
+ if (keyboard_dispatch(ch) == 0) {
+ refresh();
+ continue;
+ }
+
+ line[col] = '\0';
+ command(line + 1);
+ /* Refresh delay */
+ intvl.tv_sec = delay / 1000000;
+ intvl.tv_usec = delay % 1000000;
+ refresh();
+ break;
}
- } while (col == 0 || (ch != '\r' && ch != '\n'));
- line[col] = '\0';
- oldmask = sigblock(mask(SIGALRM));
- command(line + 1);
- sigsetmask(oldmask);
+
+ if (n < 0 && errno != EINTR)
+ exit(1);
+
+ /* Timeout or signal. Call display another time */
+ display();
+ gettimeofday(&last, NULL);
+ }
}
- /*NOTREACHED*/
+}
+
+static int
+keyboard_dispatch(int ch)
+{
+
+ if (ch == ERR) {
+ if (errno == EINTR)
+ return 0;
+ exit(1);
+ }
+ if (ch >= 'A' && ch <= 'Z')
+ ch += 'a' - 'A';
+ if (col == 0) {
+ if (ch == CTRL('l')) {
+ wrefresh(curscr);
+ return 0;
+ }
+ if (ch == CTRL('g')) {
+ status();
+ return 0;
+ }
+ if (ch != ':')
+ return 0;
+ move(CMDLINE, 0);
+ clrtoeol();
+ }
+ if (ch == erasechar() && col > 0) {
+ if (col == 1 && line[0] == ':')
+ return 0;
+ col--;
+ goto doerase;
+ }
+ if (ch == CTRL('w') && col > 0) {
+ while (--col >= 0 && isspace(line[col]))
+ ;
+ col++;
+ while (--col >= 0 && !isspace(line[col]))
+ if (col == 0 && line[0] == ':')
+ return 1;
+ col++;
+ goto doerase;
+ }
+ if (ch == killchar() && col > 0) {
+ col = 0;
+ if (line[0] == ':')
+ col++;
+doerase:
+ move(CMDLINE, col);
+ clrtoeol();
+ return 0;
+ }
+ if (isprint(ch) || ch == ' ') {
+ line[col] = ch;
+ mvaddch(CMDLINE, col, ch);
+ col++;
+ }
+
+ if (col == 0 || (ch != '\r' && ch != '\n'))
+ return 0;
+
+ return 1;
}
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index 3c6b49f..a429f57 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -64,7 +64,7 @@ kvm_t *kd;
sig_t sigtstpdfl;
double avenrun[3];
int col;
-int naptime = 5;
+unsigned int delay = 5000000; /* in microseconds */
int verbose = 1; /* to report kvm read errs */
struct clockinfo clkinfo;
double hertz;
@@ -82,6 +82,7 @@ main(int argc, char **argv)
{
char errbuf[_POSIX2_LINE_MAX], dummy;
size_t size;
+ double t;
(void) setlocale(LC_ALL, "");
@@ -97,9 +98,9 @@ main(int argc, char **argv)
errx(1, "%s: unknown request", &argv[0][1]);
curcmd = p;
} else {
- naptime = atoi(argv[0]);
- if (naptime <= 0)
- naptime = 5;
+ t = strtod(argv[0], NULL) * 1000000.0;
+ if (t > 0 && t < (double)UINT_MAX)
+ delay = (unsigned int)t;
}
argc--, argv++;
}
@@ -166,8 +167,7 @@ main(int argc, char **argv)
dellave = 0.0;
- signal(SIGALRM, display);
- display(0);
+ display();
noecho();
crmode();
keyboard();
@@ -192,7 +192,7 @@ labels(void)
}
void
-display(int signo __unused)
+display()
{
int i, j;
@@ -223,7 +223,6 @@ display(int signo __unused)
wrefresh(wnd);
move(CMDLINE, col);
refresh();
- alarm(naptime);
}
void
diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
index 9ae6bcf..1b14209 100644
--- a/usr.bin/systat/systat.1
+++ b/usr.bin/systat/systat.1
@@ -28,7 +28,7 @@
.\" @(#)systat.1 8.2 (Berkeley) 12/30/93
.\" $FreeBSD$
.\"
-.Dd October 14, 2007
+.Dd September 17, 2012
.Dt SYSTAT 1
.Os
.Sh NAME
@@ -109,6 +109,7 @@ full detail below.
The
.Ar refresh-value
specifies the screen refresh time interval in seconds.
+Time interval can be fractional.
.El
.Pp
Certain characters cause immediate action by
diff --git a/usr.bin/systat/tcp.c b/usr.bin/systat/tcp.c
index 134aa9a..c9e8e9a 100644
--- a/usr.bin/systat/tcp.c
+++ b/usr.bin/systat/tcp.c
@@ -147,7 +147,7 @@ domode(struct tcpstat *ret)
switch(currentmode) {
case display_RATE:
sub = &oldstat;
- divisor = naptime;
+ divisor = (delay > 1000000) ? delay / 1000000 : 1;
break;
case display_DELTA:
sub = &oldstat;
diff --git a/usr.bin/talk/talk.1 b/usr.bin/talk/talk.1
index 327bfed..abfa150 100644
--- a/usr.bin/talk/talk.1
+++ b/usr.bin/talk/talk.1
@@ -28,7 +28,7 @@
.\" @(#)talk.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd July 3, 2004
+.Dd January 21, 2010
.Dt TALK 1
.Os
.Sh NAME
diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile
index dc76935..0e96753 100644
--- a/usr.bin/tar/Makefile
+++ b/usr.bin/tar/Makefile
@@ -4,23 +4,19 @@
LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
PROG= bsdtar
-BSDTAR_VERSION_STRING= 3.0.3
+BSDTAR_VERSION_STRING= 3.0.4
.PATH: ${LIBARCHIVEDIR}/tar
SRCS= bsdtar.c \
cmdline.c \
- getdate.c \
read.c \
subst.c \
- tree.c \
util.c \
write.c
.PATH: ${LIBARCHIVEDIR}/libarchive_fe
SRCS+= err.c \
- line_reader.c \
- matching.c \
- pathmatch.c
+ line_reader.c
DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBLZMA} ${LIBBSDXML}
LDADD= -larchive -lbz2 -lz -llzma -lbsdxml
diff --git a/usr.bin/tar/test/Makefile b/usr.bin/tar/test/Makefile
index 16fdcc6..41230c7 100644
--- a/usr.bin/tar/test/Makefile
+++ b/usr.bin/tar/test/Makefile
@@ -2,18 +2,13 @@
LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive
-.PATH: ${LIBARCHIVEDIR}/tar
-# Some tar sources are pulled in for white-box tests
-TAR_SRCS= \
- getdate.c
-
.PATH: ${LIBARCHIVEDIR}/tar/test
TESTS= \
test_0.c \
test_basic.c \
test_copy.c \
test_empty_mtree.c \
- test_getdate.c \
+ test_format_newc.c \
test_help.c \
test_option_C_upper.c \
test_option_H_upper.c \
@@ -28,6 +23,7 @@ TESTS= \
test_option_k.c \
test_option_keep_newer_files.c \
test_option_n.c \
+ test_option_nodump.c \
test_option_newer_than.c \
test_option_q.c \
test_option_r.c \
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index 669299b..c0f5088 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -80,7 +80,7 @@ __FBSDID("$FreeBSD$");
typedef struct sockaddr_storage peeraddr;
static int connected;
static char mode[32];
-jmp_buf toplevel;
+static jmp_buf toplevel;
volatile int txrx_error;
static int peer;
@@ -89,7 +89,7 @@ static int margc;
static char *margv[MAX_MARGV];
int verbose;
-char *port = NULL;
+static char *port = NULL;
static void get(int, char **);
static void help(int, char **);
diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c
index 2cb7f13..ebee542 100644
--- a/usr.bin/time/time.c
+++ b/usr.bin/time/time.c
@@ -117,7 +117,7 @@ main(int argc, char **argv)
setvbuf(out, (char *)NULL, _IONBF, (size_t)0);
}
- gettimeofday(&before_tv, (struct timezone *)NULL);
+ (void)gettimeofday(&before_tv, NULL);
switch(pid = fork()) {
case -1: /* error */
err(1, "time");
@@ -134,7 +134,7 @@ main(int argc, char **argv)
(void)signal(SIGQUIT, SIG_IGN);
(void)signal(SIGINFO, siginfo);
while (wait4(pid, &status, 0, &ru) != pid);
- gettimeofday(&after, (struct timezone *)NULL);
+ (void)gettimeofday(&after, NULL);
if ( ! WIFEXITED(status))
warnx("command terminated abnormally");
exitonsig = WIFSIGNALED(status) ? WTERMSIG(status) : 0;
@@ -297,7 +297,7 @@ siginfo(int sig __unused)
struct timeval after;
struct rusage ru;
- gettimeofday(&after, (struct timezone *)NULL);
+ (void)gettimeofday(&after, NULL);
getrusage(RUSAGE_CHILDREN, &ru);
showtime(stdout, &before_tv, &after, &ru);
}
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index 59f663d..236cb554 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -176,6 +176,12 @@ char *memorynames[] = {
"K Free", NULL
};
+int arc_stats[7];
+char *arcnames[] = {
+ "K Total, ", "K MFU, ", "K MRU, ", "K Anon, ", "K Header, ", "K Other",
+ NULL
+};
+
int swap_stats[7];
char *swapnames[] = {
"K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out",
@@ -194,6 +200,7 @@ static struct kinfo_proc *previous_procs;
static struct kinfo_proc **previous_pref;
static int previous_proc_count = 0;
static int previous_proc_count_max = 0;
+static int arc_enabled;
/* total number of io operations */
static long total_inblock;
@@ -239,6 +246,7 @@ static int compare_tid(const void *a, const void *b);
static const char *format_nice(const struct kinfo_proc *pp);
static void getsysctl(const char *name, void *ptr, size_t len);
static int swapmode(int *retavail, int *retfree);
+static void update_layout(void);
void
toggle_pcpustats(void)
@@ -246,24 +254,32 @@ toggle_pcpustats(void)
if (ncpus == 1)
return;
+ update_layout();
+}
+
+/* Adjust display based on ncpus and the ARC state. */
+static void
+update_layout(void)
+{
+
+ y_mem = 3;
+ y_arc = 4;
+ y_swap = 4 + arc_enabled;
+ y_idlecursor = 5 + arc_enabled;
+ y_message = 5 + arc_enabled;
+ y_header = 6 + arc_enabled;
+ y_procs = 7 + arc_enabled;
+ Header_lines = 7 + arc_enabled;
- /* Adjust display based on ncpus */
if (pcpu_stats) {
- y_mem += ncpus - 1; /* 3 */
- y_swap += ncpus - 1; /* 4 */
- y_idlecursor += ncpus - 1; /* 5 */
- y_message += ncpus - 1; /* 5 */
- y_header += ncpus - 1; /* 6 */
- y_procs += ncpus - 1; /* 7 */
- Header_lines += ncpus - 1; /* 7 */
- } else {
- y_mem = 3;
- y_swap = 4;
- y_idlecursor = 5;
- y_message = 5;
- y_header = 6;
- y_procs = 7;
- Header_lines = 7;
+ y_mem += ncpus - 1;
+ y_arc += ncpus - 1;
+ y_swap += ncpus - 1;
+ y_idlecursor += ncpus - 1;
+ y_message += ncpus - 1;
+ y_header += ncpus - 1;
+ y_procs += ncpus - 1;
+ Header_lines += ncpus - 1;
}
}
@@ -271,6 +287,7 @@ int
machine_init(struct statics *statics, char do_unames)
{
int i, j, empty, pagesize;
+ uint64_t arc_size;
size_t size;
struct passwd *pw;
@@ -282,6 +299,11 @@ machine_init(struct statics *statics, char do_unames)
size != sizeof(smpmode))
smpmode = 0;
+ size = sizeof(arc_size);
+ if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size,
+ NULL, 0) == 0 && arc_size != 0)
+ arc_enabled = 1;
+
if (do_unames) {
while ((pw = getpwent()) != NULL) {
if (strlen(pw->pw_name) > namelength)
@@ -322,6 +344,10 @@ machine_init(struct statics *statics, char do_unames)
statics->procstate_names = procstatenames;
statics->cpustate_names = cpustatenames;
statics->memory_names = memorynames;
+ if (arc_enabled)
+ statics->arc_names = arcnames;
+ else
+ statics->arc_names = NULL;
statics->swap_names = swapnames;
#ifdef ORDER
statics->order_names = ordernames;
@@ -356,8 +382,7 @@ machine_init(struct statics *statics, char do_unames)
pcpu_cpu_states = calloc(1, size);
statics->ncpus = ncpus;
- if (pcpu_stats)
- toggle_pcpustats();
+ update_layout();
/* all done! */
return (0);
@@ -408,7 +433,7 @@ get_system_info(struct system_info *si)
struct loadavg sysload;
int mib[2];
struct timeval boottime;
- size_t bt_size;
+ uint64_t arc_stat, arc_stat2;
int i, j;
size_t size;
@@ -487,6 +512,23 @@ get_system_info(struct system_info *si)
swap_stats[6] = -1;
}
+ if (arc_enabled) {
+ GETSYSCTL("kstat.zfs.misc.arcstats.size", arc_stat);
+ arc_stats[0] = arc_stat >> 10;
+ GETSYSCTL("vfs.zfs.mfu_size", arc_stat);
+ arc_stats[1] = arc_stat >> 10;
+ GETSYSCTL("vfs.zfs.mru_size", arc_stat);
+ arc_stats[2] = arc_stat >> 10;
+ GETSYSCTL("vfs.zfs.anon_size", arc_stat);
+ arc_stats[3] = arc_stat >> 10;
+ GETSYSCTL("kstat.zfs.misc.arcstats.hdr_size", arc_stat);
+ GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc_stat2);
+ arc_stats[4] = arc_stat + arc_stat2 >> 10;
+ GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc_stat);
+ arc_stats[5] = arc_stat >> 10;
+ si->arc = arc_stats;
+ }
+
/* set arrays and strings */
if (pcpu_stats) {
si->cpustates = pcpu_cpu_states;
@@ -511,8 +553,8 @@ get_system_info(struct system_info *si)
*/
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
- bt_size = sizeof(boottime);
- if (sysctl(mib, 2, &boottime, &bt_size, NULL, 0) != -1 &&
+ size = sizeof(boottime);
+ if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
boottime.tv_sec != 0) {
si->boottime = boottime;
} else {
diff --git a/usr.bin/top/top.local.1 b/usr.bin/top/top.local.1
index f3b0146..864ab8d 100644
--- a/usr.bin/top/top.local.1
+++ b/usr.bin/top/top.local.1
@@ -3,6 +3,7 @@
.SH DESCRIPTION OF MEMORY
Mem: 9220K Active, 1M Inact, 3284K Wired, 1M Cache, 2M Buf, 1320K Free
+ARC: 2048K Total, 342K MRU, 760K MFU, 272K Anon, 232K Header, 442K Other
Swap: 91M Total, 79M Free, 13% Inuse, 80K In, 104K Out
.TP
.B K:
@@ -16,6 +17,7 @@ Gigabyte
.TP
.B %:
1/100
+.SS Physical Memory Stats
.TP
.B Active:
number of bytes active
@@ -24,7 +26,7 @@ number of bytes active
number of bytes inactive
.TP
.B Wired:
-number of bytes wired down, including cached file data pages
+number of bytes wired down, including BIO-level cached file data pages
.TP
.B Cache:
number of clean bytes caching data that are available for
@@ -35,6 +37,27 @@ number of bytes used for BIO-level disk caching
.TP
.B Free:
number of bytes free
+.SS ZFS ARC Stats
+These stats are only displayed when the ARC is in use.
+.TP
+.B Total:
+number of wired bytes used for the ZFS ARC
+.TP
+.B MRU:
+number of ARC bytes holding most recently used data
+.TP
+.B MFU:
+number of ARC bytes holding most frequently used data
+.TP
+.B Anon:
+number of ARC bytes holding in flight data
+.TP
+.B Header:
+number of ARC bytes holding headers
+.TP
+.B Other
+miscellaneous ARC bytes
+.SS Swap Stats
.TP
.B Total:
total available swap usage
diff --git a/usr.bin/touch/touch.1 b/usr.bin/touch/touch.1
index 87789ec..6201b28 100644
--- a/usr.bin/touch/touch.1
+++ b/usr.bin/touch/touch.1
@@ -31,7 +31,7 @@
.\" @(#)touch.1 8.3 (Berkeley) 4/28/95
.\" $FreeBSD$
.\"
-.Dd February 4, 2012
+.Dd June 10, 2012
.Dt TOUCH 1
.Os
.Sh NAME
@@ -43,6 +43,7 @@
.Op Fl achm
.Op Fl r Ar file
.Op Fl t Ar [[CC]YY]MMDDhhmm[.SS]
+.Op Fl d Ar YYYY-MM-DDThh:mm:SS[.frac][tz]
.Ar
.Sh DESCRIPTION
The
@@ -61,8 +62,10 @@ individually.
Selecting both is equivalent to the default.
By default, the timestamps are set to the current time.
The
+.Fl d
+and
.Fl t
-flag explicitly specifies a different time, and the
+flags explicitly specify a different time, and the
.Fl r
flag specifies to set the times those of the specified file.
The
@@ -109,6 +112,41 @@ The
.Nm
utility does not treat this as an error.
No error messages are displayed and the exit value is not affected.
+.It Fl d
+Change the access and modification times to the specified time instead
+of the current time of day.
+The argument is of the form
+.Dq YYYY-MM-DDThh:mm:SS[.frac][tz]
+where the letters represent the following:
+.Bl -tag -width Ds -compact -offset indent
+.It Ar YYYY
+The year.
+.It Ar MM
+The month of the year, from 01 to 12.
+.It Ar DD
+The day of the month, from 01 to 31.
+.It Ar T
+The letter
+.Li T
+or a space.
+.It Ar hh
+The hour of the day, from 00 to 23.
+.It Ar mm
+The minute of the hour, from 00 to 59.
+.It Ar SS
+The second of the minute, from 00 to 61.
+.It Ar .frac
+An optional fraction,
+consisting of a period or a comma followed by one or more digits.
+The number of significant digits depends on the kernel configuration and
+the filesystem, and may be zero.
+.It Ar tz
+An optional letter
+.Li Z
+indicating the time is in
+.Tn UTC .
+Otherwise, the time is assumed to be in local time.
+.El
.It Fl h
If the file is a symbolic link, change the times of the link
itself rather than the file that the link points to.
diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c
index 7a613e8..d42d9af 100644
--- a/usr.bin/touch/touch.c
+++ b/usr.bin/touch/touch.c
@@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
#include <sys/stat.h>
#include <sys/time.h>
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -57,6 +58,7 @@ static const char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
void stime_arg1(char *, struct timeval *);
void stime_arg2(char *, int, struct timeval *);
+void stime_darg(char *, struct timeval *);
void stime_file(char *, struct timeval *);
int timeoffset(char *);
void usage(char *);
@@ -79,7 +81,7 @@ main(int argc, char *argv[])
if (gettimeofday(&tv[0], NULL))
err(1, "gettimeofday");
- while ((ch = getopt(argc, argv, "A:acfhmr:t:")) != -1)
+ while ((ch = getopt(argc, argv, "A:acd:fhmr:t:")) != -1)
switch(ch) {
case 'A':
Aflag = timeoffset(optarg);
@@ -90,6 +92,10 @@ main(int argc, char *argv[])
case 'c':
cflag = 1;
break;
+ case 'd':
+ timeset = 1;
+ stime_darg(optarg, tv);
+ break;
case 'f':
/* No-op for compatibility. */
break;
@@ -320,6 +326,50 @@ stime_arg2(char *arg, int year, struct timeval *tvp)
tvp[0].tv_usec = tvp[1].tv_usec = 0;
}
+void
+stime_darg(char *arg, struct timeval *tvp)
+{
+ struct tm t = { .tm_sec = 0 };
+ const char *fmt, *colon;
+ char *p;
+ int val, isutc = 0;
+
+ tvp[0].tv_usec = 0;
+ t.tm_isdst = -1;
+ colon = strchr(arg, ':');
+ if (colon == NULL || strchr(colon + 1, ':') == NULL)
+ goto bad;
+ fmt = strchr(arg, 'T') != NULL ? "%Y-%m-%dT%H:%M:%S" :
+ "%Y-%m-%d %H:%M:%S";
+ p = strptime(arg, fmt, &t);
+ if (p == NULL)
+ goto bad;
+ /* POSIX: must have at least one digit after dot */
+ if ((*p == '.' || *p == ',') && isdigit((unsigned char)p[1])) {
+ p++;
+ val = 100000;
+ while (isdigit((unsigned char)*p)) {
+ tvp[0].tv_usec += val * (*p - '0');
+ p++;
+ val /= 10;
+ }
+ }
+ if (*p == 'Z') {
+ isutc = 1;
+ p++;
+ }
+ if (*p != '\0')
+ goto bad;
+
+ tvp[0].tv_sec = isutc ? timegm(&t) : mktime(&t);
+
+ tvp[1] = tvp[0];
+ return;
+
+bad:
+ errx(1, "out of range or illegal time specification: YYYY-MM-DDThh:mm:SS[.frac][tz]");
+}
+
/* Calculate a time offset in seconds, given an arg of the format [-]HHMMSS. */
int
timeoffset(char *arg)
@@ -364,7 +414,9 @@ stime_file(char *fname, struct timeval *tvp)
void
usage(char *myname)
{
- fprintf(stderr, "usage:\n" "%s [-A [-][[hh]mm]SS] [-achm] [-r file] "
- "[-t [[CC]YY]MMDDhhmm[.SS]] file ...\n", myname);
+ fprintf(stderr, "usage: %s [-A [-][[hh]mm]SS] [-achm] [-r file] "
+ "[-t [[CC]YY]MMDDhhmm[.SS]]\n"
+ " [-d YYYY-MM-DDThh:mm:SS[.frac][tz]] "
+ "file ...\n", myname);
exit(1);
}
diff --git a/usr.bin/truss/amd64-fbsd.c b/usr.bin/truss/amd64-fbsd.c
index 6ed3812..516c4d2 100644
--- a/usr.bin/truss/amd64-fbsd.c
+++ b/usr.bin/truss/amd64-fbsd.c
@@ -62,8 +62,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "syscalls.h"
static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
@@ -77,29 +75,35 @@ static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
* '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 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;
+};
+
+static struct freebsd_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct freebsd_syscall)));
+}
/* 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));
+static void
+free_fsc(struct freebsd_syscall *fsc)
+{
+ int i;
+
+ free(fsc->args);
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -110,147 +114,147 @@ clear_fsc(void) {
*/
void
-amd64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- struct reg regs;
- int syscall_num;
- int i, reg;
- 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, basically; the latter is for quad-aligned arguments.
- */
- reg = 0;
- syscall_num = regs.r_rax;
- switch (syscall_num) {
- case SYS_syscall:
- case SYS___syscall:
- syscall_num = regs.r_rdi;
- reg++;
- break;
- }
-
- 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));
- for (i = 0; i < nargs && reg < 6; i++, reg++) {
- switch (reg) {
- case 0: fsc.args[i] = regs.r_rdi; break;
- case 1: fsc.args[i] = regs.r_rsi; break;
- case 2: fsc.args[i] = regs.r_rdx; break;
- case 3: fsc.args[i] = regs.r_rcx; break;
- case 4: fsc.args[i] = regs.r_r8; break;
- case 5: fsc.args[i] = regs.r_r9; break;
- }
- }
- if (nargs > i) {
- struct ptrace_io_desc iorequest;
- iorequest.piod_op = PIOD_READ_D;
- iorequest.piod_offs = (void *)(regs.r_rsp + sizeof(register_t));
- iorequest.piod_addr = &fsc.args[i];
- iorequest.piod_len = (nargs - i) * sizeof(register_t);
- ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
- if (iorequest.piod_len == 0)
- return;
- }
-
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
+amd64_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ int i, reg, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (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, basically; the latter is for quad-aligned arguments.
+ */
+ reg = 0;
+ syscall_num = regs.r_rax;
+ switch (syscall_num) {
+ case SYS_syscall:
+ case SYS___syscall:
+ syscall_num = regs.r_rdi;
+ reg++;
+ break;
+ }
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ 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") == 0 ||
+ strcmp(fsc->name, "rfork") == 0 ||
+ strcmp(fsc->name, "vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
+ for (i = 0; i < nargs && reg < 6; i++, reg++) {
+ switch (reg) {
+ case 0: fsc->args[i] = regs.r_rdi; break;
+ case 1: fsc->args[i] = regs.r_rsi; break;
+ case 2: fsc->args[i] = regs.r_rdx; break;
+ case 3: fsc->args[i] = regs.r_rcx; break;
+ case 4: fsc->args[i] = regs.r_r8; break;
+ case 5: fsc->args[i] = regs.r_r9; break;
+ }
+ }
+ if (nargs > i) {
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.r_rsp + sizeof(register_t));
+ iorequest.piod_addr = &fsc->args[i];
+ iorequest.piod_len = (nargs - i) * sizeof(register_t);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return;
+ }
+
+ 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);
+ 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;
+ fsc->nargs = nargs;
+ }
- /*
- * 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.
- */
+ fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *));
+ fsc->sc = sc;
- if (fsc.name) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ for (i = 0; i < fsc->nargs; i++) {
#if DEBUG
- fprintf(stderr, "0x%lx%s",
- sc
- ? fsc.args[sc->args[i].offset]
- : fsc.args[i],
- i < (fsc.nargs - 1) ? "," : "");
+ fprintf(stderr, "0x%lx%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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ fprintf(trussinfo->outfile, "\n");
#endif
- if (fsc.name != NULL &&
- (!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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
@@ -263,68 +267,72 @@ amd64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
long
amd64_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, "-- CANNOT READ REGISTERS --\n");
- return (-1);
- }
- retval = regs.r_rax;
- errorp = !!(regs.r_rflags & PSL_C);
-
- /*
- * 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) {
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval = regs.r_rax;
+ errorp = !!(regs.r_rflags & PSL_C);
+
/*
- * If an error occurred, than don't bothe getting the data;
- * it may not be valid.
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
*/
- 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);
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ 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);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/amd64-fbsd32.c b/usr.bin/truss/amd64-fbsd32.c
index c3dd183..72f4295 100644
--- a/usr.bin/truss/amd64-fbsd32.c
+++ b/usr.bin/truss/amd64-fbsd32.c
@@ -43,8 +43,8 @@ static const char rcsid[] =
*/
#include <sys/types.h>
-#include <sys/syscall.h>
#include <sys/ptrace.h>
+#include <sys/syscall.h>
#include <machine/reg.h>
#include <machine/psl.h>
@@ -62,8 +62,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "freebsd32_syscalls.h"
static int nsyscalls = sizeof(freebsd32_syscallnames) /
@@ -78,7 +76,7 @@ static int nsyscalls = sizeof(freebsd32_syscallnames) /
* 'struct syscall' describes the system call; it may be NULL, however,
* if we don't know about this particular system call yet.
*/
-static struct freebsd32_syscall {
+struct freebsd32_syscall {
struct syscall *sc;
const char *name;
int number;
@@ -86,25 +84,29 @@ static struct freebsd32_syscall {
unsigned int *args32;
int nargs; /* number of arguments -- *not* number of words! */
char **s_args; /* the printable arguments */
-} fsc;
+};
+
+static struct freebsd32_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct freebsd32_syscall)));
+}
/* Clear up and free parts of the fsc structure. */
-static __inline void
-clear_fsc(void) {
- if (fsc.args) {
- free(fsc.args);
- }
- if (fsc.args32) {
- free(fsc.args32);
- }
- 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));
+static void
+free_fsc(struct freebsd32_syscall *fsc)
+{
+ int i;
+
+ free(fsc->args);
+ free(fsc->args32);
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -115,145 +117,145 @@ clear_fsc(void) {
*/
void
-amd64_fbsd32_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- struct reg regs;
- int syscall_num;
- int i;
- unsigned long parm_offset;
- struct syscall *sc = NULL;
- struct ptrace_io_desc iorequest;
- cpid = trussinfo->curthread->tid;
-
- clear_fsc();
-
- if (ptrace(PT_GETREGS, cpid, (caddr_t)&regs, 0) < 0)
- {
- fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
- return;
- }
- parm_offset = regs.r_rsp + sizeof(int);
-
- /*
- * FreeBSD has two special kinds of system call redirctions --
- * SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basically; the latter is for quad-aligned arguments.
- */
- syscall_num = regs.r_rax;
- switch (syscall_num) {
- case SYS_syscall:
- syscall_num = ptrace(PT_READ_D, cpid, (caddr_t)parm_offset, 0);
- parm_offset += sizeof(int);
- break;
- case SYS___syscall:
- syscall_num = ptrace(PT_READ_D, cpid, (caddr_t)parm_offset, 0);
- parm_offset += sizeof(quad_t);
- break;
- }
-
- fsc.number = syscall_num;
- fsc.name =
- (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
- freebsd32_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.args32 = malloc((1+nargs) * sizeof(unsigned int));
- iorequest.piod_op = PIOD_READ_D;
- iorequest.piod_offs = (void *)parm_offset;
- iorequest.piod_addr = fsc.args32;
- iorequest.piod_len = (1+nargs) * sizeof(unsigned int);
- ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
- if (iorequest.piod_len == 0)
- return;
-
- fsc.args = malloc((1+nargs) * sizeof(unsigned long));
- for (i = 0; i < nargs + 1; i++)
- fsc.args[i] = fsc.args32[i];
-
- if (fsc.name)
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
+amd64_fbsd32_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct freebsd32_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ unsigned long parm_offset;
+ int i, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return;
+ }
+ parm_offset = regs.r_rsp + sizeof(int);
+
+ /*
+ * FreeBSD has two special kinds of system call redirctions --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ */
+ syscall_num = regs.r_rax;
+ switch (syscall_num) {
+ case SYS_syscall:
+ syscall_num = ptrace(PT_READ_D, tid, (caddr_t)parm_offset, 0);
+ parm_offset += sizeof(int);
+ break;
+ case SYS___syscall:
+ syscall_num = ptrace(PT_READ_D, tid, (caddr_t)parm_offset, 0);
+ parm_offset += sizeof(quad_t);
+ break;
+ }
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ fsc->number = syscall_num;
+ fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ?
+ NULL : freebsd32_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") == 0 ||
+ strcmp(fsc->name, "rfork") == 0 ||
+ strcmp(fsc->name, "vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ fsc->args32 = malloc((1 + nargs) * sizeof(unsigned int));
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)parm_offset;
+ iorequest.piod_addr = fsc->args32;
+ iorequest.piod_len = (1 + nargs) * sizeof(unsigned int);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return;
+
+ fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
+ for (i = 0; i < nargs + 1; i++)
+ fsc->args[i] = fsc->args32[i];
+
+ sc = NULL;
+ if (fsc->name)
+ 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);
+ fprintf(trussinfo->outfile, "unknown syscall %s -- setting "
+ "args to %d\n", fsc->name, nargs);
#endif
- fsc.nargs = nargs;
- }
+ fsc->nargs = nargs;
+ }
- fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*));
- fsc.sc = sc;
+ 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) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ fprintf(trussinfo->outfile, "\n");
#endif
- if (fsc.name != NULL &&
- (!strcmp(fsc.name, "freebsd32_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, "freebsd32_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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "freebsd32_execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "freebsd32_execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
@@ -266,68 +268,72 @@ amd64_fbsd32_syscall_entry(struct trussinfo *trussinfo, int nargs) {
long
amd64_fbsd32_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, "-- CANNOT READ REGISTERS --\n");
- return (-1);
- }
-
- retval = regs.r_rax;
- errorp = !!(regs.r_rflags & PSL_C);
-
- /*
- * 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) {
+ struct reg regs;
+ struct freebsd32_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval = regs.r_rax;
+ errorp = !!(regs.r_rflags & PSL_C);
+
/*
- * If an error occurred, then don't bother getting the data;
- * it may not be valid.
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
*/
- 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, "freebsd32_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);
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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, "freebsd32_execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ 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);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/amd64-linux32.c b/usr.bin/truss/amd64-linux32.c
index 3de40da..2c025a3 100644
--- a/usr.bin/truss/amd64-linux32.c
+++ b/usr.bin/truss/amd64-linux32.c
@@ -59,8 +59,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "linux32_syscalls.h"
static int nsyscalls =
@@ -75,26 +73,34 @@ static int nsyscalls =
* 'struct syscall' describes the system call; it may be NULL, however,
* if we don't know about this particular system call yet.
*/
-static struct linux_syscall {
+struct linux_syscall {
struct syscall *sc;
const char *name;
int number;
unsigned long args[5];
int nargs; /* number of arguments -- *not* number of words! */
char **s_args; /* the printable arguments */
-} fsc;
+};
+
+static struct linux_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct linux_syscall)));
+}
/* Clear up and free parts of the fsc structure. */
-static __inline void
-clear_fsc(void) {
- 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));
+static void
+free_fsc(struct linux_syscall *fsc)
+{
+ int i;
+
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -105,211 +111,219 @@ clear_fsc(void) {
*/
void
-amd64_linux32_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- struct reg regs;
- int syscall_num;
- int i;
- 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;
- }
- syscall_num = regs.r_rax;
-
- fsc.number = syscall_num;
- fsc.name =
- (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : linux32_syscallnames[syscall_num];
- if (!fsc.name) {
- fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
- }
-
- if (fsc.name && (trussinfo->flags & FOLLOWFORKS)
- && ((!strcmp(fsc.name, "linux_fork")
- || !strcmp(fsc.name, "linux_vfork"))))
- {
- trussinfo->curthread->in_fork = 1;
- }
-
- if (nargs == 0)
- return;
-
- /*
- * Linux passes syscall arguments in registers, not
- * on the stack. Fortunately, we've got access to the
- * register set. Note that we don't bother checking the
- * number of arguments. And what does linux do for syscalls
- * that have more than five arguments?
- */
-
- fsc.args[0] = regs.r_rbx;
- fsc.args[1] = regs.r_rcx;
- fsc.args[2] = regs.r_rdx;
- fsc.args[3] = regs.r_rsi;
- fsc.args[4] = regs.r_rdi;
-
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
+amd64_linux32_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct reg regs;
+ struct linux_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ int i, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return;
+ }
+
+ syscall_num = regs.r_rax;
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ fsc->number = syscall_num;
+ fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ?
+ NULL : linux32_syscallnames[syscall_num];
+ if (!fsc->name) {
+ fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n",
+ syscall_num);
+ }
+
+ if (fsc->name && (trussinfo->flags & FOLLOWFORKS) &&
+ (strcmp(fsc->name, "linux_fork") == 0 ||
+ strcmp(fsc->name, "linux_vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ /*
+ * Linux passes syscall arguments in registers, not
+ * on the stack. Fortunately, we've got access to the
+ * register set. Note that we don't bother checking the
+ * number of arguments. And what does linux do for syscalls
+ * that have more than five arguments?
+ */
+
+ fsc->args[0] = regs.r_rbx;
+ fsc->args[1] = regs.r_rcx;
+ fsc->args[2] = regs.r_rdx;
+ fsc->args[3] = regs.r_rsi;
+ fsc->args[4] = regs.r_rdi;
+
+ 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);
+ 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;
+ fsc->nargs = nargs;
+ }
- /*
- * 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.
- */
+ fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *));
+ fsc->sc = sc;
- if (fsc.name) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ fprintf(trussinfo->outfile, "\n");
#endif
- if (fsc.name != NULL &&
- (!strcmp(fsc.name, "linux_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, "linux_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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "linux_execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "linux_execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
* Linux syscalls return negative errno's, we do positive and map them
*/
static const int bsd_to_linux_errno[] = {
- -0, -1, -2, -3, -4, -5, -6, -7, -8, -9,
- -10, -35, -12, -13, -14, -15, -16, -17, -18, -19,
- -20, -21, -22, -23, -24, -25, -26, -27, -28, -29,
- -30, -31, -32, -33, -34, -11,-115,-114, -88, -89,
- -90, -91, -92, -93, -94, -95, -96, -97, -98, -99,
+ -0, -1, -2, -3, -4, -5, -6, -7, -8, -9,
+ -10, -35, -12, -13, -14, -15, -16, -17, -18, -19,
+ -20, -21, -22, -23, -24, -25, -26, -27, -28, -29,
+ -30, -31, -32, -33, -34, -11,-115,-114, -88, -89,
+ -90, -91, -92, -93, -94, -95, -96, -97, -98, -99,
-100,-101,-102,-103,-104,-105,-106,-107,-108,-109,
-110,-111, -40, -36,-112,-113, -39, -11, -87,-122,
-116, -66, -6, -6, -6, -6, -6, -37, -38, -9,
- -6,
+ -6,
};
long
-amd64_linux32_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
+amd64_linux32_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, "-- CANNOT READ REGISTERS --\n");
- return (-1);
- }
-
- retval = regs.r_rax;
- errorp = !!(regs.r_rflags & PSL_C);
-
- /*
- * 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) {
+ struct reg regs;
+ struct linux_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval = regs.r_rax;
+ errorp = !!(regs.r_rflags & PSL_C);
+
+ /*
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
+ */
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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 an error occurred, than don't bothe getting the data;
- * it may not be valid.
+ * It would probably be a good idea to merge the error handling,
+ * but that complicates things considerably.
*/
- 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;
- }
- }
- }
-
- /*
- * It would probably be a good idea to merge the error handling,
- * but that complicates things considerably.
- */
- if (errorp) {
- for (i = 0; (size_t)i < sizeof(bsd_to_linux_errno) / sizeof(int); i++)
- if (retval == bsd_to_linux_errno[i])
- break;
- }
-
- if (fsc.name != NULL &&
- (!strcmp(fsc.name, "linux_execve") || !strcmp(fsc.name, "exit"))) {
- trussinfo->curthread->in_syscall = 1;
- }
-
- print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp,
- errorp ? i : retval, fsc.sc);
- clear_fsc();
-
- return (retval);
+ if (errorp) {
+ for (i = 0;
+ (size_t)i < sizeof(bsd_to_linux_errno) / sizeof(int); i++) {
+ if (retval == bsd_to_linux_errno[i])
+ break;
+ }
+ }
+
+ if (fsc->name != NULL && (strcmp(fsc->name, "linux_execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ trussinfo->curthread->in_syscall = 1;
+
+ print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp,
+ errorp ? i : retval, fsc->sc);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/extern.h b/usr.bin/truss/extern.h
index a56a01e..f89582a 100644
--- a/usr.bin/truss/extern.h
+++ b/usr.bin/truss/extern.h
@@ -32,7 +32,7 @@
*/
extern int setup_and_wait(char **);
-extern int start_tracing(int);
+extern int start_tracing(pid_t);
extern void restore_proc(int);
extern void waitevent(struct trussinfo *);
extern const char *ioctlname(unsigned long val);
diff --git a/usr.bin/truss/i386-fbsd.c b/usr.bin/truss/i386-fbsd.c
index 82f1db0..d146ecd 100644
--- a/usr.bin/truss/i386-fbsd.c
+++ b/usr.bin/truss/i386-fbsd.c
@@ -43,8 +43,8 @@ static const char rcsid[] =
*/
#include <sys/types.h>
-#include <sys/syscall.h>
#include <sys/ptrace.h>
+#include <sys/syscall.h>
#include <machine/reg.h>
#include <machine/psl.h>
@@ -62,8 +62,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "syscalls.h"
static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
@@ -77,29 +75,35 @@ static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
* '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 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;
+};
+
+static struct freebsd_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct freebsd_syscall)));
+}
/* 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));
+static void
+free_fsc(struct freebsd_syscall *fsc)
+{
+ int i;
+
+ free(fsc->args);
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -110,140 +114,141 @@ clear_fsc(void) {
*/
void
-i386_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- struct reg regs;
- int syscall_num;
- int i;
- unsigned int parm_offset;
- struct syscall *sc = NULL;
- struct ptrace_io_desc iorequest;
- cpid = trussinfo->curthread->tid;
-
- clear_fsc();
-
- if (ptrace(PT_GETREGS, cpid, (caddr_t)&regs, 0) < 0)
- {
- fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
- return;
- }
- parm_offset = regs.r_esp + sizeof(int);
-
- /*
- * FreeBSD has two special kinds of system call redirctions --
- * SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basically; the latter is for quad-aligned arguments.
- */
- syscall_num = regs.r_eax;
- switch (syscall_num) {
- case SYS_syscall:
- syscall_num = ptrace(PT_READ_D, cpid, (caddr_t)parm_offset, 0);
- parm_offset += sizeof(int);
- break;
- case SYS___syscall:
- syscall_num = ptrace(PT_READ_D, cpid, (caddr_t)parm_offset, 0);
- parm_offset += sizeof(quad_t);
- break;
- }
-
- 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));
- iorequest.piod_op = PIOD_READ_D;
- iorequest.piod_offs = (void *)parm_offset;
- iorequest.piod_addr = fsc.args;
- iorequest.piod_len = (1+nargs) * sizeof(unsigned long);
- ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
- if (iorequest.piod_len == 0)
- return;
-
- if (fsc.name)
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
+i386_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ unsigned int parm_offset;
+ int i, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return;
+ }
+ parm_offset = regs.r_esp + sizeof(int);
+
+ /*
+ * FreeBSD has two special kinds of system call redirctions --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ */
+ syscall_num = regs.r_eax;
+ switch (syscall_num) {
+ case SYS_syscall:
+ syscall_num = ptrace(PT_READ_D, tid, (caddr_t)parm_offset, 0);
+ parm_offset += sizeof(int);
+ break;
+ case SYS___syscall:
+ syscall_num = ptrace(PT_READ_D, tid, (caddr_t)parm_offset, 0);
+ parm_offset += sizeof(quad_t);
+ break;
+ }
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ 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") == 0 ||
+ strcmp(fsc->name, "rfork") == 0 ||
+ strcmp(fsc->name, "vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)parm_offset;
+ iorequest.piod_addr = fsc->args;
+ iorequest.piod_len = (1 + nargs) * sizeof(unsigned long);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return;
+
+ sc = NULL;
+ if (fsc->name)
+ 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);
+ fprintf(trussinfo->outfile, "unknown syscall %s -- setting "
+ "args to %d\n", fsc->name, nargs);
#endif
- fsc.nargs = nargs;
- }
+ fsc->nargs = nargs;
+ }
- fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*));
- fsc.sc = sc;
+ 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) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ fprintf(trussinfo->outfile, "\n");
#endif
- if (fsc.name != NULL &&
- (!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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
@@ -256,68 +261,72 @@ i386_syscall_entry(struct trussinfo *trussinfo, int nargs) {
long
i386_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, "-- CANNOT READ REGISTERS --\n");
- return (-1);
- }
-
- retval = regs.r_eax;
- errorp = !!(regs.r_eflags & PSL_C);
-
- /*
- * 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) {
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval = regs.r_eax;
+ errorp = !!(regs.r_eflags & PSL_C);
+
/*
- * If an error occurred, then don't bother getting the data;
- * it may not be valid.
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
*/
- 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);
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ 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);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/i386-linux.c b/usr.bin/truss/i386-linux.c
index 66bccf9..84f1451 100644
--- a/usr.bin/truss/i386-linux.c
+++ b/usr.bin/truss/i386-linux.c
@@ -59,8 +59,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "linux_syscalls.h"
static int nsyscalls =
@@ -75,26 +73,34 @@ static int nsyscalls =
* 'struct syscall' describes the system call; it may be NULL, however,
* if we don't know about this particular system call yet.
*/
-static struct linux_syscall {
+struct linux_syscall {
struct syscall *sc;
const char *name;
int number;
unsigned long args[5];
int nargs; /* number of arguments -- *not* number of words! */
char **s_args; /* the printable arguments */
-} fsc;
+};
+
+static struct linux_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct linux_syscall)));
+}
/* Clear up and free parts of the fsc structure. */
-static __inline void
-clear_fsc(void) {
- 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));
+static void
+free_fsc(struct linux_syscall *fsc)
+{
+ int i;
+
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -105,211 +111,218 @@ clear_fsc(void) {
*/
void
-i386_linux_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- struct reg regs;
- int syscall_num;
- int i;
- 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;
- }
- syscall_num = regs.r_eax;
-
- fsc.number = syscall_num;
- fsc.name =
- (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : linux_syscallnames[syscall_num];
- if (!fsc.name) {
- fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
- }
-
- if (fsc.name && (trussinfo->flags & FOLLOWFORKS)
- && ((!strcmp(fsc.name, "linux_fork")
- || !strcmp(fsc.name, "linux_vfork"))))
- {
- trussinfo->curthread->in_fork = 1;
- }
-
- if (nargs == 0)
- return;
-
- /*
- * Linux passes syscall arguments in registers, not
- * on the stack. Fortunately, we've got access to the
- * register set. Note that we don't bother checking the
- * number of arguments. And what does linux do for syscalls
- * that have more than five arguments?
- */
-
- fsc.args[0] = regs.r_ebx;
- fsc.args[1] = regs.r_ecx;
- fsc.args[2] = regs.r_edx;
- fsc.args[3] = regs.r_esi;
- fsc.args[4] = regs.r_edi;
-
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
+i386_linux_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct reg regs;
+ struct linux_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ int i, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return;
+ }
+
+ syscall_num = regs.r_eax;
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ fsc->number = syscall_num;
+ fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ?
+ NULL : linux_syscallnames[syscall_num];
+ if (!fsc->name) {
+ fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n",
+ syscall_num);
+ }
+
+ if (fsc->name && (trussinfo->flags & FOLLOWFORKS) &&
+ (strcmp(fsc->name, "linux_fork") == 0 ||
+ strcmp(fsc->name, "linux_vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ /*
+ * Linux passes syscall arguments in registers, not
+ * on the stack. Fortunately, we've got access to the
+ * register set. Note that we don't bother checking the
+ * number of arguments. And what does linux do for syscalls
+ * that have more than five arguments?
+ */
+
+ fsc->args[0] = regs.r_ebx;
+ fsc->args[1] = regs.r_ecx;
+ fsc->args[2] = regs.r_edx;
+ fsc->args[3] = regs.r_esi;
+ fsc->args[4] = regs.r_edi;
+
+ 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);
+ 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;
+ fsc->nargs = nargs;
+ }
- /*
- * 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.
- */
+ fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *));
+ fsc->sc = sc;
- if (fsc.name) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ fprintf(trussinfo->outfile, "\n");
#endif
- if (fsc.name != NULL &&
- (!strcmp(fsc.name, "linux_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, "linux_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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "linux_execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "linux_execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
* Linux syscalls return negative errno's, we do positive and map them
*/
static const int bsd_to_linux_errno[] = {
- -0, -1, -2, -3, -4, -5, -6, -7, -8, -9,
- -10, -35, -12, -13, -14, -15, -16, -17, -18, -19,
- -20, -21, -22, -23, -24, -25, -26, -27, -28, -29,
- -30, -31, -32, -33, -34, -11,-115,-114, -88, -89,
- -90, -91, -92, -93, -94, -95, -96, -97, -98, -99,
+ -0, -1, -2, -3, -4, -5, -6, -7, -8, -9,
+ -10, -35, -12, -13, -14, -15, -16, -17, -18, -19,
+ -20, -21, -22, -23, -24, -25, -26, -27, -28, -29,
+ -30, -31, -32, -33, -34, -11,-115,-114, -88, -89,
+ -90, -91, -92, -93, -94, -95, -96, -97, -98, -99,
-100,-101,-102,-103,-104,-105,-106,-107,-108,-109,
-110,-111, -40, -36,-112,-113, -39, -11, -87,-122,
-116, -66, -6, -6, -6, -6, -6, -37, -38, -9,
- -6,
+ -6,
};
long
i386_linux_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, "-- CANNOT READ REGISTERS --\n");
- return (-1);
- }
-
- retval = regs.r_eax;
- errorp = !!(regs.r_eflags & PSL_C);
-
- /*
- * 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) {
+ struct reg regs;
+ struct linux_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval = regs.r_eax;
+ errorp = !!(regs.r_eflags & PSL_C);
+
+ /*
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
+ */
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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 an error occurred, than don't bothe getting the data;
- * it may not be valid.
+ * It would probably be a good idea to merge the error handling,
+ * but that complicates things considerably.
*/
- 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;
- }
- }
- }
-
- /*
- * It would probably be a good idea to merge the error handling,
- * but that complicates things considerably.
- */
- if (errorp) {
- for (i = 0; (size_t)i < sizeof(bsd_to_linux_errno) / sizeof(int); i++)
- if (retval == bsd_to_linux_errno[i])
- break;
- }
-
- if (fsc.name != NULL &&
- (!strcmp(fsc.name, "linux_execve") || !strcmp(fsc.name, "exit"))) {
- trussinfo->curthread->in_syscall = 1;
- }
-
- print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp,
- errorp ? i : retval, fsc.sc);
- clear_fsc();
-
- return (retval);
+ if (errorp) {
+ for (i = 0;
+ (size_t)i < sizeof(bsd_to_linux_errno) / sizeof(int); i++) {
+ if (retval == bsd_to_linux_errno[i])
+ break;
+ }
+ }
+
+ if (fsc->name != NULL && (strcmp(fsc->name, "linux_execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ trussinfo->curthread->in_syscall = 1;
+
+ print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp,
+ errorp ? i : retval, fsc->sc);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/ia64-fbsd.c b/usr.bin/truss/ia64-fbsd.c
index 8fc06c6..2218fe5 100644
--- a/usr.bin/truss/ia64-fbsd.c
+++ b/usr.bin/truss/ia64-fbsd.c
@@ -61,8 +61,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "syscalls.h"
static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
@@ -76,29 +74,35 @@ static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
* '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 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;
+};
+
+static struct freebsd_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct freebsd_syscall)));
+}
/* 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));
+static void
+free_fsc(struct freebsd_syscall *fsc)
+{
+ int i;
+
+ free(fsc->args);
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -109,122 +113,124 @@ clear_fsc(void) {
*/
void
-ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- struct reg regs;
- int syscall_num;
- int i;
- unsigned long *parm_offset;
- 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;
- }
- parm_offset = &regs.r_scratch.gr16;
-
- /*
- * FreeBSD has two special kinds of system call redirctions --
- * SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basically; the latter is for quad-aligned arguments.
- */
- syscall_num = regs.r_scratch.gr15; /* XXX double-check. */
- if (syscall_num == SYS_syscall || syscall_num == SYS___syscall)
- syscall_num = (int)*parm_offset++;
-
- 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));
- memcpy(fsc.args, parm_offset, nargs * sizeof(long));
-
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
+ia64_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ unsigned long *parm_offset;
+ lwpid_t tid;
+ int i, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return;
+ }
+ parm_offset = &regs.r_scratch.gr16;
+
+ /*
+ * FreeBSD has two special kinds of system call redirctions --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
+ */
+ syscall_num = regs.r_scratch.gr15; /* XXX double-check. */
+ if (syscall_num == SYS_syscall || syscall_num == SYS___syscall)
+ syscall_num = (int)*parm_offset++;
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ 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") == 0 ||
+ strcmp(fsc->name, "rfork") == 0 ||
+ strcmp(fsc->name, "vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
+ memcpy(fsc->args, parm_offset, nargs * sizeof(long));
+
+ 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);
+ 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;
+ fsc->nargs = nargs;
+ }
- /*
- * 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.
- */
+ fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *));
+ fsc->sc = sc;
- if (fsc.name) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ fprintf(trussinfo->outfile, "\n");
#endif
- if (fsc.name != NULL &&
- (!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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
@@ -237,65 +243,72 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
long
ia64_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, "-- CANNOT READ REGISTERS --\n");
- return (-1);
- }
- retval = regs.r_scratch.gr8;
- errorp = (regs.r_scratch.gr10 != 0) ? 1 : 0;
-
- /*
- * 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) {
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return (-1);
+ }
+
+ retval = regs.r_scratch.gr8;
+ errorp = (regs.r_scratch.gr10 != 0) ? 1 : 0;
+
/*
- * If an error occurred, than don't bothe getting the data;
- * it may not be valid.
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
*/
- 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,
- fsc.sc, retval);
- clear_fsc();
-
- return (retval);
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ 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);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c
index e04e810..02c6930 100644
--- a/usr.bin/truss/main.c
+++ b/usr.bin/truss/main.c
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
#include "extern.h"
#include "syscall.h"
-#define MAXARGS 6
+#define MAXARGS 6
static void
usage(void)
@@ -113,19 +113,19 @@ static struct ex_types {
/*
* Set the execution type. This is called after every exec, and when
- * a process is first monitored.
+ * a process is first monitored.
*/
static struct ex_types *
set_etype(struct trussinfo *trussinfo)
{
struct ex_types *funcs;
- char progt[32];
-
- size_t len = sizeof(progt);
- int mib[4];
+ size_t len;
int error;
+ int mib[4];
+ char progt[32];
+ len = sizeof(progt);
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_SV_NAME;
@@ -135,7 +135,7 @@ set_etype(struct trussinfo *trussinfo)
err(2, "can not get etype");
for (funcs = ex_types; funcs->type; funcs++)
- if (!strcmp(funcs->type, progt))
+ if (strcmp(funcs->type, progt) == 0)
break;
if (funcs->type == NULL) {
@@ -163,16 +163,15 @@ strsig(int sig)
int
main(int ac, char **av)
{
- int c;
- int i;
- pid_t childpid;
- int status;
- char **command;
+ struct timespec timediff;
+ struct sigaction sa;
struct ex_types *funcs;
- int initial_open;
- char *fname;
struct trussinfo *trussinfo;
+ char *fname;
char *signame;
+ char **command;
+ pid_t childpid;
+ int c, initial_open, status;
fname = NULL;
initial_open = 1;
@@ -192,7 +191,7 @@ main(int ac, char **av)
case 'p': /* specified pid */
trussinfo->pid = atoi(optarg);
/* make sure i don't trace me */
- if(trussinfo->pid == getpid()) {
+ if (trussinfo->pid == getpid()) {
fprintf(stderr, "attempt to grab self.\n");
exit(2);
}
@@ -221,7 +220,7 @@ main(int ac, char **av)
case 's': /* Specified string size */
trussinfo->strsize = atoi(optarg);
break;
- case 'S': /* Don't trace signals */
+ case 'S': /* Don't trace signals */
trussinfo->flags |= NOSIGS;
break;
default:
@@ -260,10 +259,13 @@ main(int ac, char **av)
signal(SIGTERM, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
} else {
+ sa.sa_handler = restore_proc;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGQUIT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
start_tracing(trussinfo->pid);
- signal(SIGINT, restore_proc);
- signal(SIGTERM, restore_proc);
- signal(SIGQUIT, restore_proc);
}
@@ -285,25 +287,23 @@ START_TRACE:
clock_gettime(CLOCK_REALTIME, &trussinfo->start_time);
do {
- struct timespec timediff;
waitevent(trussinfo);
- switch(i = trussinfo->pr_why) {
+ switch (trussinfo->pr_why) {
case S_SCE:
funcs->enter_syscall(trussinfo, MAXARGS);
clock_gettime(CLOCK_REALTIME,
- &trussinfo->before);
+ &trussinfo->curthread->before);
break;
case S_SCX:
clock_gettime(CLOCK_REALTIME,
- &trussinfo->after);
+ &trussinfo->curthread->after);
if (trussinfo->curthread->in_fork &&
(trussinfo->flags & FOLLOWFORKS)) {
trussinfo->curthread->in_fork = 0;
- childpid =
- funcs->exit_syscall(trussinfo,
- trussinfo->pr_data);
+ childpid = funcs->exit_syscall(trussinfo,
+ trussinfo->pr_data);
/*
* Fork a new copy of ourself to trace
@@ -326,15 +326,15 @@ START_TRACE:
fprintf(trussinfo->outfile, "%5d: ",
trussinfo->pid);
if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
- timespecsubt(&trussinfo->after,
+ timespecsubt(&trussinfo->curthread->after,
&trussinfo->start_time, &timediff);
fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec,
timediff.tv_nsec);
}
if (trussinfo->flags & RELATIVETIMESTAMPS) {
- timespecsubt(&trussinfo->after,
- &trussinfo->before, &timediff);
+ timespecsubt(&trussinfo->curthread->after,
+ &trussinfo->curthread->before, &timediff);
fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec,
timediff.tv_nsec);
@@ -352,17 +352,17 @@ START_TRACE:
fprintf(trussinfo->outfile, "%5d: ",
trussinfo->pid);
if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
- timespecsubt(&trussinfo->after,
+ timespecsubt(&trussinfo->curthread->after,
&trussinfo->start_time, &timediff);
fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec,
timediff.tv_nsec);
}
if (trussinfo->flags & RELATIVETIMESTAMPS) {
- timespecsubt(&trussinfo->after,
- &trussinfo->before, &timediff);
- fprintf(trussinfo->outfile, "%ld.%09ld ",
- (long)timediff.tv_sec, timediff.tv_nsec);
+ timespecsubt(&trussinfo->curthread->after,
+ &trussinfo->curthread->before, &timediff);
+ fprintf(trussinfo->outfile, "%ld.%09ld ",
+ (long)timediff.tv_sec, timediff.tv_nsec);
}
fprintf(trussinfo->outfile,
"process exit, rval = %u\n", trussinfo->pr_data);
@@ -370,15 +370,17 @@ START_TRACE:
default:
break;
}
- } while (trussinfo->pr_why != S_EXIT);
+ } while (trussinfo->pr_why != S_EXIT &&
+ trussinfo->pr_why != S_DETACHED);
- if (trussinfo->flags & FOLLOWFORKS)
+ if (trussinfo->flags & FOLLOWFORKS) {
do {
childpid = wait(&status);
} while (childpid != -1);
+ }
- if (trussinfo->flags & COUNTONLY)
- print_summary(trussinfo);
+ if (trussinfo->flags & COUNTONLY)
+ print_summary(trussinfo);
fflush(trussinfo->outfile);
diff --git a/usr.bin/truss/mips-fbsd.c b/usr.bin/truss/mips-fbsd.c
index 5d295c7..6f5be66 100644
--- a/usr.bin/truss/mips-fbsd.c
+++ b/usr.bin/truss/mips-fbsd.c
@@ -66,8 +66,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "syscalls.h"
static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
@@ -81,29 +79,35 @@ static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
* '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 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;
+};
+
+static struct freebsd_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct freebsd_syscall)));
+}
/* 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));
+static void
+free_fsc(struct freebsd_syscall *fsc)
+{
+ int i;
+
+ free(fsc->args);
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -114,162 +118,171 @@ clear_fsc(void) {
*/
void
-mips_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- struct reg regs;
- int syscall_num;
- int i;
- struct syscall *sc;
- int indir = 0; /* indirect system call */
- struct ptrace_io_desc iorequest;
-
- cpid = trussinfo->curthread->tid;
-
- clear_fsc();
-
- if (ptrace(PT_GETREGS, cpid, (caddr_t)&regs, 0) < 0) {
- fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
- return;
- }
-
- syscall_num = regs.r_regs[V0];
- if (syscall_num == SYS_syscall) {
- indir = 1;
- syscall_num = regs.r_regs[A0];
- }
-
- 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));
+mips_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ int i, syscall_num;
+ int indir; /* indirect system call */
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return;
+ }
+
+ indir = 0;
+ syscall_num = regs.r_regs[V0];
+ if (syscall_num == SYS_syscall) {
+ indir = 1;
+ syscall_num = regs.r_regs[A0];
+ }
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ 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") == 0 ||
+ strcmp(fsc->name, "rfork") == 0 ||
+ strcmp(fsc->name, "vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
#if 0 // XXX
- iorequest.piod_op = PIOD_READ_D;
- iorequest.piod_offs = (void *)parm_offset;
- iorequest.piod_addr = fsc.args;
- iorequest.piod_len = (1+nargs) * sizeof(unsigned long);
- ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
- if (iorequest.piod_len == 0)
- return;
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)parm_offset;
+ iorequest.piod_addr = fsc->args;
+ iorequest.piod_len = (1 + nargs) * sizeof(unsigned long);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return;
#else
- iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_op = PIOD_READ_D;
#endif
- switch (nargs) {
- default:
- /*
- * The OS doesn't seem to allow more than 10 words of
- * parameters (yay!). So we shouldn't be here.
- */
- warn("More than 10 words (%d) of arguments!\n", nargs);
- break;
- case 10: case 9: case 8: case 7: case 6: case 5:
- /*
- * If there are 7-10 words of arguments, they are placed
- * on the stack, as is normal for other processors.
- * The fall-through for all of these is deliberate!!!
- */
- // XXX BAD constant used here
- iorequest.piod_op = PIOD_READ_D;
- iorequest.piod_offs = (void *)(regs.r_regs[SP] + 4 * sizeof(uint32_t));
- iorequest.piod_addr = &fsc.args[4];
- iorequest.piod_len = (nargs - 4) * sizeof(fsc.args[0]);
- ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
- if (iorequest.piod_len == 0) return;
- case 4: fsc.args[3] = regs.r_regs[A3];
- case 3: fsc.args[2] = regs.r_regs[A2];
- case 2: fsc.args[1] = regs.r_regs[A1];
- case 1: fsc.args[0] = regs.r_regs[A0];
- case 0:
- break;
- }
- if (indir) {
- memmove(&fsc.args[0], &fsc.args[1], (nargs-1) * sizeof(fsc.args[0]));
- }
-
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
+ switch (nargs) {
+ default:
+ /*
+ * The OS doesn't seem to allow more than 10 words of
+ * parameters (yay!). So we shouldn't be here.
+ */
+ warn("More than 10 words (%d) of arguments!\n", nargs);
+ break;
+ case 10:
+ case 9:
+ case 8:
+ case 7:
+ case 6:
+ case 5:
+ /*
+ * If there are 7-10 words of arguments, they are placed
+ * on the stack, as is normal for other processors.
+ * The fall-through for all of these is deliberate!!!
+ */
+ // XXX BAD constant used here
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.r_regs[SP] +
+ 4 * sizeof(uint32_t));
+ iorequest.piod_addr = &fsc->args[4];
+ iorequest.piod_len = (nargs - 4) * sizeof(fsc->args[0]);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return;
+ case 4: fsc->args[3] = regs.r_regs[A3];
+ case 3: fsc->args[2] = regs.r_regs[A2];
+ case 2: fsc->args[1] = regs.r_regs[A1];
+ case 1: fsc->args[0] = regs.r_regs[A0];
+ case 0: break;
+ }
+ if (indir) {
+ memmove(&fsc->args[0], &fsc->args[1],
+ (nargs - 1) * 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);
+ 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;
+ fsc->nargs = nargs;
+ }
- /*
- * 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.
- */
+ fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *));
+ fsc->sc = sc;
- if (fsc.name) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ fprintf(trussinfo->outfile, "\n");
#endif
- if (fsc.name != NULL &&
- (!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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
@@ -280,66 +293,74 @@ mips_syscall_entry(struct trussinfo *trussinfo, int nargs) {
*/
long
-mips_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.r_regs[V0];
- errorp = !!regs.r_regs[A3];
-
- /*
- * 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) {
+mips_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
+{
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "\n");
+ return (-1);
+ }
+
+ retval = regs.r_regs[V0];
+ errorp = !!regs.r_regs[A3];
+
/*
- * If an error occurred, than don't bothe getting the data;
- * it may not be valid.
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
*/
- 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);
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ 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);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/powerpc-fbsd.c b/usr.bin/truss/powerpc-fbsd.c
index 285b10a..8cfb9ef 100644
--- a/usr.bin/truss/powerpc-fbsd.c
+++ b/usr.bin/truss/powerpc-fbsd.c
@@ -61,11 +61,9 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#ifdef __powerpc64__ /* 32-bit compatibility */
#include "freebsd32_syscalls.h"
-#define syscallnames freebsd32_syscallnames
+#define syscallnames freebsd32_syscallnames
#else /* native 32-bit */
#include "syscalls.h"
#endif
@@ -81,29 +79,35 @@ static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
* '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 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;
+};
+
+static struct freebsd_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct freebsd_syscall)));
+}
/* 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));
+static void
+free_fsc(struct freebsd_syscall *fsc)
+{
+ int i;
+
+ free(fsc->args);
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -114,148 +118,148 @@ clear_fsc(void) {
*/
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;
-
- /* Account for a 64-bit argument with corresponding alignment. */
- nargs += 2;
-
- 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, basically; the latter is for quad-aligned arguments.
- */
- regargs = NARGREG;
- syscall_num = regs.fixreg[0];
- args = &regs.fixreg[3];
- if (syscall_num == SYS_syscall) {
- args = &regs.fixreg[4];
- regargs -= 1;
- syscall_num = regs.fixreg[3];
- } else if (syscall_num == SYS___syscall) {
- args = &regs.fixreg[5];
- regargs -= 2;
- syscall_num = regs.fixreg[4];
- }
-
- 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] + 8);
- 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 {
+powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ void *args;
+ lwpid_t tid;
+ int i, regargs, syscall_num;
+
+ /* Account for a 64-bit argument with corresponding alignment. */
+ nargs += 2;
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (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, basically; the latter is for quad-aligned arguments.
+ */
+ regargs = NARGREG;
+ syscall_num = regs.fixreg[0];
+ args = &regs.fixreg[3];
+ if (syscall_num == SYS_syscall) {
+ args = &regs.fixreg[4];
+ regargs -= 1;
+ syscall_num = regs.fixreg[3];
+ } else if (syscall_num == SYS___syscall) {
+ args = &regs.fixreg[5];
+ regargs -= 2;
+ syscall_num = regs.fixreg[4];
+ }
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ 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") == 0 ||
+ strcmp(fsc->name, "rfork") == 0 ||
+ strcmp(fsc->name, "vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
+
+ if (nargs > regargs) {
+ memmove(&fsc->args[0], args, regargs * sizeof(fsc->args[0]));
+
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.fixreg[1] + 8);
+ iorequest.piod_addr = &fsc->args[regargs];
+ iorequest.piod_len = (nargs - regargs) * sizeof(fsc->args[0]);
+ ptrace(PT_IO, tid, (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);
+ 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;
+ fsc->nargs = nargs;
+ }
- /*
- * 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.
- */
+ fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *));
+ fsc->sc = sc;
- if (fsc.name) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ 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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
@@ -268,76 +272,80 @@ powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs) {
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 {
- /*
- * On 32-bit big-endian, the low word of a 64-bit return is
- * in the greater address. Switch to this. XXX note that
- * print_syscall_ret can't handle 64-bit return values (llseek)
- */
- if (sc->ret_type == 2)
- retval = regs.fixreg[4];
-
- /*
- * 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) {
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "\n");
+ return (-1);
+ }
+
+ retval = regs.fixreg[3];
+ errorp = !!(regs.cr & 0x10000000);
+
/*
- * If an error occurred, than don't bothe getting the data;
- * it may not be valid.
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
*/
- 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);
+
+ fsc = trussinfo->curthread->fsc;
+ sc = fsc->sc;
+ if (!sc) {
+ for (i = 0; i < fsc->nargs; i++)
+ asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]);
+ } else {
+ /*
+ * On 32-bit big-endian, the low word of a 64-bit return is
+ * in the greater address. Switch to this. XXX note that
+ * print_syscall_ret can't handle 64-bit return values (llseek)
+ */
+ if (sc->ret_type == 2)
+ retval = regs.fixreg[4];
+
+ /*
+ * 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, then don't bother
+ * 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") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ 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);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/powerpc64-fbsd.c b/usr.bin/truss/powerpc64-fbsd.c
index 145c330..7147f81 100644
--- a/usr.bin/truss/powerpc64-fbsd.c
+++ b/usr.bin/truss/powerpc64-fbsd.c
@@ -61,8 +61,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "syscalls.h"
static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
@@ -76,29 +74,35 @@ static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
* '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 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;
+};
+
+static struct freebsd_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct freebsd_syscall)));
+}
/* 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));
+static void
+free_fsc(struct freebsd_syscall *fsc)
+{
+ int i;
+
+ free(fsc->args);
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -109,141 +113,141 @@ clear_fsc(void) {
*/
void
-powerpc64_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, basically; 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 {
+powerpc64_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ void *args;
+ lwpid_t tid;
+ int i, regargs, syscall_num;
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (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, basically; 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 = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ 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") == 0 ||
+ strcmp(fsc->name, "rfork") == 0 ||
+ strcmp(fsc->name, "vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
+
+ if (nargs > regargs) {
+ 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, tid, (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);
+ 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;
+ fsc->nargs = nargs;
+ }
- /*
- * 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.
- */
+ fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *));
+ fsc->sc = sc;
- if (fsc.name) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ 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;
+ if (fsc->name && (strcmp(fsc->name, "execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
@@ -256,68 +260,72 @@ powerpc64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
long
powerpc64_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) {
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "\n");
+ return (-1);
+ }
+
+ retval = regs.fixreg[3];
+ errorp = !!(regs.cr & 0x10000000);
+
/*
- * If an error occurred, than don't bothe getting the data;
- * it may not be valid.
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
*/
- 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);
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ 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);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index 5931983..d6e4300 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
#include "truss.h"
#include "extern.h"
-static int child_pid;
+static sig_atomic_t detaching;
/*
* setup_and_wait() is called to start a process. All it really does
@@ -69,27 +69,21 @@ static int child_pid;
int
setup_and_wait(char *command[])
{
- int pid;
- int waitval;
+ pid_t pid;
pid = vfork();
- if (pid == -1) {
+ if (pid == -1)
err(1, "fork failed");
- }
if (pid == 0) { /* Child */
ptrace(PT_TRACE_ME, 0, 0, 0);
execvp(command[0], command);
err(1, "execvp %s", command[0]);
}
-
+
/* Only in the parent here */
- if (waitpid(pid, &waitval, 0) < 0) {
+ if (waitpid(pid, NULL, 0) < 0)
err(1, "unexpect stop in waitpid");
- return 0;
- }
- child_pid = pid;
-
return (pid);
}
@@ -100,21 +94,19 @@ setup_and_wait(char *command[])
*/
int
-start_tracing(int pid)
+start_tracing(pid_t pid)
{
- int waitval;
- int ret;
- int retry = 10;
+ int ret, retry;
+ retry = 10;
do {
ret = ptrace(PT_ATTACH, pid, NULL, 0);
usleep(200);
- } while(ret && retry-- > 0);
+ } while (ret && retry-- > 0);
if (ret)
err(1, "can not attach to target process");
- child_pid = pid;
- if (waitpid(pid, &waitval, 0) < 0)
+ if (waitpid(pid, NULL, 0) < 0)
err(1, "Unexpect stop in waitpid");
return (0);
@@ -126,21 +118,30 @@ start_tracing(int pid)
* applies if truss was told to monitor an already-existing
* process.
*/
+
void
restore_proc(int signo __unused)
{
+
+ detaching = 1;
+}
+
+static int
+detach_proc(pid_t pid)
+{
int waitval;
- /* stop the child so that we can detach */
- kill(child_pid, SIGSTOP);
- if (waitpid(child_pid, &waitval, 0) < 0)
+ /* stop the child so that we can detach */
+ kill(pid, SIGSTOP);
+ if (waitpid(pid, &waitval, 0) < 0)
err(1, "Unexpected stop in waitpid");
- if (ptrace(PT_DETACH, child_pid, (caddr_t)1, 0) < 0)
+ if (ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0)
err(1, "Can not detach the process");
-
- kill(child_pid, SIGCONT);
- exit(0);
+
+ kill(pid, SIGCONT);
+
+ return (waitval);
}
/*
@@ -150,21 +151,20 @@ restore_proc(int signo __unused)
static void
find_thread(struct trussinfo *info, lwpid_t lwpid)
{
- info->curthread = NULL;
struct threadinfo *np;
+
+ info->curthread = NULL;
SLIST_FOREACH(np, &info->threadlist, entries) {
- if (np->tid == lwpid) {
- info->curthread = np;
- return;
+ if (np->tid == lwpid) {
+ info->curthread = np;
+ return;
}
}
- np = (struct threadinfo *)malloc(sizeof(struct threadinfo));
+ np = (struct threadinfo *)calloc(1, sizeof(struct threadinfo));
if (np == NULL)
- errx(1, "malloc() failed");
+ err(1, "calloc() failed");
np->tid = lwpid;
- np->in_fork = 0;
- np->in_syscall = 0;
SLIST_INSERT_HEAD(&info->threadlist, np, entries);
info->curthread = np;
}
@@ -177,16 +177,27 @@ find_thread(struct trussinfo *info, lwpid_t lwpid)
void
waitevent(struct trussinfo *info)
{
- int waitval;
+ struct ptrace_lwpinfo lwpinfo;
static int pending_signal = 0;
-
+ int waitval;
+
ptrace(PT_SYSCALL, info->pid, (caddr_t)1, pending_signal);
pending_signal = 0;
- if (waitpid(info->pid, &waitval, 0) < 0) {
+detach:
+ if (detaching) {
+ waitval = detach_proc(info->pid);
+ info->pr_why = S_DETACHED;
+ info->pr_data = WEXITSTATUS(waitval);
+ return;
+ }
+
+ if (waitpid(info->pid, &waitval, 0) == -1) {
+ if (errno == EINTR)
+ goto detach;
err(1, "Unexpected stop in waitpid");
}
-
+
if (WIFCONTINUED(waitval)) {
info->pr_why = S_NONE;
return;
@@ -197,10 +208,10 @@ waitevent(struct trussinfo *info)
return;
}
if (WIFSTOPPED(waitval)) {
- struct ptrace_lwpinfo lwpinfo;
- ptrace(PT_LWPINFO, info->pid, (caddr_t)&lwpinfo, sizeof(lwpinfo));
+ ptrace(PT_LWPINFO, info->pid, (caddr_t)&lwpinfo,
+ sizeof(lwpinfo));
find_thread(info, lwpinfo.pl_lwpid);
- switch(WSTOPSIG(waitval)) {
+ switch (WSTOPSIG(waitval)) {
case SIGTRAP:
if (lwpinfo.pl_flags & PL_FLAG_SCE) {
info->pr_why = S_SCE;
diff --git a/usr.bin/truss/sparc64-fbsd.c b/usr.bin/truss/sparc64-fbsd.c
index 47302cc..429fa24 100644
--- a/usr.bin/truss/sparc64-fbsd.c
+++ b/usr.bin/truss/sparc64-fbsd.c
@@ -67,8 +67,6 @@ static const char rcsid[] =
#include "syscall.h"
#include "extern.h"
-static int cpid = -1;
-
#include "syscalls.h"
static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
@@ -82,29 +80,35 @@ static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
* '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 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;
+};
+
+static struct freebsd_syscall *
+alloc_fsc(void)
+{
+
+ return (malloc(sizeof(struct freebsd_syscall)));
+}
/* 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));
+static void
+free_fsc(struct freebsd_syscall *fsc)
+{
+ int i;
+
+ free(fsc->args);
+ if (fsc->s_args) {
+ for (i = 0; i < fsc->nargs; i++)
+ free(fsc->s_args[i]);
+ free(fsc->s_args);
+ }
+ free(fsc);
}
/*
@@ -115,159 +119,164 @@ clear_fsc(void) {
*/
void
-sparc64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- struct reg regs;
- int syscall_num;
- int i;
- struct syscall *sc;
- int indir = 0; /* indirect system call */
- struct ptrace_io_desc iorequest;
-
- 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, basically; the latter is for quad-aligned arguments.
- */
- syscall_num = regs.r_global[1];
- if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) {
- indir = 1;
- syscall_num = regs.r_out[0];
- }
-
- 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));
- switch (nargs) {
- default:
- /*
- * The OS doesn't seem to allow more than 10 words of
- * parameters (yay!). So we shouldn't be here.
- */
- warn("More than 10 words (%d) of arguments!\n", nargs);
- break;
- case 10: case 9: case 8: case 7:
+sparc64_syscall_entry(struct trussinfo *trussinfo, int nargs)
+{
+ struct ptrace_io_desc iorequest;
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ int i, syscall_num;
+ int indir; /* indirect system call */
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
+ return;
+ }
+
/*
- * If there are 7-10 words of arguments, they are placed
- * on the stack, as is normal for other processors.
- * The fall-through for all of these is deliberate!!!
+ * FreeBSD has two special kinds of system call redirctions --
+ * SYS_syscall, and SYS___syscall. The former is the old syscall()
+ * routine, basically; the latter is for quad-aligned arguments.
*/
- iorequest.piod_op = PIOD_READ_D;
- iorequest.piod_offs = (void *)(regs.r_out[6] + SPOFF +
- offsetof(struct frame, fr_pad[6]));
- iorequest.piod_addr = &fsc.args[6];
- iorequest.piod_len = (nargs - 6) * sizeof(fsc.args[0]);
- ptrace(PT_IO, cpid, (caddr_t)&iorequest, 0);
- if (iorequest.piod_len == 0) return;
-
- case 6: fsc.args[5] = regs.r_out[5];
- case 5: fsc.args[4] = regs.r_out[4];
- case 4: fsc.args[3] = regs.r_out[3];
- case 3: fsc.args[2] = regs.r_out[2];
- case 2: fsc.args[1] = regs.r_out[1];
- case 1: fsc.args[0] = regs.r_out[0];
- case 0:
- break;
- }
-
- if (indir) {
- memmove(&fsc.args[0], &fsc.args[1], (nargs-1) * sizeof(fsc.args[0]));
- }
-
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
+ indir = 0;
+ syscall_num = regs.r_global[1];
+ if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) {
+ indir = 1;
+ syscall_num = regs.r_out[0];
+ }
+
+ fsc = alloc_fsc();
+ if (fsc == NULL)
+ return;
+ 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") == 0 ||
+ strcmp(fsc->name, "rfork") == 0 ||
+ strcmp(fsc->name, "vfork") == 0))
+ trussinfo->curthread->in_fork = 1;
+
+ if (nargs == 0)
+ return;
+
+ fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
+ switch (nargs) {
+ default:
+ /*
+ * The OS doesn't seem to allow more than 10 words of
+ * parameters (yay!). So we shouldn't be here.
+ */
+ warn("More than 10 words (%d) of arguments!\n", nargs);
+ break;
+ case 10:
+ case 9:
+ case 8:
+ case 7:
+ /*
+ * If there are 7-10 words of arguments, they are placed
+ * on the stack, as is normal for other processors.
+ * The fall-through for all of these is deliberate!!!
+ */
+ iorequest.piod_op = PIOD_READ_D;
+ iorequest.piod_offs = (void *)(regs.r_out[6] + SPOFF +
+ offsetof(struct frame, fr_pad[6]));
+ iorequest.piod_addr = &fsc->args[6];
+ iorequest.piod_len = (nargs - 6) * sizeof(fsc->args[0]);
+ ptrace(PT_IO, tid, (caddr_t)&iorequest, 0);
+ if (iorequest.piod_len == 0)
+ return;
+ case 6: fsc->args[5] = regs.r_out[5];
+ case 5: fsc->args[4] = regs.r_out[4];
+ case 4: fsc->args[3] = regs.r_out[3];
+ case 3: fsc->args[2] = regs.r_out[2];
+ case 2: fsc->args[1] = regs.r_out[1];
+ case 1: fsc->args[0] = regs.r_out[0];
+ case 0:
+ break;
+ }
+
+ if (indir)
+ memmove(&fsc->args[0], &fsc->args[1], (nargs - 1) *
+ 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);
+ fprintf(trussinfo->outfile, "unknown syscall %s -- setting "
+ "args to %d\n", fsc->name, nargs);
#endif
- fsc.nargs = nargs;
- }
+ fsc->nargs = nargs;
+ }
- fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*));
- fsc.sc = sc;
+ 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) {
+ /*
+ * 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);
+ fprintf(stderr, "syscall %s(", fsc->name);
#endif
- for (i = 0; i < fsc.nargs; i++) {
+ 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) ? "," : "");
+ 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 (sc && !(sc->args[i].type & OUT)) {
+ fsc->s_args[i] = print_arg(&sc->args[i],
+ fsc->args, 0, trussinfo);
+ }
+ }
#if DEBUG
- fprintf(stderr, ")\n");
+ fprintf(stderr, ")\n");
#endif
- }
+ }
#if DEBUG
- fprintf(trussinfo->outfile, "\n");
+ fprintf(trussinfo->outfile, "\n");
#endif
- if (fsc.name != NULL &&
- (!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;
+ if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 ||
+ strcmp(fsc->name, "exit") == 0)) {
+ /*
+ * XXX
+ * This could be done in a more general
+ * manner but it still wouldn't be very pretty.
+ */
+ if (strcmp(fsc->name, "execve") == 0) {
+ 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;
+ }
+ }
+ }
+ }
+ trussinfo->curthread->fsc = fsc;
}
/*
@@ -278,66 +287,74 @@ sparc64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
*/
long
-sparc64_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.r_out[0];
- errorp = !!(regs.r_tstate & TSTATE_XCC_C);
-
- /*
- * 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) {
+sparc64_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
+{
+ struct reg regs;
+ struct freebsd_syscall *fsc;
+ struct syscall *sc;
+ lwpid_t tid;
+ long retval;
+ int errorp, i;
+
+ if (trussinfo->curthread->fsc == NULL)
+ return (-1);
+
+ tid = trussinfo->curthread->tid;
+
+ if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
+ fprintf(trussinfo->outfile, "\n");
+ return (-1);
+ }
+
+ retval = regs.r_out[0];
+ errorp = !!(regs.r_tstate & TSTATE_XCC_C);
+
/*
- * If an error occurred, than don't bothe getting the data;
- * it may not be valid.
+ * This code, while simpler than the initial versions I used, could
+ * stand some significant cleaning.
*/
- 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);
+
+ fsc = trussinfo->curthread->fsc;
+ 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, then don't bother
+ * 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") == 0 ||
+ strcmp(fsc->name, "exit") == 0))
+ 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);
+ free_fsc(fsc);
+
+ return (retval);
}
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index 484bb5d..49ff9a4 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -42,9 +42,9 @@ enum Argtype { None = 1, Hex, Octal, Int, Name, Ptr, Stat, Ioctl, Quad,
Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
Pathconf };
-#define ARG_MASK 0xff
-#define OUT 0x100
-#define IN /*0x20*/0
+#define ARG_MASK 0xff
+#define OUT 0x100
+#define IN /*0x20*/0
struct syscall_args {
enum Argtype type;
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index bcdc6ce..0afd083 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -269,8 +269,8 @@ struct xlat {
const char *str;
};
-#define X(a) { a, #a },
-#define XEND { 0, NULL }
+#define X(a) { a, #a },
+#define XEND { 0, NULL }
static struct xlat kevent_filters[] = {
X(EVFILT_READ) X(EVFILT_WRITE) X(EVFILT_AIO) X(EVFILT_VNODE)
@@ -414,10 +414,11 @@ xlookup(struct xlat *xlat, int val)
static char *
xlookup_bits(struct xlat *xlat, int val)
{
+ int len, rem;
static char str[512];
- int len = 0;
- int rem = val;
+ len = 0;
+ rem = val;
for (; xlat->str != NULL; xlat++) {
if ((xlat->val & rem) == xlat->val) {
/* don't print the "all-bits-zero" string unless all
@@ -445,12 +446,13 @@ xlookup_bits(struct xlat *xlat, int val)
struct syscall *
get_syscall(const char *name)
{
- struct syscall *sc = syscalls;
+ struct syscall *sc;
+ sc = syscalls;
if (name == NULL)
return (NULL);
while (sc->name) {
- if (!strcmp(name, sc->name))
+ if (strcmp(name, sc->name) == 0)
return (sc);
sc++;
}
@@ -464,7 +466,7 @@ get_syscall(const char *name)
*/
static int
-get_struct(int pid, void *offset, void *buf, int len)
+get_struct(pid_t pid, void *offset, void *buf, int len)
{
struct ptrace_io_desc iorequest;
@@ -477,8 +479,8 @@ get_struct(int pid, void *offset, void *buf, int len)
return (0);
}
-#define MAXSIZE 4096
-#define BLOCKSIZE 1024
+#define MAXSIZE 4096
+#define BLOCKSIZE 1024
/*
* get_string
* Copy a string from the process. Note that it is
@@ -489,12 +491,11 @@ get_struct(int pid, void *offset, void *buf, int len)
static char *
get_string(pid_t pid, void *offset, int max)
{
- char *buf;
struct ptrace_io_desc iorequest;
- int totalsize, size;
- int diff = 0;
- int i;
+ char *buf;
+ int diff, i, size, totalsize;
+ diff = 0;
totalsize = size = max ? (max + 1) : BLOCKSIZE;
buf = malloc(totalsize);
if (buf == NULL)
@@ -536,11 +537,14 @@ get_string(pid_t pid, void *offset, int max)
*/
char *
-print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trussinfo *trussinfo)
+print_arg(struct syscall_args *sc, unsigned long *args, long retval,
+ struct trussinfo *trussinfo)
{
- char *tmp = NULL;
- int pid = trussinfo->pid;
+ char *tmp;
+ pid_t pid;
+ tmp = NULL;
+ pid = trussinfo->pid;
switch (sc->type & ARG_MASK) {
case Hex:
asprintf(&tmp, "0x%x", (int)args[sc->offset]);
@@ -581,15 +585,18 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
len = max_string;
truncated = 1;
}
- if (len && get_struct(pid, (void*)args[sc->offset], &tmp2, len) != -1) {
+ if (len && get_struct(pid, (void*)args[sc->offset], &tmp2, len)
+ != -1) {
tmp3 = malloc(len * 4 + 1);
while (len) {
- if (strvisx(tmp3, tmp2, len, VIS_CSTYLE|VIS_TAB|VIS_NL) <= max_string)
+ if (strvisx(tmp3, tmp2, len,
+ VIS_CSTYLE|VIS_TAB|VIS_NL) <= max_string)
break;
len--;
truncated = 1;
};
- asprintf(&tmp, "\"%s\"%s", tmp3, truncated?"...":"");
+ asprintf(&tmp, "\"%s\"%s", tmp3, truncated ?
+ "..." : "");
free(tmp3);
} else {
asprintf(&tmp, "0x%lx", args[sc->offset]);
@@ -602,10 +609,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
char *string;
char *strarray[100]; /* XXX This is ugly. */
- if (get_struct(pid, (void *)args[sc->offset], (void *)&strarray,
- sizeof(strarray)) == -1) {
+ if (get_struct(pid, (void *)args[sc->offset],
+ (void *)&strarray, sizeof(strarray)) == -1)
err(1, "get_struct %p", (void *)args[sc->offset]);
- }
num = 0;
size = 0;
@@ -623,7 +629,8 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
tmp2 += sprintf(tmp2, " [");
for (i = 0; i < num; i++) {
string = get_string(pid, (void*)strarray[i], 0);
- tmp2 += sprintf(tmp2, " \"%s\"%c", string, (i+1 == num) ? ' ' : ',');
+ tmp2 += sprintf(tmp2, " \"%s\"%c", string,
+ (i + 1 == num) ? ' ' : ',');
free(string);
}
tmp2 += sprintf(tmp2, "]");
@@ -657,20 +664,22 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
}
case Ioctl: {
const char *temp = ioctlname(args[sc->offset]);
- if (temp) {
+ if (temp)
tmp = strdup(temp);
- } else {
+ else {
unsigned long arg = args[sc->offset];
- asprintf(&tmp, "0x%lx { IO%s%s 0x%lx('%c'), %lu, %lu }", arg,
- arg&IOC_OUT?"R":"", arg&IOC_IN?"W":"",
- IOCGROUP(arg), isprint(IOCGROUP(arg))?(char)IOCGROUP(arg):'?',
+ asprintf(&tmp, "0x%lx { IO%s%s 0x%lx('%c'), %lu, %lu }",
+ arg, arg & IOC_OUT ? "R" : "",
+ arg & IOC_IN ? "W" : "", IOCGROUP(arg),
+ isprint(IOCGROUP(arg)) ? (char)IOCGROUP(arg) : '?',
arg & 0xFF, IOCPARM_LEN(arg));
}
break;
}
case Umtx: {
struct umtx umtx;
- if (get_struct(pid, (void *)args[sc->offset], &umtx, sizeof(umtx)) != -1)
+ if (get_struct(pid, (void *)args[sc->offset], &umtx,
+ sizeof(umtx)) != -1)
asprintf(&tmp, "{ 0x%lx }", (long)umtx.u_owner);
else
asprintf(&tmp, "0x%lx", args[sc->offset]);
@@ -678,23 +687,28 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
}
case Timespec: {
struct timespec ts;
- if (get_struct(pid, (void *)args[sc->offset], &ts, sizeof(ts)) != -1)
- asprintf(&tmp, "{%ld.%09ld }", (long)ts.tv_sec, ts.tv_nsec);
+ if (get_struct(pid, (void *)args[sc->offset], &ts,
+ sizeof(ts)) != -1)
+ asprintf(&tmp, "{%ld.%09ld }", (long)ts.tv_sec,
+ ts.tv_nsec);
else
asprintf(&tmp, "0x%lx", args[sc->offset]);
break;
}
case Timeval: {
struct timeval tv;
- if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv)) != -1)
- asprintf(&tmp, "{%ld.%06ld }", (long)tv.tv_sec, tv.tv_usec);
+ if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv))
+ != -1)
+ asprintf(&tmp, "{%ld.%06ld }", (long)tv.tv_sec,
+ tv.tv_usec);
else
asprintf(&tmp, "0x%lx", args[sc->offset]);
break;
}
case Timeval2: {
struct timeval tv[2];
- if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv)) != -1)
+ if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv))
+ != -1)
asprintf(&tmp, "{%ld.%06ld, %ld.%06ld }",
(long)tv[0].tv_sec, tv[0].tv_usec,
(long)tv[1].tv_sec, tv[1].tv_usec);
@@ -704,7 +718,8 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
}
case Itimerval: {
struct itimerval itv;
- if (get_struct(pid, (void *)args[sc->offset], &itv, sizeof(itv)) != -1)
+ if (get_struct(pid, (void *)args[sc->offset], &itv,
+ sizeof(itv)) != -1)
asprintf(&tmp, "{%ld.%06ld, %ld.%06ld }",
(long)itv.it_interval.tv_sec,
itv.it_interval.tv_usec,
@@ -716,8 +731,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
}
case Pollfd: {
/*
- * XXX: A Pollfd argument expects the /next/ syscall argument to be
- * the number of fds in the array. This matches the poll syscall.
+ * XXX: A Pollfd argument expects the /next/ syscall argument
+ * to be the number of fds in the array. This matches the poll
+ * syscall.
*/
struct pollfd *pfd;
int numfds = args[sc->offset+1];
@@ -726,22 +742,22 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
const int per_fd = 100;
if ((pfd = malloc(bytes)) == NULL)
- err(1, "Cannot malloc %d bytes for pollfd array", bytes);
- if (get_struct(pid, (void *)args[sc->offset], pfd, bytes) != -1) {
-
+ err(1, "Cannot malloc %d bytes for pollfd array",
+ bytes);
+ if (get_struct(pid, (void *)args[sc->offset], pfd, bytes)
+ != -1) {
used = 0;
tmpsize = 1 + per_fd * numfds + 2;
if ((tmp = malloc(tmpsize)) == NULL)
- err(1, "Cannot alloc %d bytes for poll output", tmpsize);
+ err(1, "Cannot alloc %d bytes for poll output",
+ tmpsize);
tmp[used++] = '{';
for (i = 0; i < numfds; i++) {
- u = snprintf(tmp + used, per_fd,
- "%s%d/%s",
- i > 0 ? " " : "",
- pfd[i].fd,
- xlookup_bits(poll_flags, pfd[i].events) );
+ u = snprintf(tmp + used, per_fd, "%s%d/%s",
+ i > 0 ? " " : "", pfd[i].fd,
+ xlookup_bits(poll_flags, pfd[i].events));
if (u > 0)
used += u < per_fd ? u : per_fd;
}
@@ -755,8 +771,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
}
case Fd_set: {
/*
- * XXX: A Fd_set argument expects the /first/ syscall argument to be
- * the number of fds in the array. This matches the select syscall.
+ * XXX: A Fd_set argument expects the /first/ syscall argument
+ * to be the number of fds in the array. This matches the
+ * select syscall.
*/
fd_set *fds;
int numfds = args[0];
@@ -765,17 +782,21 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
const int per_fd = 20;
if ((fds = malloc(bytes)) == NULL)
- err(1, "Cannot malloc %d bytes for fd_set array", bytes);
- if (get_struct(pid, (void *)args[sc->offset], fds, bytes) != -1) {
+ err(1, "Cannot malloc %d bytes for fd_set array",
+ bytes);
+ if (get_struct(pid, (void *)args[sc->offset], fds, bytes)
+ != -1) {
used = 0;
tmpsize = 1 + numfds * per_fd + 2;
if ((tmp = malloc(tmpsize)) == NULL)
- err(1, "Cannot alloc %d bytes for fd_set output", tmpsize);
+ err(1, "Cannot alloc %d bytes for fd_set "
+ "output", tmpsize);
tmp[used++] = '{';
for (i = 0; i < numfds; i++) {
if (FD_ISSET(i, fds)) {
- u = snprintf(tmp + used, per_fd, "%d ", i);
+ u = snprintf(tmp + used, per_fd, "%d ",
+ i);
if (u > 0)
used += u < per_fd ? u : per_fd;
}
@@ -784,9 +805,8 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
used--;
tmp[used++] = '}';
tmp[used++] = '\0';
- } else {
+ } else
asprintf(&tmp, "0x%lx", args[sc->offset]);
- }
free(fds);
break;
}
@@ -805,16 +825,16 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
int i, used;
sig = args[sc->offset];
- if (get_struct(pid, (void *)args[sc->offset], (void *)&ss, sizeof(ss)) == -1) {
+ if (get_struct(pid, (void *)args[sc->offset], (void *)&ss,
+ sizeof(ss)) == -1) {
asprintf(&tmp, "0x%lx", args[sc->offset]);
break;
}
tmp = malloc(sys_nsig * 8); /* 7 bytes avg per signal name */
used = 0;
for (i = 1; i < sys_nsig; i++) {
- if (sigismember(&ss, i)) {
+ if (sigismember(&ss, i))
used += sprintf(tmp + used, "%s|", strsig(i));
- }
}
if (used)
tmp[used-1] = 0;
@@ -824,7 +844,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
}
case Sigprocmask: {
switch (args[sc->offset]) {
-#define S(a) case a: tmp = strdup(#a); break;
+#define S(a) case a: tmp = strdup(#a); break;
S(SIG_BLOCK);
S(SIG_UNBLOCK);
S(SIG_SETMASK);
@@ -838,10 +858,12 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
/* XXX output depends on the value of the previous argument */
switch (args[sc->offset-1]) {
case F_SETFD:
- tmp = strdup(xlookup_bits(fcntlfd_arg, args[sc->offset]));
+ tmp = strdup(xlookup_bits(fcntlfd_arg,
+ args[sc->offset]));
break;
case F_SETFL:
- tmp = strdup(xlookup_bits(fcntlfl_arg, args[sc->offset]));
+ tmp = strdup(xlookup_bits(fcntlfl_arg,
+ args[sc->offset]));
break;
case F_GETFD:
case F_GETFL:
@@ -902,7 +924,7 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
/* yuck: get ss_len */
if (get_struct(pid, (void *)args[sc->offset], (void *)&ss,
- sizeof(ss.ss_len) + sizeof(ss.ss_family)) == -1)
+ sizeof(ss.ss_len) + sizeof(ss.ss_family)) == -1)
err(1, "get_struct %p", (void *)args[sc->offset]);
/*
* If ss_len is 0, then try to guess from the sockaddr type.
@@ -922,8 +944,8 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
break;
}
}
- if (get_struct(pid, (void *)args[sc->offset], (void *)&ss, ss.ss_len)
- == -1) {
+ if (get_struct(pid, (void *)args[sc->offset], (void *)&ss,
+ ss.ss_len) == -1) {
err(2, "get_struct %p", (void *)args[sc->offset]);
}
@@ -931,12 +953,15 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
case AF_INET:
lsin = (struct sockaddr_in *)&ss;
inet_ntop(AF_INET, &lsin->sin_addr, addr, sizeof addr);
- asprintf(&tmp, "{ AF_INET %s:%d }", addr, htons(lsin->sin_port));
+ asprintf(&tmp, "{ AF_INET %s:%d }", addr,
+ htons(lsin->sin_port));
break;
case AF_INET6:
lsin6 = (struct sockaddr_in6 *)&ss;
- inet_ntop(AF_INET6, &lsin6->sin6_addr, addr, sizeof addr);
- asprintf(&tmp, "{ AF_INET6 [%s]:%d }", addr, htons(lsin6->sin6_port));
+ inet_ntop(AF_INET6, &lsin6->sin6_addr, addr,
+ sizeof addr);
+ asprintf(&tmp, "{ AF_INET6 [%s]:%d }", addr,
+ htons(lsin6->sin6_port));
break;
case AF_UNIX:
sun = (struct sockaddr_un *)&ss;
@@ -944,12 +969,14 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
break;
default:
sa = (struct sockaddr *)&ss;
- asprintf(&tmp, "{ sa_len = %d, sa_family = %d, sa_data = {%n%*s } }",
- (int)sa->sa_len, (int)sa->sa_family, &i,
- 6 * (int)(sa->sa_len - ((char *)&sa->sa_data - (char *)sa)), "");
+ asprintf(&tmp, "{ sa_len = %d, sa_family = %d, sa_data "
+ "= {%n%*s } }", (int)sa->sa_len, (int)sa->sa_family,
+ &i, 6 * (int)(sa->sa_len - ((char *)&sa->sa_data -
+ (char *)sa)), "");
if (tmp != NULL) {
p = tmp + i;
- for (q = (u_char *)&sa->sa_data; q < (u_char *)sa + sa->sa_len; q++)
+ for (q = (u_char *)&sa->sa_data;
+ q < (u_char *)sa + sa->sa_len; q++)
p += sprintf(p, " %#02x,", *q);
}
}
@@ -960,8 +987,8 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
char *hand;
const char *h;
- if (get_struct(pid, (void *)args[sc->offset], &sa, sizeof(sa)) != -1) {
-
+ if (get_struct(pid, (void *)args[sc->offset], &sa, sizeof(sa))
+ != -1) {
asprintf(&hand, "%p", sa.sa_handler);
if (sa.sa_handler == SIG_DFL)
h = "SIG_DFL";
@@ -970,13 +997,11 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
else
h = hand;
- asprintf(&tmp, "{ %s %s ss_t }",
- h,
+ asprintf(&tmp, "{ %s %s ss_t }", h,
xlookup_bits(sigaction_flags, sa.sa_flags));
free(hand);
- } else {
+ } else
asprintf(&tmp, "0x%lx", args[sc->offset]);
- }
break;
}
case Kevent: {
@@ -1001,12 +1026,15 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
if (numevents >= 0)
bytes = sizeof(struct kevent) * numevents;
if ((ke = malloc(bytes)) == NULL)
- err(1, "Cannot malloc %d bytes for kevent array", bytes);
- if (numevents >= 0 && get_struct(pid, (void *)args[sc->offset], ke, bytes) != -1) {
+ err(1, "Cannot malloc %d bytes for kevent array",
+ bytes);
+ if (numevents >= 0 && get_struct(pid, (void *)args[sc->offset],
+ ke, bytes) != -1) {
used = 0;
tmpsize = 1 + per_ke * numevents + 2;
if ((tmp = malloc(tmpsize)) == NULL)
- err(1, "Cannot alloc %d bytes for kevent output", tmpsize);
+ err(1, "Cannot alloc %d bytes for kevent "
+ "output", tmpsize);
tmp[used++] = '{';
for (i = 0; i < numevents; i++) {
@@ -1032,12 +1060,14 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
}
case Stat: {
struct stat st;
- if (get_struct(pid, (void *)args[sc->offset], &st, sizeof(st)) != -1) {
+ if (get_struct(pid, (void *)args[sc->offset], &st, sizeof(st))
+ != -1) {
char mode[12];
strmode(st.st_mode, mode);
- asprintf(&tmp, "{ mode=%s,inode=%jd,size=%jd,blksize=%ld }",
- mode,
- (intmax_t)st.st_ino,(intmax_t)st.st_size,(long)st.st_blksize);
+ asprintf(&tmp,
+ "{ mode=%s,inode=%jd,size=%jd,blksize=%ld }", mode,
+ (intmax_t)st.st_ino, (intmax_t)st.st_size,
+ (long)st.st_blksize);
} else {
asprintf(&tmp, "0x%lx", args[sc->offset]);
}
@@ -1045,24 +1075,25 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
}
case Rusage: {
struct rusage ru;
- if (get_struct(pid, (void *)args[sc->offset], &ru, sizeof(ru)) != -1) {
- asprintf(&tmp, "{ u=%ld.%06ld,s=%ld.%06ld,in=%ld,out=%ld }",
+ if (get_struct(pid, (void *)args[sc->offset], &ru, sizeof(ru))
+ != -1) {
+ asprintf(&tmp,
+ "{ u=%ld.%06ld,s=%ld.%06ld,in=%ld,out=%ld }",
(long)ru.ru_utime.tv_sec, ru.ru_utime.tv_usec,
(long)ru.ru_stime.tv_sec, ru.ru_stime.tv_usec,
ru.ru_inblock, ru.ru_oublock);
- } else {
+ } else
asprintf(&tmp, "0x%lx", args[sc->offset]);
- }
break;
}
case Rlimit: {
struct rlimit rl;
- if (get_struct(pid, (void *)args[sc->offset], &rl, sizeof(rl)) != -1) {
+ if (get_struct(pid, (void *)args[sc->offset], &rl, sizeof(rl))
+ != -1) {
asprintf(&tmp, "{ cur=%ju,max=%ju }",
rl.rlim_cur, rl.rlim_max);
- } else {
+ } else
asprintf(&tmp, "0x%lx", args[sc->offset]);
- }
break;
}
default:
@@ -1079,27 +1110,31 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct trus
*/
void
-print_syscall(struct trussinfo *trussinfo, const char *name, int nargs, char **s_args)
+print_syscall(struct trussinfo *trussinfo, const char *name, int nargs,
+ char **s_args)
{
- int i;
- int len = 0;
struct timespec timediff;
+ int i, len;
+ len = 0;
if (trussinfo->flags & FOLLOWFORKS)
len += fprintf(trussinfo->outfile, "%5d: ", trussinfo->pid);
- if (name != NULL && (!strcmp(name, "execve") || !strcmp(name, "exit"))) {
- clock_gettime(CLOCK_REALTIME, &trussinfo->after);
+ if (name != NULL && (strcmp(name, "execve") == 0 ||
+ strcmp(name, "exit") == 0)) {
+ clock_gettime(CLOCK_REALTIME, &trussinfo->curthread->after);
}
if (trussinfo->flags & ABSOLUTETIMESTAMPS) {
- timespecsubt(&trussinfo->after, &trussinfo->start_time, &timediff);
+ timespecsubt(&trussinfo->curthread->after,
+ &trussinfo->start_time, &timediff);
len += fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec, timediff.tv_nsec);
}
if (trussinfo->flags & RELATIVETIMESTAMPS) {
- timespecsubt(&trussinfo->after, &trussinfo->before, &timediff);
+ timespecsubt(&trussinfo->curthread->after,
+ &trussinfo->curthread->before, &timediff);
len += fprintf(trussinfo->outfile, "%ld.%09ld ",
(long)timediff.tv_sec, timediff.tv_nsec);
}
@@ -1110,8 +1145,10 @@ print_syscall(struct trussinfo *trussinfo, const char *name, int nargs, char **s
if (s_args[i])
len += fprintf(trussinfo->outfile, "%s", s_args[i]);
else
- len += fprintf(trussinfo->outfile, "<missing argument>");
- len += fprintf(trussinfo->outfile, "%s", i < (nargs - 1) ? "," : "");
+ len += fprintf(trussinfo->outfile,
+ "<missing argument>");
+ len += fprintf(trussinfo->outfile, "%s", i < (nargs - 1) ?
+ "," : "");
}
len += fprintf(trussinfo->outfile, ")");
for (i = 0; i < 6 - (len / 8); i++)
@@ -1127,8 +1164,9 @@ print_syscall_ret(struct trussinfo *trussinfo, const char *name, int nargs,
if (trussinfo->flags & COUNTONLY) {
if (!sc)
return;
- clock_gettime(CLOCK_REALTIME, &trussinfo->after);
- timespecsubt(&trussinfo->after, &trussinfo->before, &timediff);
+ clock_gettime(CLOCK_REALTIME, &trussinfo->curthread->after);
+ timespecsubt(&trussinfo->curthread->after,
+ &trussinfo->curthread->before, &timediff);
timespecadd(&sc->time, &timediff, &sc->time);
sc->ncalls++;
if (errorp)
@@ -1138,14 +1176,15 @@ print_syscall_ret(struct trussinfo *trussinfo, const char *name, int nargs,
print_syscall(trussinfo, name, nargs, s_args);
fflush(trussinfo->outfile);
- if (errorp) {
- fprintf(trussinfo->outfile, " ERR#%ld '%s'\n", retval, strerror(retval));
- } else {
+ if (errorp)
+ fprintf(trussinfo->outfile, " ERR#%ld '%s'\n", retval,
+ strerror(retval));
+ else {
/*
* Because pipe(2) has a special assembly glue to provide the
* libc API, we have to adjust retval.
*/
- if (name != NULL && !strcmp(name, "pipe"))
+ if (name != NULL && strcmp(name, "pipe") == 0)
retval = 0;
fprintf(trussinfo->outfile, " = %ld (0x%lx)\n", retval, retval);
}
@@ -1154,12 +1193,12 @@ print_syscall_ret(struct trussinfo *trussinfo, const char *name, int nargs,
void
print_summary(struct trussinfo *trussinfo)
{
- struct syscall *sc;
struct timespec total = {0, 0};
+ struct syscall *sc;
int ncall, nerror;
fprintf(trussinfo->outfile, "%-20s%15s%8s%8s\n",
- "syscall", "seconds", "calls", "errors");
+ "syscall", "seconds", "calls", "errors");
ncall = nerror = 0;
for (sc = syscalls; sc->name != NULL; sc++)
if (sc->ncalls) {
@@ -1171,7 +1210,7 @@ print_summary(struct trussinfo *trussinfo)
nerror += sc->nerror;
}
fprintf(trussinfo->outfile, "%20s%15s%8s%8s\n",
- "", "-------------", "-------", "-------");
+ "", "-------------", "-------", "-------");
fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n",
- "", (intmax_t)total.tv_sec, total.tv_nsec, ncall, nerror);
+ "", (intmax_t)total.tv_sec, total.tv_nsec, ncall, nerror);
}
diff --git a/usr.bin/truss/truss.h b/usr.bin/truss/truss.h
index 4bf5a55..dcc86a5 100644
--- a/usr.bin/truss/truss.h
+++ b/usr.bin/truss/truss.h
@@ -27,13 +27,13 @@
#include <sys/queue.h>
-#define FOLLOWFORKS 0x00000001
-#define RELATIVETIMESTAMPS 0x00000002
-#define ABSOLUTETIMESTAMPS 0x00000004
-#define NOSIGS 0x00000008
-#define EXECVEARGS 0x00000010
-#define EXECVEENVS 0x00000020
-#define COUNTONLY 0x00000040
+#define FOLLOWFORKS 0x00000001
+#define RELATIVETIMESTAMPS 0x00000002
+#define ABSOLUTETIMESTAMPS 0x00000004
+#define NOSIGS 0x00000008
+#define EXECVEARGS 0x00000010
+#define EXECVEENVS 0x00000020
+#define COUNTONLY 0x00000040
struct threadinfo
{
@@ -41,11 +41,14 @@ struct threadinfo
lwpid_t tid;
int in_syscall;
int in_fork;
+ void *fsc;
+ struct timespec before;
+ struct timespec after;
};
struct trussinfo
{
- int pid;
+ pid_t pid;
int flags;
int pr_why;
int pr_data;
@@ -53,15 +56,13 @@ struct trussinfo
FILE *outfile;
struct timespec start_time;
- struct timespec before;
- struct timespec after;
struct threadinfo *curthread;
-
+
SLIST_HEAD(, threadinfo) threadlist;
};
-#define timespecsubt(tvp, uvp, vvp) \
+#define timespecsubt(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_nsec = (tvp)->tv_nsec - (uvp)->tv_nsec; \
@@ -71,7 +72,7 @@ struct trussinfo
} \
} while (0)
-#define timespecadd(tvp, uvp, vvp) \
+#define timespecadd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_nsec = (tvp)->tv_nsec + (uvp)->tv_nsec; \
@@ -81,9 +82,10 @@ struct trussinfo
} \
} while (0)
-#define S_NONE 0
-#define S_SCE 1
-#define S_SCX 2
-#define S_EXIT 3
-#define S_SIG 4
-#define S_EXEC 5
+#define S_NONE 0
+#define S_SCE 1
+#define S_SCX 2
+#define S_EXIT 3
+#define S_SIG 4
+#define S_EXEC 5
+#define S_DETACHED 6
diff --git a/usr.bin/tset/extern.h b/usr.bin/tset/extern.h
index 833870e..f4a6514 100644
--- a/usr.bin/tset/extern.h
+++ b/usr.bin/tset/extern.h
@@ -30,9 +30,12 @@
* $FreeBSD$
*/
+#include <termios.h>
+
extern struct termios mode, oldmode;
extern int Columns, isreset, Lines;
extern int erasech, intrchar, killch;
+extern speed_t Ospeed;
void add_mapping(const char *, char *);
void cat(char *);
diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c
index 8de594f..715f514 100644
--- a/usr.bin/tset/map.c
+++ b/usr.bin/tset/map.c
@@ -44,8 +44,7 @@ static const char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/9/93";
#include "extern.h"
-extern speed_t Ospeed;
-speed_t tset_baudrate(char *);
+static speed_t tset_baudrate(char *);
/* Baud rate conditionals for mapping. */
#define GT 0x01
@@ -63,7 +62,7 @@ typedef struct map {
speed_t speed; /* Baud rate to compare against. */
} MAP;
-MAP *cur, *maplist;
+static MAP *cur, *maplist;
/*
* Syntax for -m:
@@ -224,7 +223,7 @@ typedef struct speeds {
speed_t speed;
} SPEEDS;
-SPEEDS speeds[] = {
+static SPEEDS speeds[] = {
{ "0", B0 },
{ "134.5", B134 },
{ "exta", B19200 },
@@ -232,7 +231,7 @@ SPEEDS speeds[] = {
{ NULL, 0 }
};
-speed_t
+static speed_t
tset_baudrate(char *rate)
{
SPEEDS *sp;
diff --git a/usr.bin/tset/term.c b/usr.bin/tset/term.c
index 544e928..106c98f 100644
--- a/usr.bin/tset/term.c
+++ b/usr.bin/tset/term.c
@@ -46,7 +46,7 @@ static const char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93";
#include <ttyent.h>
#include "extern.h"
-char tbuf[1024]; /* Termcap entry. */
+static char tbuf[1024]; /* Termcap entry. */
const char *askuser(const char *);
char *ttys(char *);
diff --git a/usr.bin/unzip/unzip.1 b/usr.bin/unzip/unzip.1
index 04ecd23..0c54051 100644
--- a/usr.bin/unzip/unzip.1
+++ b/usr.bin/unzip/unzip.1
@@ -50,7 +50,7 @@ Extract to stdout/screen.
When extracting files from the zipfile, they are written to stdout.
This is similar to
.Fl p ,
-but doesn't suppress normal output.
+but does not suppress normal output.
.It Fl d Ar dir
Extract files into the specified directory rather than the current
directory.
diff --git a/usr.bin/usbhidctl/usbhidctl.1 b/usr.bin/usbhidctl/usbhidctl.1
index f3c5576..bb7d958 100644
--- a/usr.bin/usbhidctl/usbhidctl.1
+++ b/usr.bin/usbhidctl/usbhidctl.1
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd August 01, 2011
+.Dd August 1, 2011
.Dt USBHIDCTL 1
.Os
.Sh NAME
diff --git a/usr.bin/users/users.1 b/usr.bin/users/users.1
index e2d604d..53252e5 100644
--- a/usr.bin/users/users.1
+++ b/usr.bin/users/users.1
@@ -28,7 +28,7 @@
.\" @(#)users.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd June 6, 1993
+.Dd January 21, 2010
.Dt USERS 1
.Os
.Sh NAME
diff --git a/usr.bin/uuencode/uuencode.1 b/usr.bin/uuencode/uuencode.1
index 1cf4a4b..2c31bdc 100644
--- a/usr.bin/uuencode/uuencode.1
+++ b/usr.bin/uuencode/uuencode.1
@@ -183,7 +183,7 @@ tree.
.Pp
.Bd -literal -offset indent -compact
tar cf \- src_tree \&| compress \&|
-uuencode src_tree.tar.Z \&| mail sys1!sys2!user
+uuencode src_tree.tar.Z \&| mail user@example.com
.Ed
.Pp
The following example unpacks all uuencoded
diff --git a/usr.bin/w/w.1 b/usr.bin/w/w.1
index 0c43dcd..345db49 100644
--- a/usr.bin/w/w.1
+++ b/usr.bin/w/w.1
@@ -28,7 +28,7 @@
.\" @(#)w.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd June 6, 1993
+.Dd January 21, 2010
.Dt W 1
.Os
.Sh NAME
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 8441ce5..2e19bb1 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -447,7 +447,7 @@ pr_header(time_t *nowp, int nusers)
/*
* Print how long system has been up.
*/
- if (clock_gettime(CLOCK_MONOTONIC, &tp) != -1) {
+ if (clock_gettime(CLOCK_UPTIME, &tp) != -1) {
uptime = tp.tv_sec;
if (uptime > 60)
uptime += 30;
diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c
index dafd448..b3a63dc 100644
--- a/usr.bin/wall/wall.c
+++ b/usr.bin/wall/wall.c
@@ -240,7 +240,8 @@ makemsg(char *fname)
setegid(getgid());
if (freopen(fname, "r", stdin) == NULL)
err(1, "can't read %s", fname);
- setegid(egid);
+ if (setegid(egid) != 0)
+ err(1, "setegid failed");
}
cnt = 0;
while (fgetws(lbuf, sizeof(lbuf)/sizeof(wchar_t), stdin)) {
diff --git a/usr.bin/who/who.1 b/usr.bin/who/who.1
index e869493..d23ef8e 100644
--- a/usr.bin/who/who.1
+++ b/usr.bin/who/who.1
@@ -51,7 +51,7 @@ The options are as follows:
.It Fl a
Equivalent to
.Fl bTu ,
-with the exception that output isn't restricted to the time and date of
+with the exception that output is not restricted to the time and date of
the last system reboot.
.It Fl b
Write the time and date of the last system reboot.
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index a920f85..583348a 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <grp.h>
#include <paths.h>
#include <pwd.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -671,11 +672,18 @@ copy(int from_fd, const char *from_name, int to_fd, const char *to_name,
if (size <= 8 * 1048576 && trymmap(from_fd) &&
(p = mmap(NULL, (size_t)size, PROT_READ, MAP_SHARED,
from_fd, (off_t)0)) != (char *)MAP_FAILED) {
- if ((nw = write(to_fd, p, size)) != size) {
+ nw = write(to_fd, p, size);
+ if (nw != size) {
serrno = errno;
(void)unlink(to_name);
- errno = nw > 0 ? EIO : serrno;
- err(EX_OSERR, "%s", to_name);
+ if (nw >= 0) {
+ errx(EX_OSERR,
+ "short write to %s: %jd bytes written, %jd bytes asked to write",
+ to_name, (uintmax_t)nw, (uintmax_t)size);
+ } else {
+ errno = serrno;
+ err(EX_OSERR, "%s", to_name);
+ }
}
done_copy = 1;
}
@@ -684,8 +692,15 @@ copy(int from_fd, const char *from_name, int to_fd, const char *to_name,
if ((nw = write(to_fd, buf, nr)) != nr) {
serrno = errno;
(void)unlink(to_name);
- errno = nw > 0 ? EIO : serrno;
- err(EX_OSERR, "%s", to_name);
+ if (nw >= 0) {
+ errx(EX_OSERR,
+ "short write to %s: %jd bytes written, %jd bytes asked to write",
+ to_name, (uintmax_t)nw,
+ (uintmax_t)size);
+ } else {
+ errno = serrno;
+ err(EX_OSERR, "%s", to_name);
+ }
}
if (nr != 0) {
serrno = errno;
diff --git a/usr.bin/xlint/Makefile.inc b/usr.bin/xlint/Makefile.inc
index cd8de6f..d63a84b 100644
--- a/usr.bin/xlint/Makefile.inc
+++ b/usr.bin/xlint/Makefile.inc
@@ -8,7 +8,7 @@ WARNS?= 0
# These assignments duplicate much of the functionality of
# MACHINE_CPUARCH, but there's no easy way to export make functions...
.if defined(TARGET_ARCH)
-TARGET_CPUARCH= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/}
+TARGET_CPUARCH= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/}
.else
TARGET_CPUARCH= ${MACHINE_CPUARCH}
TARGET_ARCH= ${MACHINE_ARCH}
diff --git a/usr.bin/xlint/lint1/makeman b/usr.bin/xlint/lint1/makeman
index d5be8bf..7aa060c 100644
--- a/usr.bin/xlint/lint1/makeman
+++ b/usr.bin/xlint/lint1/makeman
@@ -46,13 +46,6 @@ cat << \__EOF
.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the NetBSD
-.\" Foundation, Inc. and its contributors.
-.\" 4. Neither the name of The NetBSD Foundation nor the names of its
-.\" contributors may be used to endorse or promote products derived
-.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
diff --git a/usr.bin/yes/yes.1 b/usr.bin/yes/yes.1
index cd14842..67bed7c 100644
--- a/usr.bin/yes/yes.1
+++ b/usr.bin/yes/yes.1
@@ -49,4 +49,4 @@ forever.
The
.Nm
command appeared in
-.At 32v .
+.At v7 .
OpenPOWER on IntegriCloud