aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/bsdcat/Makefile2
-rw-r--r--usr.bin/calendar/calendars/calendar.freebsd1
-rw-r--r--usr.bin/cpio/Makefile2
-rw-r--r--usr.bin/cpio/tests/Makefile2
-rw-r--r--usr.bin/cut/cut.c4
-rw-r--r--usr.bin/find/find.c2
-rw-r--r--usr.bin/id/id.128
-rw-r--r--usr.bin/id/id.c154
-rw-r--r--usr.bin/kyua/Makefile10
-rw-r--r--usr.bin/login/login.conf4
-rw-r--r--usr.bin/mandoc/mandoc.ucl20
-rw-r--r--usr.bin/mkimg/mkimg.c21
-rw-r--r--usr.bin/ncurses/Makefile2
-rw-r--r--usr.bin/netstat/inet.c37
-rw-r--r--usr.bin/netstat/main.c4
-rw-r--r--usr.bin/sockstat/main.c214
-rw-r--r--usr.bin/sockstat/sockstat.113
-rw-r--r--usr.bin/sockstat/tests/Makefile3
-rwxr-xr-xusr.bin/tail/tests/tail_test.sh2
-rw-r--r--usr.bin/tar/Makefile2
-rw-r--r--usr.bin/tar/tests/Makefile1
-rw-r--r--usr.bin/unzip/Makefile2
-rw-r--r--usr.bin/unzip/tests/Makefile2
-rw-r--r--usr.bin/vmstat/vmstat.c4
-rw-r--r--usr.bin/w/w.c33
25 files changed, 387 insertions, 182 deletions
diff --git a/usr.bin/bsdcat/Makefile b/usr.bin/bsdcat/Makefile
index 032207217be6..06081fc2b2f8 100644
--- a/usr.bin/bsdcat/Makefile
+++ b/usr.bin/bsdcat/Makefile
@@ -11,7 +11,7 @@ BSDCAT_VERSION_STRING!= sed -n '/define.*ARCHIVE_VERSION_ONLY_STRING/{s,[^0-9.],
SRCS= bsdcat.c cmdline.c
.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
-SRCS+= err.c
+SRCS+= lafe_err.c
CFLAGS+= -DBSDCAT_VERSION_STRING=\"${BSDCAT_VERSION_STRING}\"
CFLAGS+= -DPLATFORM_CONFIG_H=\"${_LIBARCHIVECONFDIR}/config_freebsd.h\"
diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd
index b6e18083e24b..b85f2f1dee35 100644
--- a/usr.bin/calendar/calendars/calendar.freebsd
+++ b/usr.bin/calendar/calendars/calendar.freebsd
@@ -175,6 +175,7 @@
04/22 Jakub Klama <jceel@FreeBSD.org> born in Blachownia, Silesia, Poland, 1989
04/25 Richard Gallamore <ultima@FreeBSD.org> born in Kissimmee, Florida, United States, 1987
04/26 Rene Ladan <rene@FreeBSD.org> born in Geldrop, the Netherlands, 1980
+04/27 Jose Luis Duran <jlduran@FreeBSD.org> born in Panama City, Panama, 1978
04/28 Oleg Bulyzhin <oleg@FreeBSD.org> born in Kharkov, USSR, 1976
04/28 Andriy Voskoboinyk <avos@FreeBSD.org> born in Bila Tserkva, Ukraine, 1992
04/28 Nuno Teixeira <eduardo@FreeBSD.org> born in Aveiro, Portugal, 1974
diff --git a/usr.bin/cpio/Makefile b/usr.bin/cpio/Makefile
index 46fe36d8c18e..31b25e4199da 100644
--- a/usr.bin/cpio/Makefile
+++ b/usr.bin/cpio/Makefile
@@ -11,7 +11,7 @@ BSDCPIO_VERSION_STRING!= sed -n '/define.*ARCHIVE_VERSION_ONLY_STRING/{s,[^0-9.]
SRCS= cpio.c cmdline.c
.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
-SRCS+= err.c line_reader.c passphrase.c
+SRCS+= lafe_err.c line_reader.c passphrase.c
CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\"
CFLAGS+= -DPLATFORM_CONFIG_H=\"${_LIBARCHIVECONFDIR}/config_freebsd.h\"
diff --git a/usr.bin/cpio/tests/Makefile b/usr.bin/cpio/tests/Makefile
index 9e1028c7eb58..ee4da15bc7e4 100644
--- a/usr.bin/cpio/tests/Makefile
+++ b/usr.bin/cpio/tests/Makefile
@@ -26,7 +26,7 @@ CFLAGS.test_utils.c+= -Wno-cast-align
CPIO_SRCS= cmdline.c
.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
-CPIO_SRCS+= err.c
+CPIO_SRCS+= lafe_err.c
.PATH: ${_LIBARCHIVEDIR}/cpio/test
TESTS_SRCS= \
diff --git a/usr.bin/cut/cut.c b/usr.bin/cut/cut.c
index 60ff5a31062a..e4e322b4e5c9 100644
--- a/usr.bin/cut/cut.c
+++ b/usr.bin/cut/cut.c
@@ -448,8 +448,8 @@ f_cut(FILE *fp, const char *fname)
break;
}
if (*pos)
- for (i = 0; i < (int)clen; i++)
- putchar(p[i - clen]);
+ (void)fwrite(p - clen, 1, clen,
+ stdout);
}
if (ch == '\n')
break;
diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c
index 8b24ecd6a306..2247ae86a94b 100644
--- a/usr.bin/find/find.c
+++ b/usr.bin/find/find.c
@@ -211,7 +211,7 @@ find_execute(PLAN *plan, char *paths[])
}
if (showinfo) {
- fprintf(stderr, "Scanning: %s/%s\n", entry->fts_path, entry->fts_name);
+ fprintf(stderr, "Scanning: %s\n", entry->fts_path);
fprintf(stderr, "Scanned: %zu\n\n", counter);
showinfo = 0;
}
diff --git a/usr.bin/id/id.1 b/usr.bin/id/id.1
index b8dafb6650b0..62c941f84798 100644
--- a/usr.bin/id/id.1
+++ b/usr.bin/id/id.1
@@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 5, 2011
+.Dd October 23, 2025
.Dt ID 1
.Os
.Sh NAME
@@ -50,12 +50,18 @@
.Nm
.Fl c
.Nm
+.Fl d
+.Op Ar user
+.Nm
.Fl g Op Fl nr
.Op Ar user
.Nm
.Fl p
.Op Ar user
.Nm
+.Fl s
+.Op Ar user
+.Nm
.Fl u Op Fl nr
.Op Ar user
.Sh DESCRIPTION
@@ -90,6 +96,8 @@ Ignored for compatibility with other
implementations.
.It Fl c
Display current login class.
+.It Fl d
+Display the home directory of the current or specified user.
.It Fl g
Display the effective group ID as a number.
.It Fl n
@@ -128,6 +136,8 @@ Display the real ID for the
and
.Fl u
options instead of the effective ID.
+.It Fl s
+Display the shell of the current or specified user.
.It Fl u
Display the effective user ID as a number.
.El
@@ -174,8 +184,20 @@ bob pts/5 Dec 4 19:51
.Sh STANDARDS
The
.Nm
-function is expected to conform to
-.St -p1003.2 .
+utility is expected to conform to
+.St -p1003.1-2024 .
+The
+.Fl A ,
+.Fl M ,
+.Fl P ,
+.Fl c ,
+.Fl d ,
+.Fl p ,
+and
+.Fl s
+options are
+.Fx
+extensions.
.Sh HISTORY
The
historic
diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c
index 7112e0dddb91..5f9d2670caa3 100644
--- a/usr.bin/id/id.c
+++ b/usr.bin/id/id.c
@@ -53,79 +53,94 @@ static void pretty(struct passwd *);
#ifdef USE_BSM_AUDIT
static void auditid(void);
#endif
-static void group(struct passwd *, int);
+static void group(struct passwd *, bool);
static void maclabel(void);
+static void dir(struct passwd *);
+static void shell(struct passwd *);
static void usage(void);
static struct passwd *who(char *);
-static int isgroups, iswhoami;
+static bool isgroups, iswhoami;
int
main(int argc, char *argv[])
{
struct group *gr;
struct passwd *pw;
- int Gflag, Mflag, Pflag, ch, gflag, id, nflag, pflag, rflag, uflag;
- int Aflag, cflag;
- int error;
- const char *myname;
+#ifdef USE_BSM_AUDIT
+ bool Aflag;
+#endif
+ bool Gflag, Mflag, Pflag;
+ bool cflag, dflag, gflag, nflag, pflag, rflag, sflag, uflag;
+ int ch, combo, error, id;
+ const char *myname, *optstr;
char loginclass[MAXLOGNAME];
- Gflag = Mflag = Pflag = gflag = nflag = pflag = rflag = uflag = 0;
- Aflag = cflag = 0;
+#ifdef USE_BSM_AUDIT
+ Aflag = false;
+#endif
+ Gflag = Mflag = Pflag = false;
+ cflag = dflag = gflag = nflag = pflag = rflag = sflag = uflag = false;
- myname = strrchr(argv[0], '/');
- myname = (myname != NULL) ? myname + 1 : argv[0];
+ myname = getprogname();
+ optstr = "AGMPacdgnprsu";
if (strcmp(myname, "groups") == 0) {
- isgroups = 1;
- Gflag = nflag = 1;
+ isgroups = true;
+ optstr = "";
+ Gflag = nflag = true;
}
else if (strcmp(myname, "whoami") == 0) {
- iswhoami = 1;
- uflag = nflag = 1;
+ iswhoami = true;
+ optstr = "";
+ uflag = nflag = true;
}
- while ((ch = getopt(argc, argv,
- (isgroups || iswhoami) ? "" : "APGMacgnpru")) != -1)
+ while ((ch = getopt(argc, argv, optstr)) != -1) {
switch(ch) {
#ifdef USE_BSM_AUDIT
case 'A':
- Aflag = 1;
+ Aflag = true;
break;
#endif
case 'G':
- Gflag = 1;
+ Gflag = true;
break;
case 'M':
- Mflag = 1;
+ Mflag = true;
break;
case 'P':
- Pflag = 1;
+ Pflag = true;
break;
case 'a':
break;
case 'c':
- cflag = 1;
+ cflag = true;
+ break;
+ case 'd':
+ dflag = true;
break;
case 'g':
- gflag = 1;
+ gflag = true;
break;
case 'n':
- nflag = 1;
+ nflag = true;
break;
case 'p':
- pflag = 1;
+ pflag = true;
break;
case 'r':
- rflag = 1;
+ rflag = true;
+ break;
+ case 's':
+ sflag = true;
break;
case 'u':
- uflag = 1;
+ uflag = true;
break;
- case '?':
default:
usage();
}
+ }
argc -= optind;
argv += optind;
@@ -134,16 +149,13 @@ main(int argc, char *argv[])
if ((cflag || Aflag || Mflag) && argc > 0)
usage();
- switch(Aflag + Gflag + Mflag + Pflag + gflag + pflag + uflag) {
- case 1:
- break;
- case 0:
- if (!nflag && !rflag)
- break;
- /* FALLTHROUGH */
- default:
+ combo = Aflag + Gflag + Mflag + Pflag + gflag + pflag + uflag;
+ if (combo + dflag + sflag > 1)
+ usage();
+ if (combo > 1)
+ usage();
+ if (combo == 0 && (nflag || rflag))
usage();
- }
pw = *argv ? who(*argv) : NULL;
@@ -183,6 +195,11 @@ main(int argc, char *argv[])
exit(0);
}
+ if (dflag) {
+ dir(pw);
+ exit(0);
+ }
+
if (Gflag) {
group(pw, nflag);
exit(0);
@@ -203,6 +220,11 @@ main(int argc, char *argv[])
exit(0);
}
+ if (sflag) {
+ shell(pw);
+ exit(0);
+ }
+
id_print(pw);
exit(0);
}
@@ -217,7 +239,7 @@ pretty(struct passwd *pw)
if (pw) {
(void)printf("uid\t%s\n", pw->pw_name);
(void)printf("groups\t");
- group(pw, 1);
+ group(pw, true);
} else {
if ((login = getlogin()) == NULL)
err(1, "getlogin");
@@ -243,7 +265,7 @@ pretty(struct passwd *pw)
(void)printf("rgid\t%u\n", rid);
}
(void)printf("groups\t");
- group(NULL, 1);
+ group(NULL, true);
}
}
@@ -366,7 +388,7 @@ auditid(void)
#endif
static void
-group(struct passwd *pw, int nflag)
+group(struct passwd *pw, bool nflag)
{
struct group *gr;
int cnt, id, lastid, ngroups;
@@ -452,41 +474,57 @@ who(char *u)
static void
pline(struct passwd *pw)
{
-
- if (!pw) {
+ if (pw == NULL) {
if ((pw = getpwuid(getuid())) == NULL)
err(1, "getpwuid");
}
-
(void)printf("%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s\n", pw->pw_name,
- pw->pw_passwd, pw->pw_uid, pw->pw_gid, pw->pw_class,
- (long)pw->pw_change, (long)pw->pw_expire, pw->pw_gecos,
- pw->pw_dir, pw->pw_shell);
+ pw->pw_passwd, pw->pw_uid, pw->pw_gid, pw->pw_class,
+ (long)pw->pw_change, (long)pw->pw_expire, pw->pw_gecos,
+ pw->pw_dir, pw->pw_shell);
}
+static void
+dir(struct passwd *pw)
+{
+ if (pw == NULL) {
+ if ((pw = getpwuid(getuid())) == NULL)
+ err(1, "getpwuid");
+ }
+ printf("%s\n", pw->pw_dir);
+}
static void
-usage(void)
+shell(struct passwd *pw)
{
+ if (pw == NULL) {
+ if ((pw = getpwuid(getuid())) == NULL)
+ err(1, "getpwuid");
+ }
+ printf("%s\n", pw->pw_shell);
+}
+static void
+usage(void)
+{
if (isgroups)
(void)fprintf(stderr, "usage: groups [user]\n");
else if (iswhoami)
(void)fprintf(stderr, "usage: whoami\n");
else
- (void)fprintf(stderr, "%s\n%s%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
- "usage: id [user]",
+ (void)fprintf(stderr,
+ "usage: id [user]\n"
#ifdef USE_BSM_AUDIT
- " id -A\n",
-#else
- "",
+ " id -A\n"
#endif
- " id -G [-n] [user]",
- " id -M",
- " id -P [user]",
- " id -c",
- " id -g [-nr] [user]",
- " id -p [user]",
- " id -u [-nr] [user]");
+ " id -G [-n] [user]\n"
+ " id -M\n"
+ " id -P [user]\n"
+ " id -c\n"
+ " id -d [user]\n"
+ " id -g [-nr] [user]\n"
+ " id -p [user]\n"
+ " id -s [user]\n"
+ " id -u [-nr] [user]\n");
exit(1);
}
diff --git a/usr.bin/kyua/Makefile b/usr.bin/kyua/Makefile
index 178a1d083b79..d6131651afbf 100644
--- a/usr.bin/kyua/Makefile
+++ b/usr.bin/kyua/Makefile
@@ -182,25 +182,25 @@ FILESGROUPS+= EXAMPLES
CONFS= kyua.conf-default
CONFSDIR= ${KYUA_CONFDIR}
CONFSNAME= kyua.conf
-CONFSDIRTAGS= package=tests
+CONFSDIRTAGS= package=kyua
DOCS= AUTHORS CONTRIBUTORS LICENSE
DOCSDIR= ${KYUA_DOCDIR}
-DOCSTAGS= package=tests
+DOCSTAGS= package=kyua
EXAMPLES= Kyuafile.top kyua.conf
EXAMPLESDIR= ${KYUA_EGDIR}
-EXAMPLESTAGS= package=tests
+EXAMPLESTAGS= package=kyua
.PATH: ${KYUA_SRCDIR}/examples
MISC= context.html index.html report.css test_result.html
MISCDIR= ${KYUA_MISCDIR}
-MISCTAGS= package=tests
+MISCTAGS= package=kyua
.PATH: ${KYUA_SRCDIR}/misc
STORE= migrate_v1_v2.sql migrate_v2_v3.sql schema_v3.sql
STOREDIR= ${KYUA_STOREDIR}
-STORETAGS= package=tests
+STORETAGS= package=kyua
.PATH: ${KYUA_SRCDIR}/store
CLEANFILES+= ${MAN}
diff --git a/usr.bin/login/login.conf b/usr.bin/login/login.conf
index 1069da17b4db..c65a83caa565 100644
--- a/usr.bin/login/login.conf
+++ b/usr.bin/login/login.conf
@@ -46,7 +46,6 @@ default:\
:umtxp=unlimited:\
:pipebuf=unlimited:\
:priority=0:\
- :ignoretime@:\
:umask=022:\
:charset=UTF-8:\
:lang=C.UTF-8:
@@ -149,7 +148,6 @@ russian|Russian Users Accounts:\
# :requirehome:\
# :passwordtime=90d:\
# :umask=002:\
-# :ignoretime@:\
# :tc=default:
#
#
@@ -174,7 +172,6 @@ russian|Russian Users Accounts:\
##
#staff:\
# :ignorenologin:\
-# :ignoretime:\
# :requirehome@:\
# :accounted@:\
# :path=~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin:\
@@ -265,7 +262,6 @@ russian|Russian Users Accounts:\
## - no time accounting, restricted to access via dialin lines
##
#site:\
-# :ignoretime:\
# :passwordtime@:\
# :refreshtime@:\
# :refreshperiod@:\
diff --git a/usr.bin/mandoc/mandoc.ucl b/usr.bin/mandoc/mandoc.ucl
index f320b6f547fd..75b8123d55cc 100644
--- a/usr.bin/mandoc/mandoc.ucl
+++ b/usr.bin/mandoc/mandoc.ucl
@@ -1,10 +1,14 @@
-path_glob: "/usr/share/man/*"
+path_glob: [
+ "/usr/share/man/*",
+ "/usr/share/openssl/man/*",
+]
cleanup: {
type: lua
sandbox: false
script: <<EOD
os.remove("/usr/share/man/mandoc.db")
+ os.remove("/usr/share/openssl/man/mandoc.db")
EOD
}
@@ -12,7 +16,17 @@ trigger: {
type: lua
sandbox: false
script: <<EOD
- print("Generating apropos(1) database...")
- pkg.exec({"/usr/bin/makewhatis", "/usr/share/man"})
+
+ local dirs = {
+ "/usr/share/man",
+ "/usr/share/openssl/man",
+ }
+
+ for _,dir in ipairs(dirs) do
+ if pkg.stat(dir) then
+ print("Generating apropos(1) database for "..dir.."...")
+ pkg.exec({"/usr/bin/makewhatis", dir})
+ end
+ end
EOD
}
diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c
index a7409b686560..27b79b82ca02 100644
--- a/usr.bin/mkimg/mkimg.c
+++ b/usr.bin/mkimg/mkimg.c
@@ -142,8 +142,10 @@ static void
usage(const char *why)
{
- warnx("error: %s", why);
- fputc('\n', stderr);
+ if (why != NULL) {
+ warnx("error: %s", why);
+ fputc('\n', stderr);
+ }
fprintf(stderr, "usage: %s <options>\n", getprogname());
fprintf(stderr, " options:\n");
@@ -171,19 +173,19 @@ usage(const char *why)
print_schemes(1);
fputc('\n', stderr);
fprintf(stderr, " partition specification:\n");
- fprintf(stderr, "\t<t>[/<l>]::<size>[:[+]<offset>]\t- "
+ fprintf(stderr, "\t<type>[/<label>]::<size>[:[+]<offset>]\t- "
"empty partition of given size and\n\t\t\t\t\t"
" optional relative or absolute offset\n");
- fprintf(stderr, "\t<t>[/<l>]:=<file>[:[+]offset]\t- partition "
+ fprintf(stderr, "\t<type>[/<label>]:=<file>[:[+]offset]\t- partition "
"content and size are\n\t\t\t\t\t"
" determined by the named file and\n"
"\t\t\t\t\t optional relative or absolute offset\n");
- fprintf(stderr, "\t<t>[/<l>]:-<cmd>\t\t- partition content and size "
+ fprintf(stderr, "\t<type>[/<label>]:-<cmd>\t\t- partition content and size "
"are taken\n\t\t\t\t\t from the output of the command to run\n");
fprintf(stderr, "\t-\t\t\t\t- unused partition entry\n");
fprintf(stderr, "\t where:\n");
- fprintf(stderr, "\t\t<t>\t- scheme neutral partition type\n");
- fprintf(stderr, "\t\t<l>\t- optional scheme-dependent partition "
+ fprintf(stderr, "\t\t<type>\t- scheme neutral partition type\n");
+ fprintf(stderr, "\t\t<label>\t- optional scheme-dependent partition "
"label\n");
exit(EX_USAGE);
@@ -564,7 +566,7 @@ main(int argc, char *argv[])
bcfd = -1;
outfd = 1; /* Write to stdout by default */
- while ((c = getopt_long(argc, argv, "a:b:c:C:f:o:p:s:t:vyH:P:S:T:",
+ while ((c = getopt_long(argc, argv, "a:b:c:C:f:ho:p:s:t:vyH:P:S:T:",
longopts, NULL)) != -1) {
switch (c) {
case 'a': /* ACTIVE PARTITION, if supported */
@@ -596,6 +598,9 @@ main(int argc, char *argv[])
if (error)
errc(EX_DATAERR, error, "format");
break;
+ case 'h': /* HELP */
+ usage(NULL);
+ break;
case 'o': /* OUTPUT FILE */
if (outfd != 1)
usage("multiple output files given");
diff --git a/usr.bin/ncurses/Makefile b/usr.bin/ncurses/Makefile
index 33001e6ab568..1ed8a2d9a915 100644
--- a/usr.bin/ncurses/Makefile
+++ b/usr.bin/ncurses/Makefile
@@ -1,4 +1,4 @@
-PACKAGE= runtime
+PACKAGE= ncurses
.include <bsd.own.mk>
.include "${SRCTOP}/lib/ncurses/config.mk"
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 5f36b1599cad..dee245b63a87 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -83,7 +83,7 @@ static void inetprint(const char *, struct in_addr *, int, const char *, int,
const int);
#endif
#ifdef INET6
-static int udp_done, tcp_done, sdp_done;
+static int udp_done, udplite_done, tcp_done, sdp_done;
#endif /* INET6 */
static int
@@ -100,6 +100,9 @@ pcblist_sysctl(int proto, const char *name, char **bufp)
case IPPROTO_UDP:
mibvar = "net.inet.udp.pcblist";
break;
+ case IPPROTO_UDPLITE:
+ mibvar = "net.inet.udplite.pcblist";
+ break;
default:
mibvar = "net.inet.raw.pcblist";
break;
@@ -222,11 +225,18 @@ protopr(u_long off, const char *name, int af1, int proto)
udp_done = 1;
#endif
break;
+ case IPPROTO_UDPLITE:
+#ifdef INET6
+ if (udplite_done != 0)
+ return;
+ else
+ udplite_done = 1;
+#endif
+ break;
}
if (!pcblist_sysctl(proto, name, &buf))
return;
-
if (istcp && (cflag || Cflag)) {
fnamelen = strlen("Stack");
cnamelen = strlen("CC");
@@ -318,18 +328,18 @@ protopr(u_long off, const char *name, int af1, int proto)
"Proto", "Listen", "Local Address");
else if (Tflag)
xo_emit((Aflag && !Wflag) ?
- "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%s}" :
+ "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%s}" :
((!Wflag || af1 == AF_INET) ?
- "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%s}" :
- "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%s}"),
+ "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%s}" :
+ "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%s}"),
"Proto", "Rexmit", "OOORcv", "0-win",
"Local Address", "Foreign Address");
else {
xo_emit((Aflag && !Wflag) ?
- "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%-18.18s}" :
+ "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%-18.18s}" :
((!Wflag || af1 == AF_INET) ?
- "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%-22.22s}" :
- "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%-45.45s}"),
+ "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%-22.22s}" :
+ "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%-45.45s}"),
"Proto", "Recv-Q", "Send-Q",
"Local Address", "Foreign Address");
if (!xflag && !Rflag)
@@ -382,9 +392,14 @@ protopr(u_long off, const char *name, int af1, int proto)
vchar = ((inp->inp_vflag & INP_IPV4) != 0) ?
"4" : "";
if (istcp && (tp->t_flags & TF_TOE) != 0)
- xo_emit("{:protocol/%-3.3s%-2.2s/%s%s} ", "toe", vchar);
- else
- xo_emit("{:protocol/%-3.3s%-2.2s/%s%s} ", name, vchar);
+ xo_emit("{:protocol/%-3.3s%-6.6s/%s%s} ", "toe", vchar);
+ else {
+ int len;
+
+ len = max (2, 9 - strlen(name));
+ xo_emit("{:protocol/%.7s%-*.*s/%s%s} ", name, len, len,
+ vchar);
+ }
if (Lflag) {
char buf1[33];
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index e8f657006982..79830049948a 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -83,6 +83,8 @@ static struct protox {
tcp_stats, NULL, "tcp", 1, IPPROTO_TCP },
{ -1 , N_UDPSTAT, 1, protopr,
udp_stats, NULL, "udp", 1, IPPROTO_UDP },
+ { -1, -1, 1, protopr,
+ NULL, NULL, "udplite", 1, IPPROTO_UDPLITE },
#ifdef SCTP
{ -1, N_SCTPSTAT, 1, sctp_protopr,
sctp_stats, NULL, "sctp", 1, IPPROTO_SCTP },
@@ -131,6 +133,8 @@ static struct protox ip6protox[] = {
tcp_stats, NULL, "tcp", 1, IPPROTO_TCP },
{ -1 , N_UDPSTAT, 1, protopr,
udp_stats, NULL, "udp", 1, IPPROTO_UDP },
+ { -1, -1, 1, protopr,
+ NULL, NULL, "udplite", 1, IPPROTO_UDPLITE },
{ -1 , N_IP6STAT, 1, protopr,
ip6_stats, ip6_ifstats, "ip6", 1, IPPROTO_RAW },
{ -1 , N_ICMP6STAT, 1, protopr,
diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
index 2e75e4966d80..07663e54534d 100644
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -51,6 +51,7 @@
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_var.h>
+#include <netinet/tcp_log_buf.h>
#include <arpa/inet.h>
#include <capsicum_helpers.h>
@@ -84,6 +85,7 @@
static bool opt_4; /* Show IPv4 sockets */
static bool opt_6; /* Show IPv6 sockets */
static bool opt_A; /* Show kernel address of pcb */
+static bool opt_b; /* Show BBLog state */
static bool opt_C; /* Show congestion control */
static bool opt_c; /* Show connected sockets */
static bool opt_f; /* Show FIB numbers */
@@ -101,11 +103,13 @@ static bool opt_u; /* Show Unix domain sockets */
static u_int opt_v; /* Verbose mode */
static bool opt_w; /* Automatically size the columns */
static bool is_xo_style_encoding;
+static bool show_path_state = false;
/*
* Default protocols to use if no -P was defined.
*/
-static const char *default_protos[] = {"sctp", "tcp", "udp", "divert" };
+static const char *default_protos[] = {"sctp", "tcp", "udp", "udplite",
+ "divert" };
static size_t default_numprotos = nitems(default_protos);
static int *protos; /* protocols to use */
@@ -141,6 +145,7 @@ struct sock {
int proto;
int state;
int fibnum;
+ int bblog_state;
const char *protoname;
char stack[TCP_FUNCTION_NAME_LEN_MAX];
char cc[TCP_CA_NAME_MAX];
@@ -581,6 +586,7 @@ gather_sctp(void)
!(local_all_loopback ||
foreign_all_loopback))) {
RB_INSERT(socks_t, &socks, sock);
+ show_path_state = true;
} else {
free_socket(sock);
}
@@ -621,6 +627,10 @@ gather_inet(int proto)
varname = "net.inet.udp.pcblist";
protoname = "udp";
break;
+ case IPPROTO_UDPLITE:
+ varname = "net.inet.udplite.pcblist";
+ protoname = "udplite";
+ break;
case IPPROTO_DIVERT:
varname = "net.inet.divert.pcblist";
protoname = "div";
@@ -669,6 +679,7 @@ gather_inet(int proto)
protoname = xtp->t_flags & TF_TOE ? "toe" : "tcp";
break;
case IPPROTO_UDP:
+ case IPPROTO_UDPLITE:
case IPPROTO_DIVERT:
xip = (struct xinpcb *)xig;
if (!check_ksize(xip->xi_len, struct xinpcb))
@@ -738,6 +749,7 @@ gather_inet(int proto)
sock->vflag = xip->inp_vflag;
if (proto == IPPROTO_TCP) {
sock->state = xtp->t_state;
+ sock->bblog_state = xtp->t_logstate;
memcpy(sock->stack, xtp->xt_stack,
TCP_FUNCTION_NAME_LEN_MAX);
memcpy(sock->cc, xtp->xt_cc, TCP_CA_NAME_MAX);
@@ -1056,6 +1068,37 @@ sctp_path_state(int state)
}
}
+static const char *
+bblog_state(int state)
+{
+ switch (state) {
+ case TCP_LOG_STATE_OFF:
+ return "OFF";
+ break;
+ case TCP_LOG_STATE_TAIL:
+ return "TAIL";
+ break;
+ case TCP_LOG_STATE_HEAD:
+ return "HEAD";
+ break;
+ case TCP_LOG_STATE_HEAD_AUTO:
+ return "HEAD_AUTO";
+ break;
+ case TCP_LOG_STATE_CONTINUAL:
+ return "CONTINUAL";
+ break;
+ case TCP_LOG_STATE_TAIL_AUTO:
+ return "TAIL_AUTO";
+ break;
+ case TCP_LOG_VIA_BBPOINTS:
+ return "BBPOINTS";
+ break;
+ default:
+ return "UNKNOWN";
+ break;
+ }
+}
+
static int
format_unix_faddr(struct addr *faddr, char *buf, size_t bufsize) {
#define SAFEBUF (buf == NULL ? NULL : buf + pos)
@@ -1143,6 +1186,7 @@ struct col_widths {
int encaps;
int path_state;
int conn_state;
+ int bblog_state;
int stack;
int cc;
};
@@ -1158,7 +1202,9 @@ calculate_sock_column_widths(struct col_widths *cw, struct sock *s)
first = true;
len = strlen(s->protoname);
- if (s->vflag & (INP_IPV4 | INP_IPV6))
+ if (s->vflag & INP_IPV4)
+ len += 1;
+ if (s->vflag & INP_IPV6)
len += 1;
cw->proto = MAX(cw->proto, len);
@@ -1194,40 +1240,40 @@ calculate_sock_column_widths(struct col_widths *cw, struct sock *s)
{ .socket = s->splice_socket });
if (sp != NULL) {
len = formataddr(&sp->laddr->address,
- NULL, 0);
+ NULL, 0);
cw->splice_address = MAX(
- cw->splice_address, len);
+ cw->splice_address, len);
}
}
}
if (opt_i) {
- if (s->proto == IPPROTO_TCP || s->proto == IPPROTO_UDP)
- {
+ if (s->proto == IPPROTO_TCP ||
+ s->proto == IPPROTO_UDP) {
len = snprintf(NULL, 0,
- "%" PRIu64, s->inp_gencnt);
+ "%" PRIu64, s->inp_gencnt);
cw->inp_gencnt = MAX(cw->inp_gencnt, len);
}
}
if (opt_U) {
if (faddr != NULL &&
- ((s->proto == IPPROTO_SCTP &&
- s->state != SCTP_CLOSED &&
- s->state != SCTP_BOUND &&
- s->state != SCTP_LISTEN) ||
- (s->proto == IPPROTO_TCP &&
- s->state != TCPS_CLOSED &&
- s->state != TCPS_LISTEN))) {
+ ((s->proto == IPPROTO_SCTP &&
+ s->state != SCTP_CLOSED &&
+ s->state != SCTP_BOUND &&
+ s->state != SCTP_LISTEN) ||
+ (s->proto == IPPROTO_TCP &&
+ s->state != TCPS_CLOSED &&
+ s->state != TCPS_LISTEN))) {
len = snprintf(NULL, 0, "%u",
- ntohs(faddr->encaps_port));
+ ntohs(faddr->encaps_port));
cw->encaps = MAX(cw->encaps, len);
}
}
if (opt_s) {
if (faddr != NULL &&
- s->proto == IPPROTO_SCTP &&
- s->state != SCTP_CLOSED &&
- s->state != SCTP_BOUND &&
- s->state != SCTP_LISTEN) {
+ s->proto == IPPROTO_SCTP &&
+ s->state != SCTP_CLOSED &&
+ s->state != SCTP_BOUND &&
+ s->state != SCTP_LISTEN) {
len = strlen(sctp_path_state(faddr->state));
cw->path_state = MAX(cw->path_state, len);
}
@@ -1235,21 +1281,22 @@ calculate_sock_column_widths(struct col_widths *cw, struct sock *s)
if (first) {
if (opt_s) {
if (s->proto == IPPROTO_SCTP ||
- s->proto == IPPROTO_TCP) {
+ s->proto == IPPROTO_TCP) {
switch (s->proto) {
case IPPROTO_SCTP:
len = strlen(
sctp_conn_state(s->state));
cw->conn_state = MAX(
- cw->conn_state, len);
+ cw->conn_state, len);
break;
case IPPROTO_TCP:
if (s->state >= 0 &&
s->state < TCP_NSTATES) {
- len = strlen(
- tcpstates[s->state]);
- cw->conn_state = MAX(
- cw->conn_state, len);
+ len = strlen(
+ tcpstates[s->state]);
+ cw->conn_state = MAX(
+ cw->conn_state,
+ len);
}
break;
}
@@ -1426,8 +1473,8 @@ display_sock(struct sock *s, struct col_widths *cw, char *buf, size_t bufsize)
cw->splice_address, buf);
}
if (opt_i) {
- if (s->proto == IPPROTO_TCP || s->proto == IPPROTO_UDP)
- {
+ if (s->proto == IPPROTO_TCP ||
+ s->proto == IPPROTO_UDP) {
snprintf(buf, bufsize, "%" PRIu64,
s->inp_gencnt);
xo_emit(" {:id/%*s}", cw->inp_gencnt, buf);
@@ -1436,29 +1483,29 @@ display_sock(struct sock *s, struct col_widths *cw, char *buf, size_t bufsize)
}
if (opt_U) {
if (faddr != NULL &&
- ((s->proto == IPPROTO_SCTP &&
- s->state != SCTP_CLOSED &&
- s->state != SCTP_BOUND &&
- s->state != SCTP_LISTEN) ||
- (s->proto == IPPROTO_TCP &&
- s->state != TCPS_CLOSED &&
- s->state != TCPS_LISTEN))) {
+ ((s->proto == IPPROTO_SCTP &&
+ s->state != SCTP_CLOSED &&
+ s->state != SCTP_BOUND &&
+ s->state != SCTP_LISTEN) ||
+ (s->proto == IPPROTO_TCP &&
+ s->state != TCPS_CLOSED &&
+ s->state != TCPS_LISTEN))) {
xo_emit(" {:encaps/%*u}", cw->encaps,
- ntohs(faddr->encaps_port));
+ ntohs(faddr->encaps_port));
} else if (!is_xo_style_encoding)
xo_emit(" {:encaps/%*s}", cw->encaps, "??");
}
- if (opt_s) {
+ if (opt_s && show_path_state) {
if (faddr != NULL &&
- s->proto == IPPROTO_SCTP &&
- s->state != SCTP_CLOSED &&
- s->state != SCTP_BOUND &&
- s->state != SCTP_LISTEN) {
+ s->proto == IPPROTO_SCTP &&
+ s->state != SCTP_CLOSED &&
+ s->state != SCTP_BOUND &&
+ s->state != SCTP_LISTEN) {
xo_emit(" {:path-state/%-*s}", cw->path_state,
- sctp_path_state(faddr->state));
+ sctp_path_state(faddr->state));
} else if (!is_xo_style_encoding)
xo_emit(" {:path-state/%-*s}", cw->path_state,
- "??");
+ "??");
}
if (first) {
if (opt_s) {
@@ -1467,31 +1514,40 @@ display_sock(struct sock *s, struct col_widths *cw, char *buf, size_t bufsize)
switch (s->proto) {
case IPPROTO_SCTP:
xo_emit(" {:conn-state/%-*s}",
- cw->conn_state,
- sctp_conn_state(s->state));
+ cw->conn_state,
+ sctp_conn_state(s->state));
break;
case IPPROTO_TCP:
if (s->state >= 0 &&
- s->state < TCP_NSTATES)
+ s->state < TCP_NSTATES)
xo_emit(" {:conn-state/%-*s}",
- cw->conn_state,
- tcpstates[s->state]);
+ cw->conn_state,
+ tcpstates[s->state]);
else if (!is_xo_style_encoding)
xo_emit(" {:conn-state/%-*s}",
- cw->conn_state, "??");
+ cw->conn_state, "??");
break;
}
} else if (!is_xo_style_encoding)
xo_emit(" {:conn-state/%-*s}",
- cw->conn_state, "??");
+ cw->conn_state, "??");
+ }
+ if (opt_b) {
+ if (s->proto == IPPROTO_TCP)
+ xo_emit(" {:bblog-state/%-*s}",
+ cw->bblog_state,
+ bblog_state(s->bblog_state));
+ else if (!is_xo_style_encoding)
+ xo_emit(" {:bblog-state/%-*s}",
+ cw->bblog_state, "??");
}
if (opt_S) {
if (s->proto == IPPROTO_TCP)
xo_emit(" {:stack/%-*s}",
- cw->stack, s->stack);
+ cw->stack, s->stack);
else if (!is_xo_style_encoding)
xo_emit(" {:stack/%-*s}",
- cw->stack, "??");
+ cw->stack, "??");
}
if (opt_C) {
if (s->proto == IPPROTO_TCP)
@@ -1499,18 +1555,30 @@ display_sock(struct sock *s, struct col_widths *cw, char *buf, size_t bufsize)
else if (!is_xo_style_encoding)
xo_emit(" {:cc/%-*s}", cw->cc, "??");
}
+ } else if (!is_xo_style_encoding) {
+ if (opt_s)
+ xo_emit(" {:conn-state/%-*s}", cw->conn_state,
+ "??");
+ if (opt_b)
+ xo_emit(" {:bblog-state/%-*s}", cw->bblog_state,
+ "??");
+ if (opt_S)
+ xo_emit(" {:stack/%-*s}", cw->stack, "??");
+ if (opt_C)
+ xo_emit(" {:cc/%-*s}", cw->cc, "??");
}
if (laddr != NULL)
laddr = laddr->next;
if (faddr != NULL)
faddr = faddr->next;
+ xo_emit("\n");
if (!is_xo_style_encoding && (laddr != NULL || faddr != NULL))
xo_emit("{:user/%-*s} {:command/%-*s} {:pid/%*s}"
- " {:fd/%*s}", cw->user, "??", cw->command, "??",
- cw->pid, "??", cw->fd, "??");
+ " {:fd/%*s} {:proto/%-*s}", cw->user, "??",
+ cw->command, "??", cw->pid, "??", cw->fd, "??",
+ cw->proto, "??");
first = false;
}
- xo_emit("\n");
}
static void
@@ -1544,6 +1612,7 @@ display(void)
.encaps = strlen("ENCAPS"),
.path_state = strlen("PATH STATE"),
.conn_state = strlen("CONN STATE"),
+ .bblog_state = strlen("BBLOG STATE"),
.stack = strlen("STACK"),
.cc = strlen("CC"),
};
@@ -1567,15 +1636,19 @@ display(void)
xo_emit(" {T:/%*s}", cw.fib, "FIB");
if (opt_I)
xo_emit(" {T:/%-*s}", cw.splice_address,
- "SPLICE ADDRESS");
+ "SPLICE ADDRESS");
if (opt_i)
xo_emit(" {T:/%*s}", cw.inp_gencnt, "ID");
if (opt_U)
xo_emit(" {T:/%*s}", cw.encaps, "ENCAPS");
if (opt_s) {
- xo_emit(" {T:/%-*s}", cw.path_state, "PATH STATE");
+ if (show_path_state)
+ xo_emit(" {T:/%-*s}", cw.path_state,
+ "PATH STATE");
xo_emit(" {T:/%-*s}", cw.conn_state, "CONN STATE");
}
+ if (opt_b)
+ xo_emit(" {T:/%-*s}", cw.bblog_state, "BBLOG STATE");
if (opt_S)
xo_emit(" {T:/%-*s}", cw.stack, "STACK");
if (opt_C)
@@ -1596,15 +1669,15 @@ display(void)
if (opt_n ||
(pwd = cap_getpwuid(cappwd, xf->xf_uid)) == NULL)
xo_emit("{:user/%-*lu}", cw.user,
- (u_long)xf->xf_uid);
+ (u_long)xf->xf_uid);
else
xo_emit("{:user/%-*s}", cw.user, pwd->pw_name);
if (!is_xo_style_encoding)
xo_emit(" {:command/%-*.10s}", cw.command,
- getprocname(xf->xf_pid));
+ getprocname(xf->xf_pid));
else
xo_emit(" {:command/%-*s}", cw.command,
- getprocname(xf->xf_pid));
+ getprocname(xf->xf_pid));
xo_emit(" {:pid/%*lu}", cw.pid, (u_long)xf->xf_pid);
xo_emit(" {:fd/%*d}", cw.fd, xf->xf_fd);
display_sock(s, &cw, buf, bufsize);
@@ -1619,8 +1692,8 @@ display(void)
xo_open_instance("socket");
if (!is_xo_style_encoding)
xo_emit("{:user/%-*s} {:command/%-*s} {:pid/%*s}"
- " {:fd/%*s}", cw.user, "??", cw.command, "??",
- cw.pid, "??", cw.fd, "??");
+ " {:fd/%*s}", cw.user, "??", cw.command, "??",
+ cw.pid, "??", cw.fd, "??");
display_sock(s, &cw, buf, bufsize);
xo_close_instance("socket");
}
@@ -1632,8 +1705,8 @@ display(void)
xo_open_instance("socket");
if (!is_xo_style_encoding)
xo_emit("{:user/%-*s} {:command/%-*s} {:pid/%*s}"
- " {:fd/%*s}", cw.user, "??", cw.command, "??",
- cw.pid, "??", cw.fd, "??");
+ " {:fd/%*s}", cw.user, "??", cw.command, "??",
+ cw.pid, "??", cw.fd, "??");
display_sock(s, &cw, buf, bufsize);
xo_close_instance("socket");
}
@@ -1706,7 +1779,7 @@ static void
usage(void)
{
xo_error(
-"usage: sockstat [--libxo ...] [-46ACcfIiLlnqSsUuvw] [-j jid] [-p ports]\n"
+"usage: sockstat [--libxo ...] [-46AbCcfIiLlnqSsUuvw] [-j jid] [-p ports]\n"
" [-P protocols]\n");
exit(1);
}
@@ -1724,11 +1797,13 @@ main(int argc, char *argv[])
argc = xo_parse_args(argc, argv);
if (argc < 0)
exit(1);
- if (xo_get_style(NULL) != XO_STYLE_TEXT &&
- xo_get_style(NULL) != XO_STYLE_HTML)
- is_xo_style_encoding = true;
+ if (xo_get_style(NULL) != XO_STYLE_TEXT) {
+ show_path_state = true;
+ if (xo_get_style(NULL) != XO_STYLE_HTML)
+ is_xo_style_encoding = true;
+ }
opt_j = -1;
- while ((o = getopt(argc, argv, "46ACcfIij:Llnp:P:qSsUuvw")) != -1)
+ while ((o = getopt(argc, argv, "46AbCcfIij:Llnp:P:qSsUuvw")) != -1)
switch (o) {
case '4':
opt_4 = true;
@@ -1739,6 +1814,9 @@ main(int argc, char *argv[])
case 'A':
opt_A = true;
break;
+ case 'b':
+ opt_b = true;
+ break;
case 'C':
opt_C = true;
break;
diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1
index 091911cd0879..1498fb1d88f7 100644
--- a/usr.bin/sockstat/sockstat.1
+++ b/usr.bin/sockstat/sockstat.1
@@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 17, 2025
+.Dd October 14, 2025
.Dt SOCKSTAT 1
.Os
.Sh NAME
@@ -34,7 +34,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl -libxo
-.Op Fl 46ACcfIiLlnqSsUuvw
+.Op Fl 46AbCcfIiLlnqSsUuvw
.Op Fl j Ar jail
.Op Fl p Ar ports
.Op Fl P Ar protocols
@@ -65,6 +65,9 @@ Show
.It Fl A
Show the address of a protocol control block (PCB) associated with a socket;
used for debugging.
+.It Fl b
+Show the BBLog state of the socket.
+This is currently only implemented for TCP.
.It Fl C
Display the congestion control module, if applicable.
This is currently only implemented for TCP.
@@ -202,10 +205,16 @@ is specified (only for SCTP or TCP).
The path state if
.Fl s
is specified (only for SCTP).
+When using traditional text output, this column is only shown when there is at
+least one path state to show.
.It Li CONN STATE
The connection state if
.Fl s
is specified (only for SCTP or TCP).
+.It Li BBLOG STATE
+The BBLog state if
+.Fl b
+is specified (only for TCP).
.It Li STACK
The protocol stack if
.Fl S
diff --git a/usr.bin/sockstat/tests/Makefile b/usr.bin/sockstat/tests/Makefile
index 9971bca2d474..5412e9d842aa 100644
--- a/usr.bin/sockstat/tests/Makefile
+++ b/usr.bin/sockstat/tests/Makefile
@@ -1,5 +1,6 @@
ATF_TESTS_C+= sockstat_test
-SRCS.sockstat_test= sockstat_test.c ../sockstat.c
+SRCS.sockstat_test= sockstat_test.c sockstat.c
+.PATH: ${.CURDIR:H}
LIBADD= xo
diff --git a/usr.bin/tail/tests/tail_test.sh b/usr.bin/tail/tests/tail_test.sh
index 74d6908f7568..82c74a0d4da4 100755
--- a/usr.bin/tail/tests/tail_test.sh
+++ b/usr.bin/tail/tests/tail_test.sh
@@ -341,6 +341,7 @@ follow_create_body()
rm -f infile
tail -F infile > outfile &
pid=$!
+ sleep 0.1
seq 1 5 >infile
sleep 2
atf_check cmp infile outfile
@@ -360,6 +361,7 @@ follow_rename_body()
seq 1 3 > infile
tail -F infile > outfile &
pid=$!
+ sleep 0.1
seq 4 5 > infile_new
atf_check mv infile infile_old
atf_check mv infile_new infile
diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile
index 9260315fb30b..8b0d3e4a6cf0 100644
--- a/usr.bin/tar/Makefile
+++ b/usr.bin/tar/Makefile
@@ -17,7 +17,7 @@ SRCS= bsdtar.c \
write.c
.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
-SRCS+= err.c \
+SRCS+= lafe_err.c \
line_reader.c \
passphrase.c
diff --git a/usr.bin/tar/tests/Makefile b/usr.bin/tar/tests/Makefile
index 929f8127f9b3..116425b0621f 100644
--- a/usr.bin/tar/tests/Makefile
+++ b/usr.bin/tar/tests/Makefile
@@ -27,6 +27,7 @@ TESTS_SRCS= \
test_0.c \
test_basic.c \
test_copy.c \
+ test_crlf_mtree.c \
test_empty_mtree.c \
test_extract_tar_bz2.c \
test_extract_tar_grz.c \
diff --git a/usr.bin/unzip/Makefile b/usr.bin/unzip/Makefile
index 2db5e9ac4c99..63f49a203685 100644
--- a/usr.bin/unzip/Makefile
+++ b/usr.bin/unzip/Makefile
@@ -12,7 +12,7 @@ BSDUNZIP_VERSION_STRING!= sed -n '/define.*ARCHIVE_VERSION_ONLY_STRING/{s,[^0-9.
SRCS= bsdunzip.c
.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
-SRCS+= cmdline.c err.c passphrase.c
+SRCS+= cmdline.c lafe_err.c passphrase.c
CFLAGS+= -DBSDUNZIP_VERSION_STRING=\"${BSDUNZIP_VERSION_STRING}\"
CFLAGS+= -DPLATFORM_CONFIG_H=\"${_LIBARCHIVECONFDIR}/config_freebsd.h\"
diff --git a/usr.bin/unzip/tests/Makefile b/usr.bin/unzip/tests/Makefile
index 404a546410e4..fada172b1bd7 100644
--- a/usr.bin/unzip/tests/Makefile
+++ b/usr.bin/unzip/tests/Makefile
@@ -23,7 +23,7 @@ CFLAGS+= -I${_LIBARCHIVEDIR}/libarchive_fe -I${_LIBARCHIVEDIR}/test_utils
CFLAGS.test_utils.c+= -Wno-cast-align
.PATH: ${_LIBARCHIVEDIR}/libarchive_fe
-UNZIP_SRCS+= err.c
+UNZIP_SRCS+= lafe_err.c
.PATH: ${_LIBARCHIVEDIR}/unzip/test
TESTS_SRCS= \
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 7a7c83fe1ac8..9b4d3a25ee07 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -1465,6 +1465,7 @@ display_object(struct kinfo_vmobject *kvo)
xo_emit("{:active/%5ju} ", (uintmax_t)kvo->kvo_active);
xo_emit("{:inactive/%5ju} ", (uintmax_t)kvo->kvo_inactive);
xo_emit("{:laundry/%5ju} ", (uintmax_t)kvo->kvo_laundry);
+ xo_emit("{:wired/%5ju} ", (uintmax_t)kvo->kvo_wired);
xo_emit("{:refcount/%3d} ", kvo->kvo_ref_count);
xo_emit("{:shadowcount/%3d} ", kvo->kvo_shadow_count);
@@ -1568,7 +1569,8 @@ doobjstat(void)
return;
}
xo_emit("{T:RES/%5s} {T:ACT/%5s} {T:INACT/%5s} {T:LAUND/%5s} "
- "{T:REF/%3s} {T:SHD/%3s} {T:CM/%2s} {T:TP/%3s} {T:PATH/%s}\n");
+ "{T:WIRED/%5s} {T:REF/%3s} {T:SHD/%3s} {T:CM/%2s} {T:TP/%3s} "
+ "{T:PATH/%s}\n");
xo_open_list("object");
for (i = 0; i < cnt; i++)
display_object(&kvo[i]);
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index ac1df96077d3..502bf5a412b9 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -473,7 +473,7 @@ main(int argc, char *argv[])
static void
pr_header(time_t *nowp, int nusers)
{
- char buf[64];
+ char buf[64], *s, *e;
struct sbuf upbuf;
double avenrun[3];
struct timespec tp;
@@ -484,8 +484,15 @@ pr_header(time_t *nowp, int nusers)
* Print time of day.
*/
if (strftime(buf, sizeof(buf),
- use_ampm ? "%l:%M%p" : "%k:%M", localtime(nowp)) != 0)
- xo_emit("{:time-of-day/%s} ", buf);
+ use_ampm ? "%l:%M%p" : "%k:%M", localtime(nowp)) != 0) {
+ s = buf;
+ if (xo_get_style(NULL) != XO_STYLE_TEXT) {
+ /* trim leading whitespace */
+ while (isspace((unsigned char)*s))
+ s++;
+ }
+ xo_emit("{:time-of-day/%s} ", s);
+ }
/*
* Print how long system has been up.
*/
@@ -516,21 +523,31 @@ pr_header(time_t *nowp, int nusers)
if (days > 0)
sbuf_printf(&upbuf, " %ld day%s,",
- days, days > 1 ? "s" : "");
+ days, days > 1 ? "s" : "");
if (hrs > 0 && mins > 0)
sbuf_printf(&upbuf, " %2ld:%02ld,", hrs, mins);
else if (hrs > 0)
sbuf_printf(&upbuf, " %ld hr%s,",
- hrs, hrs > 1 ? "s" : "");
+ hrs, hrs > 1 ? "s" : "");
else if (mins > 0)
sbuf_printf(&upbuf, " %ld min%s,",
- mins, mins > 1 ? "s" : "");
+ mins, mins > 1 ? "s" : "");
else
sbuf_printf(&upbuf, " %ld sec%s,",
- secs, secs > 1 ? "s" : "");
+ secs, secs > 1 ? "s" : "");
if (sbuf_finish(&upbuf) != 0)
xo_err(1, "Could not generate output");
- xo_emit("{:uptime-human/%s}", sbuf_data(&upbuf));
+ s = sbuf_data(&upbuf);
+ if (xo_get_style(NULL) != XO_STYLE_TEXT) {
+ e = s + sbuf_len(&upbuf) - 1;
+ /* trim leading whitespace */
+ while (isspace((unsigned char)*s))
+ s++;
+ /* trim trailing comma */
+ if (e > s && *e == ',')
+ *e = '\0';
+ }
+ xo_emit("{:uptime-human/%s}", s);
sbuf_delete(&upbuf);
}