summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.inc15
-rwxr-xr-xetc/rc.d/ipfilter2
-rwxr-xr-xetc/rc.d/pf2
-rw-r--r--lib/Makefile5
-rw-r--r--lib/libc/sys/mq_setattr.24
-rw-r--r--lib/libpkg/Makefile47
-rw-r--r--lib/libpkg/pkgwrap.c90
-rw-r--r--lib/libsbuf/Makefile11
-rw-r--r--lib/libsbuf/Symbol.map24
-rw-r--r--lib/libsbuf/Version.def4
-rw-r--r--sbin/ipfw/ipfw.84
-rw-r--r--share/man/man4/cc_hd.42
-rw-r--r--share/man/man4/geom_map.4130
-rw-r--r--share/man/man4/xhci.49
-rw-r--r--share/man/man5/rc.conf.52
-rw-r--r--share/man/man5/src.conf.57
-rw-r--r--share/man/man9/sbuf.945
-rw-r--r--share/misc/iso316636
-rw-r--r--share/mk/bsd.libnames.mk1
-rw-r--r--sys/dev/ath/ah_osdep.c6
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_misc.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_attach.c2
-rw-r--r--sys/dev/cxgbe/t4_main.c1
-rw-r--r--sys/dev/pci/pcireg.h1
-rw-r--r--sys/dev/usb/controller/xhci_pci.c2
-rw-r--r--sys/dev/usb/controller/xhcireg.h1
-rw-r--r--sys/kern/subr_sbuf.c129
-rw-r--r--sys/kern/subr_smp.c71
-rw-r--r--sys/netinet/sctp_output.c46
-rw-r--r--sys/netinet/sctp_usrreq.c1
-rw-r--r--sys/powerpc/booke/pmap.c1
-rw-r--r--tools/build/options/WITH_OFED4
-rw-r--r--usr.sbin/ifmcstat/ifmcstat.84
-rw-r--r--usr.sbin/pkg_install/Makefile4
-rw-r--r--usr.sbin/pkg_install/Makefile.inc13
-rw-r--r--usr.sbin/pkg_install/add/Makefile7
-rw-r--r--usr.sbin/pkg_install/add/extract.c2
-rw-r--r--usr.sbin/pkg_install/add/futil.c2
-rw-r--r--usr.sbin/pkg_install/add/main.c4
-rw-r--r--usr.sbin/pkg_install/add/perform.c2
-rw-r--r--usr.sbin/pkg_install/create/Makefile6
-rw-r--r--usr.sbin/pkg_install/create/main.c4
-rw-r--r--usr.sbin/pkg_install/create/perform.c2
-rw-r--r--usr.sbin/pkg_install/create/pl.c2
-rw-r--r--usr.sbin/pkg_install/delete/Makefile5
-rw-r--r--usr.sbin/pkg_install/delete/main.c4
-rw-r--r--usr.sbin/pkg_install/delete/perform.c2
-rw-r--r--usr.sbin/pkg_install/info/Makefile6
-rw-r--r--usr.sbin/pkg_install/info/info.h39
-rw-r--r--usr.sbin/pkg_install/info/main.c14
-rw-r--r--usr.sbin/pkg_install/info/perform.c2
-rw-r--r--usr.sbin/pkg_install/info/show.c2
-rw-r--r--usr.sbin/pkg_install/lib/Makefile11
-rw-r--r--usr.sbin/pkg_install/lib/deps.c (renamed from lib/libpkg/deps.c)2
-rw-r--r--usr.sbin/pkg_install/lib/exec.c (renamed from lib/libpkg/exec.c)2
-rw-r--r--usr.sbin/pkg_install/lib/file.c (renamed from lib/libpkg/file.c)2
-rw-r--r--usr.sbin/pkg_install/lib/global.c (renamed from lib/libpkg/global.c)2
-rw-r--r--usr.sbin/pkg_install/lib/lib.h (renamed from lib/libpkg/pkg.h)12
-rw-r--r--usr.sbin/pkg_install/lib/match.c (renamed from lib/libpkg/match.c)4
-rw-r--r--usr.sbin/pkg_install/lib/msg.c (renamed from lib/libpkg/msg.c)9
-rw-r--r--usr.sbin/pkg_install/lib/pen.c (renamed from lib/libpkg/pen.c)17
-rw-r--r--usr.sbin/pkg_install/lib/pkgwrap.c89
-rw-r--r--usr.sbin/pkg_install/lib/plist.c (renamed from lib/libpkg/plist.c)2
-rw-r--r--usr.sbin/pkg_install/lib/str.c (renamed from lib/libpkg/str.c)2
-rw-r--r--usr.sbin/pkg_install/lib/url.c (renamed from lib/libpkg/url.c)4
-rw-r--r--usr.sbin/pkg_install/lib/version.c (renamed from lib/libpkg/version.c)14
-rw-r--r--usr.sbin/pkg_install/updating/Makefile5
-rw-r--r--usr.sbin/pkg_install/updating/main.c4
-rw-r--r--usr.sbin/pkg_install/version/Makefile5
-rw-r--r--usr.sbin/pkg_install/version/main.c4
-rw-r--r--usr.sbin/pkg_install/version/perform.c2
71 files changed, 578 insertions, 437 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 907cdce..4aa53da 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1205,7 +1205,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
${_kerberos5_lib_libroken} \
lib/libbz2 lib/libcom_err lib/libcrypt \
- lib/libexpat lib/libfetch \
+ lib/libexpat \
${_lib_libgssapi} ${_lib_libipx} \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
lib/ncurses/ncurses lib/ncurses/ncursesw \
@@ -1238,7 +1238,6 @@ _cddl_lib= cddl/lib
_secure_lib_libcrypto= secure/lib/libcrypto
_secure_lib_libssl= secure/lib/libssl
lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
-lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L
.if ${MK_OPENSSH} != "no"
_secure_lib_libssh= secure/lib/libssh
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
@@ -1274,7 +1273,7 @@ _lib_libypclnt= lib/libypclnt
.endif
.if ${MK_OPENSSL} == "no"
-lib/libfetch__L lib/libradius__L: lib/libmd__L
+lib/libradius__L: lib/libmd__L
.endif
.for _lib in ${_prereq_libs}
diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter
index fd1e99b..b6bdb4b 100755
--- a/etc/rc.d/ipfilter
+++ b/etc/rc.d/ipfilter
@@ -23,7 +23,7 @@ resync_precmd="$stop_precmd"
resync_cmd="ipfilter_resync"
status_precmd="$stop_precmd"
status_cmd="ipfilter_status"
-extra_commands="reload resync status"
+extra_commands="reload resync"
required_modules="ipl:ipfilter"
ipfilter_start()
diff --git a/etc/rc.d/pf b/etc/rc.d/pf
index 3426e90..3180a2c 100755
--- a/etc/rc.d/pf
+++ b/etc/rc.d/pf
@@ -19,7 +19,7 @@ check_cmd="pf_check"
reload_cmd="pf_reload"
resync_cmd="pf_resync"
status_cmd="pf_status"
-extra_commands="check reload resync status"
+extra_commands="check reload resync"
required_files="$pf_rules"
required_modules="pf"
diff --git a/lib/Makefile b/lib/Makefile
index 7be186f..eef2048 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -89,7 +89,6 @@ SUBDIR= ${SUBDIR_ORDERED} \
libopie \
libpam \
libpcap \
- ${_libpkg} \
${_libpmc} \
${_libproc} \
libprocstat \
@@ -215,10 +214,6 @@ _libmp= libmp
_libpmc= libpmc
.endif
-.if ${MK_PKGTOOLS} != "no"
-_libpkg= libpkg
-.endif
-
.if ${MK_SENDMAIL} != "no"
_libmilter= libmilter
_libsm= libsm
diff --git a/lib/libc/sys/mq_setattr.2 b/lib/libc/sys/mq_setattr.2
index 2e5a6b1..79e523d 100644
--- a/lib/libc/sys/mq_setattr.2
+++ b/lib/libc/sys/mq_setattr.2
@@ -37,7 +37,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 29, 2005
+.Dd May 17, 2011
.Dt MQ_SETATTR 2
.Os
.Sh NAME
@@ -50,7 +50,7 @@
.Ft int
.Fo mq_setattr
.Fa "mqd_t mqdes"
-.Fa "struct mq_attr *restrict mqstat"
+.Fa "const struct mq_attr *restrict mqstat"
.Fa "struct mq_attr *restrict omqstat"
.Fc
.Sh DESCRIPTION
diff --git a/lib/libpkg/Makefile b/lib/libpkg/Makefile
deleted file mode 100644
index 8f2b325..0000000
--- a/lib/libpkg/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-# $FreeBSD$
-
-.include <bsd.own.mk>
-
-LIB= pkg
-
-SHLIBDIR?= /usr/lib
-SHLIB_MAJOR= 0
-
-SRCS= deps.c \
- exec.c \
- file.c \
- global.c \
- match.c \
- msg.c \
- pen.c \
- pkgwrap.c \
- plist.c \
- str.c \
- url.c \
- version.c
-INCS= pkg.h
-
-CFLAGS+= -DYES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
-
-DPADD= ${LIBFETCH} ${LIBMD} ${LIBUTIL}
-LDADD= -lfetch -lmd -lutil
-
-.if ${MK_OPENSSL} != "no"
-DPADD+= ${LIBSSL} ${LIBCRYPTO}
-LDADD+= -lssl -lcrypto
-.endif
-
-WARNS?= 3
-
-DATE!= grep LIBPKG_VERSION ${.CURDIR}/pkg.h | sed 's|.*[ ]||'
-
-distfile: clean
- @(cd ${.CURDIR}/..; \
- cp -r libpkg libpkg-${DATE}; \
- tar -czf libpkg/libpkg-${DATE}.tar.gz \
- --exclude .#* --exclude *~ --exclude CVS \
- --exclude .svn --exclude libpkg-*.tar.gz \
- libpkg-${DATE}; \
- rm -rf libpkg-${DATE})
-
-.include <bsd.lib.mk>
diff --git a/lib/libpkg/pkgwrap.c b/lib/libpkg/pkgwrap.c
deleted file mode 100644
index 9c8c0c3..0000000
--- a/lib/libpkg/pkgwrap.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * FreeBSD install - a package for the installation and maintenance
- * of non-core utilities.
- *
- * 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.
- *
- * Maxim Sobolev
- * 8 September 2002
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "pkg.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-extern char **environ;
-
-void
-pkg_wrap(long curver, char **argv)
-{
- FILE* f;
- char ver[9]; /* Format is: 'YYYYMMDD\0' */
- char buffer[FILENAME_MAX+10]; /* Format is: 'YYYYMMDD <path>' */
- char cmd[FILENAME_MAX+5]; /* Format is: '<path> -PPq' */
- char *path, *cp;
- long ptver, lpver;
-
- if (getenv("PKG_NOWRAP") != NULL)
- goto nowrap;
-
- setenv("PKG_NOWRAP", "1", 1);
-
- /* Get alternative location for package tools. */
- if ((f = fopen(PKG_WRAPCONF_FNAME, "r")) == NULL) {
- goto nowrap;
- } else {
- if (get_string(buffer, FILENAME_MAX+9, f) == NULL) {
- goto nowrap;
- } else {
- if ((path = strrchr(buffer, ' ')) == NULL) {
- goto nowrap;
- } else {
- *path++ = '\0';
- }
- }
- }
-
- if ((cp = strrchr(argv[0], '/')) == NULL) {
- cp = argv[0];
- } else {
- cp++;
- }
-
- /* Get version of the other pkg_install and libpkg */
- snprintf(cmd, FILENAME_MAX+10, "%s/%s -PPq", path, cp);
- if ((f = popen(cmd, "r")) == NULL) {
- perror("popen()");
- goto nowrap;
- } else {
- if (get_string(ver, 9, f) == NULL)
- goto nowrap;
- else
- ptver = strtol(ver, NULL, 10);
- if (get_string(ver, 9, f) == NULL)
- goto nowrap;
- else
- lpver = strtol(ver, NULL, 10);
- pclose(f);
- }
-
- if ((lpver >= LIBPKG_VERSION) && (ptver > curver)) {
- snprintf(cmd, FILENAME_MAX, "%s/%s", path, cp);
- execve(cmd, argv, environ);
- }
-
-nowrap:
- unsetenv("PKG_NOWRAP");
-}
diff --git a/lib/libsbuf/Makefile b/lib/libsbuf/Makefile
index 5d96c0e..79d3fe9 100644
--- a/lib/libsbuf/Makefile
+++ b/lib/libsbuf/Makefile
@@ -1,8 +1,13 @@
# $FreeBSD$
-LIB= sbuf
-SHLIBDIR?= /lib
-SRCS= subr_sbuf.c
+LIB= sbuf
+SHLIBDIR?= /lib
+SRCS= subr_sbuf.c
+
+SHLIB_MAJOR = 6
+
+SYMBOL_MAPS= ${.CURDIR}/Symbol.map
+VERSION_DEF= ${.CURDIR}/Version.def
.PATH: ${.CURDIR}/../../sys/kern
diff --git a/lib/libsbuf/Symbol.map b/lib/libsbuf/Symbol.map
new file mode 100644
index 0000000..75af558
--- /dev/null
+++ b/lib/libsbuf/Symbol.map
@@ -0,0 +1,24 @@
+/*
+ * $FreeBSD$
+ */
+
+FBSD_1.2 {
+ sbuf_new;
+ sbuf_clear;
+ sbuf_setpos;
+ sbuf_bcat;
+ sbuf_bcpy;
+ sbuf_cat;
+ sbuf_cpy;
+ sbuf_printf;
+ sbuf_vprintf;
+ sbuf_putc;
+ sbuf_set_drain;
+ sbuf_trim;
+ sbuf_error;
+ sbuf_finish;
+ sbuf_data;
+ sbuf_len;
+ sbuf_done;
+ sbuf_delete;
+};
diff --git a/lib/libsbuf/Version.def b/lib/libsbuf/Version.def
new file mode 100644
index 0000000..ab673d9
--- /dev/null
+++ b/lib/libsbuf/Version.def
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+FBSD_1.2 {
+};
diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8
index a984f70..710996b 100644
--- a/sbin/ipfw/ipfw.8
+++ b/sbin/ipfw/ipfw.8
@@ -565,9 +565,9 @@ if the sysctl variable
is set to 0 (default), one can use
.Xr bpf 4
attached to the
-.Xr ipfw0
+.Li ipfw0
pseudo interface. There is no overhead if no
-.Xr bpf
+.Xr bpf 4
is attached to the pseudo interface.
.Pp
If
diff --git a/share/man/man4/cc_hd.4 b/share/man/man4/cc_hd.4
index d761539..5c4c2de 100644
--- a/share/man/man4/cc_hd.4
+++ b/share/man/man4/cc_hd.4
@@ -98,7 +98,7 @@ Community Foundation Silicon Valley.
.Sh FUTURE WORK
The Hamilton Institute have recently made some improvements to the algorithm
implemented by this module and have called it Coexistent-TCP (C-TCP).
-The improvments should be evaluated and potentially incorporated into this
+The improvements should be evaluated and potentially incorporated into this
module.
.Sh HISTORY
The
diff --git a/share/man/man4/geom_map.4 b/share/man/man4/geom_map.4
index 3d65dcd..6af91be 100644
--- a/share/man/man4/geom_map.4
+++ b/share/man/man4/geom_map.4
@@ -25,12 +25,12 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 5, 2011
+.Dd May 17, 2011
.Dt GEOM_MAP 4
.Os
.Sh NAME
.Nm geom_map
-.Nd "GEOM module that map difined items as separate partitions"
+.Nd "GEOM module that maps defined items as separate partitions"
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
@@ -41,16 +41,16 @@ kernel configuration file:
.Sh DESCRIPTION
The
.Nm
-framework provides support for mapping defined parts of the media. Basicaly it
-is helpful in the embedded devices where in the one continous flash are loader,
-kernel and rootfs parts. The
+framework provides support for mapping defined parts of the media.
+Basically it is helpful for embedded devices where in the one continuous
+flash are loader, kernel and rootfs parts.
.Nm
-allows making them available as separate parts and protect loader from
-overwriting.
+allows making them available as separate parts and protects the loader from
+being overwritten.
.Pp
At boot time
.Nm
-partitions listed (only with bootverbose) as:
+partitions are listed (only with bootverbose) as:
.Bd -literal -offset indent
MAP: 0x30000, data=0x30000 "/dev/map/bootloader"
MAP: 30000x10000, data=0x10000 "/dev/map/factory"
@@ -62,13 +62,19 @@ MAP: 150000x690000, data=0x690000 "/dev/map/rootfs"
MAP: 7e0000x20000, data=0x20000 "/dev/map/config"
.Ed
.Pp
-Also
+The current
.Nm
-current configuration can be accessible with sysctl's kern.geom.conftxt,
-kern.geom.confxml, kern.geom.confdot or geom map list.
+configuration can be accessed with the following
+.Xr sysctl 8
+nodes:
+.Va kern.geom.conftxt , kern.geom.confxml ,
+and
+.Va kern.geom.confdot
+or by using
+.Dq Li "geom map list" .
.Bd -literal -offset indent
-# sysctl kern.geom.conftxt
-kern.geom.conftxt: 0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc
+# sysctl -n kern.geom.conftxt
+0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc
0 DISK cfid0 8388608 4 hd 0 sc 0
1 MAP map/config 131072 4 i 5 o 8257536 entry 0 dsize 131072
1 MAP map/rootfs 6881280 4 i 4 o 1376256 entry 0 dsize 6881280
@@ -79,49 +85,55 @@ kern.geom.conftxt: 0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc
1 MAP map/bootloader 196608 4 i 0 o 0 entry 0 dsize 196608
.Ed
.Pp
-Driver configuration can be done in device hints file. List of used parameters:
+Driver configuration can be done in
+.Xr device.hints 5 .
+List of used parameters:
.Bl -tag -width indent
-.It Fa at
+.It Va at
select media to attach
-.It Fa name
-name of partiton (will create device /dev/map/that_name)
-.It Fa start
+.It Va name
+name of partition (will create device
+.Pa /dev/map/ Ns Ar that_name )
+.It Va start
offset from the beginning of the parent media to start of the mapped partition.
-This field can also have special value
-"search:searchstart:searchstep:searchkey", where:
+This field can also have a special value
+.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey ,
+where:
.Bl -tag -width indent
-.It Fa searchstart
+.It Ar searchstart
offset from the beginning of the parent media where search will be started
-.It Fa searchstep
+.It Ar searchstep
value of the increment used while searching for the partition boundary markers
-.It Fa searchkey
-key which will be used to find partition boundary markers. Wildcard "." char
-can be used to match any char on that position
+.It Ar searchkey
+key which will be used to find partition boundary markers.
+The wildcard
+.Ql .\&
+can be used to match any character on that position
.El
-.It Fa end
-offset from the beginning of the parent media to end of the mapped partition.
-This field can also have special value
-"search:searchstart:searchstep:searchkey", look "start" for details.
-.It Fa offset
-offset where the data of mapped partition begins
+.It Va end
+offset from the beginning of the parent media to the end of the mapped partition.
+This field can also have the special value
+.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey ,
+as described above.
+.It Va offset
+offset where the data of the mapped partition begins
.El
.Pp
-Each record contains start address(bytes) from the media begin, size(bytes),
-offset where the data of mapped partition begins, and the name of new device.
+Each record contains the start address (in bytes) from the media begin, size
+(in bytes), offset where the data of mapped partition begins, and the name of
+new device.
.Bd -literal -offset indent
MAP: 150000x690000, data=0x690000 "/dev/map/rootfs"
.Ed
.Bd -literal
-00150000 - begin address
+00150000 - start address
00690000 - size
00000000 - data begin from zero offset
00690000 - data size
"map/rootfs" - new media will be accessible via /dev/map/rootfs dev.
.Ed
.Sh EXAMPLES
-.Pp
-.Bl -bullet -compact
-If we need to implement layout shown above, we need to define the folowing
+If we need to implement layout shown above, we need to define the following
hints:
.Bd -literal -offset indent
hint.map.0.at="cfid0"
@@ -129,10 +141,17 @@ hint.map.0.start=0x00000000
hint.map.0.end=0x00030000
hint.map.0.name="bootloader"
hint.map.0.readonly=1
-
.Ed
-define "/dev/map/bootloader" at disk "cfid0" starting at 0x00000000 and end
-0x00030000, also marked as readonly.
+.Pp
+This defines
+.Pa /dev/map/bootloader
+at disk
+.Pa cfid0
+starting at
+.Li 0x00000000
+and ending at
+.Li 0x00030000 ,
+it is also marked as readonly.
.Bd -literal -offset indent
hint.map.1.at="cfid0"
hint.map.1.start=0x00030000
@@ -148,13 +167,28 @@ hint.map.3.at="cfid0"
hint.map.3.name="kernel"
hint.map.3.start=0x00040000
hint.map.3.end="search:0x00100000:0x10000:.!/bin/sh"
-
.Ed
-define "/dev/map/kernel" at disk "cfid0" starting at 0x00040000, but end
-position must be searched by the key ".!/bin/sh", from offset 0x00100000 to end
-of media with step 0x10000. Real marker in that case is "#!/bin/sh", but "#"
-terminates the line when hints file is parsed, so we need to use wildcard "."
-instead of "#".
+.Pp
+This defines
+.Pa /dev/map/kernel
+at disk
+.Pa cfid0
+starting at
+.Li 0x00040000 ,
+but the end position must be searched by finding the key
+.Dq Li ".!/bin/sh" ,
+from offset
+.Li 0x00100000
+to the end of media with step
+.Li 0x10000 .
+The real marker in this case is
+.Dq Li "#!/bin/sh" ,
+but
+.Ql #
+terminates the line when the hints file is parsed, so we need to use wildcard
+.Ql .\&
+instead of
+.Ql # .
.Bd -literal -offset indent
hint.map.4.at="cfid0"
hint.map.4.name="rootfs"
@@ -166,13 +200,11 @@ hint.map.5.start=0x007e0000
hint.map.5.end=0x00800000
hint.map.5.name="config"
.Ed
-.El
.Sh SEE ALSO
-.Xr GEOM 4 ,
+.Xr geom 4 ,
.Xr geom 8 ,
.Xr sysctl 8
.Sh AUTHORS
-.An -nosplit
The
.Nm
driver was written by
diff --git a/share/man/man4/xhci.4 b/share/man/man4/xhci.4
index 670d395..09f3185 100644
--- a/share/man/man4/xhci.4
+++ b/share/man/man4/xhci.4
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 24, 2011
+.Dd May 17, 2011
.Dt XHCI 4
.Os
.Sh NAME
@@ -49,6 +49,13 @@ The
controller supports
.Tn USB
connection speeds up to 5.0Gbps when using a USB 3.0 compliant device.
+.Sh HARDWARE
+The
+.Nm
+driver supports
+.Tn XHCI
+compatible controllers having PCI class 12 (serial bus),
+subclass 3 (USB) and programming interface 48 (XHCI).
.Sh SEE ALSO
.Xr ehci 4 ,
.Xr ohci 4 ,
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 16f247b..cf062c5 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -3772,7 +3772,7 @@ Set to
.Dq Li -l -U root
by default.
These are flags to pass to
-.Xr jail .
+.Xr jail 8 .
.It Va jail_ Ns Ao Ar jname Ac Ns Va _interface
.Pq Vt str
Unset by default.
diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index 134e4f3..acae4c0 100644
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -1,7 +1,7 @@
.\" DO NOT EDIT-- this file is automatically generated.
.\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru
.\" $FreeBSD$
-.Dd May 10, 2011
+.Dd May 17, 2011
.Dt SRC.CONF 5
.Os
.Sh NAME
@@ -712,6 +712,11 @@ will not be built either if this option is set.
Set to not build
.Xr ntpd 8
and related programs.
+.It Va WITH_OFED
+.\" from FreeBSD: head/tools/build/options/WITH_OFED 222016 2011-05-17 11:06:41Z ru
+Set to build the
+.Dq "OpenFabrics Enterprise Distribution"
+Infiniband software stack.
.It Va WITHOUT_OPENSSH
.\" from FreeBSD: head/tools/build/options/WITHOUT_OPENSSH 156932 2006-03-21 07:50:50Z ru
Set to not build OpenSSH.
diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9
index 4b93df5..500bfbd 100644
--- a/share/man/man9/sbuf.9
+++ b/share/man/man9/sbuf.9
@@ -52,7 +52,7 @@
.Nm sbuf_len ,
.Nm sbuf_done ,
.Nm sbuf_delete
-.Nd safe string formatting
+.Nd safe string composition
.Sh SYNOPSIS
.In sys/types.h
.In sys/sbuf.h
@@ -106,14 +106,20 @@
.Sh DESCRIPTION
The
.Nm
-family of functions allows one to safely allocate, construct and
-release bounded NUL-terminated strings in kernel space.
+family of functions allows one to safely allocate, compose and
+release strings in kernel or user space.
+.Pp
Instead of arrays of characters, these functions operate on structures
called
.Fa sbufs ,
defined in
.In sys/sbuf.h .
.Pp
+Any errors encountered during the allocation or composition of the
+string will be latched in the data structure,
+making a single error test at the end of the composition
+sufficient to determine success or failure of the entire process.
+.Pp
The
.Fn sbuf_new
function initializes the
@@ -468,14 +474,35 @@ The
function
returns \-1 if copying string from userland failed, and number of bytes
copied otherwise.
+.Pp
The
-.Fn sbuf_finish
-function returns ENOMEM if the sbuf overflowed before being finished,
+.Fn sbuf_finish 9
+function (the kernel version) returns ENOMEM if the sbuf overflowed before
+being finished,
or returns the error code from the drain if one is attached.
-When used as
-.Xr sbuf_finish 3 ,
-.Fn sbuf_finish
-will return \-1 and set errno on error instead.
+.Pp
+The
+.Fn sbuf_finish 3
+function (the userland version)
+will return zero for success and \-1 and set errno on error.
+.Sh EXAMPLES
+.Bd -literal -compact
+#include <sys/sbuf.h>
+
+struct sbuf *sb;
+
+sb = sbuf_new_auto();
+sbuf_cat("Customers found:\en");
+TAILQ_FOREACH(foo, &foolist, list) {
+ sbuf_printf(" %4d %s\en", foo->index, foo->name);
+ sbuf_printf(" Address: %s\en", foo->address);
+ sbuf_printf(" Zip: %s\en", foo->zipcode);
+}
+if (sbuf_finish(sb))
+ err(1,"Could not generate message");
+transmit_msg(sbuf_data(sb), sbuf_len(sb));
+sbuf_delete(sb);
+.Ed
.Sh SEE ALSO
.Xr printf 3 ,
.Xr strcat 3 ,
diff --git a/share/misc/iso3166 b/share/misc/iso3166
index 70ca84f..23c9bd6 100644
--- a/share/misc/iso3166
+++ b/share/misc/iso3166
@@ -46,6 +46,7 @@ BJ BEN 204 Benin
BM BMU 060 Bermuda
BT BTN 064 Bhutan
BO BOL 068 Bolivia, Plurinational State of
+BQ BES 535 Bonaire, Saint Eustatius and Saba
BA BIH 070 Bosnia and Herzegovina
BW BWA 072 Botswana
BV BVT 074 Bouvet Island
@@ -75,6 +76,7 @@ CR CRI 188 Costa Rica
CI CIV 384 Cote d'Ivoire
HR HRV 191 Croatia
CU CUB 192 Cuba
+CW CUW 531 Curacao
CY CYP 196 Cyprus
CZ CZE 203 Czech Republic
DK DNK 208 Denmark
@@ -174,7 +176,6 @@ NA NAM 516 Namibia
NR NRU 520 Nauru
NP NPL 524 Nepal
NL NLD 528 Netherlands
-AN ANT 530 Netherlands Antilles
NC NCL 540 New Caledonia
NZ NZL 554 New Zealand
NI NIC 558 Nicaragua
@@ -205,7 +206,7 @@ RW RWA 646 Rwanda
BL BLM 652 Saint Barthelemy
KN KNA 659 Saint Kitts and Nevis
LC LCA 662 Saint Lucia
-MF MAF 663 Saint Martin
+MF MAF 663 Saint Martin (French Part)
VC VCT 670 Saint Vincent and the Grenadines
WS WSM 882 Samoa
SM SMR 674 San Marino
@@ -216,6 +217,7 @@ RS SRB 688 Serbia
SC SYC 690 Seychelles
SL SLE 694 Sierra Leone
SG SGP 702 Singapore
+SX SXM 534 Sint Maarten (Dutch part)
SK SVK 703 Slovakia
SI SVN 705 Slovenia
SB SLB 090 Solomon Islands
@@ -224,7 +226,7 @@ ZA ZAF 710 South Africa
GS SGS 239 South Georgia and the South Sandwich Islands
ES ESP 724 Spain
LK LKA 144 Sri Lanka
-SH SHN 654 Saint Helena
+SH SHN 654 Saint Helena, Ascension and Tristan da Cunha
PM SPM 666 Saint Pierre and Miquelon
SD SDN 736 Sudan
SR SUR 740 Suriname
@@ -395,7 +397,7 @@ ZW ZWE 716 Zimbabwe
# Newsletter III-41 1993-07-28
# MAURITIUS, changes outside this document
#
-# Newletter III-42 1993-07-12
+# Newsletter III-42 1993-07-12
# SAINT VINCENT AND THE GRENADINES, changes outside this document
#
# Newsletter III-43 1993-07-12
@@ -426,15 +428,15 @@ ZW ZWE 716 Zimbabwe
# Czechoslovakia officially deleted
#
# Newsletter III-52, 1993-07-02
-# Angola, changing information not included in this file. Offical name
+# Angola, changing information not included in this file. Official name
# change to Republic of Angola
#
# Newsletter III-53, 1993-07-12
-# Madagascar, changing information not included in this file. Official
+# Madagascar, changing information not included in this file. Official
# name change to Republic of Madagascar
#
# Newsletter III-54, 1993-07-23
-# South Georgia and the South Sandwich Islands, previously covered by
+# South Georgia and the South Sandwich Islands, previously covered by
# Falkland Islands
#
# Newsletter III-55, 1993-07-16
@@ -450,23 +452,23 @@ ZW ZWE 716 Zimbabwe
#
# Newsletter III-58, 1993-07-16
# Afghanistan, changing information not included in this file
-# Official name change to Islamic State of Afghanistan
+# Official name change to Islamic State of Afghanistan
#
-# Newsletter III-32, 1993-07-25 ammendment
-# Kyrgyzstan, changing information not included in this file. Offical name
+# Newsletter III-32, 1993-07-25 amendment
+# Kyrgyzstan, changing information not included in this file. Official name
# change to Kyrgyz Republic
#
# Newsletter III-59, 1994-01-26
-# Andorra, changing information not included in this file. Offical name
+# Andorra, changing information not included in this file. Official name
# change to Pricipality of Andorra
#
# Newsletter III-60, 1994-01-26
-# Cambodia, changing information not included in this file. Offical name
+# Cambodia, changing information not included in this file. Official name
# change to Kingdom of Cambodia
#
# Thu Feb 10 1994
# At this point the fourth edition of ISO 3166 appears. It can *now* be
-# ordered from national standards institutions. The RIPE NCC will continue
+# ordered from national standards institutions. The RIPE NCC will continue
# tracking changes.
#
# [deletia]
@@ -537,3 +539,11 @@ ZW ZWE 716 Zimbabwe
#
# Newsletter VI-6 2009-05-08
# Name change for Plurinational State of Bolivia.
+#
+# Newsletter VI-7 2010-02-22
+# Name change for Saint Helena, Ascension and Tristan da Cunha
+#
+# Newsletter VI-8 2010-12-15
+# BONAIRE, SAINT EUSTATIUS AND SABA (BQ), CURACAO (CW) and
+# SINT MAARTEN (DUTCH PART) (SX) added as new entries.
+# NETHERLANDS ANTILLES (AN) removed.
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
index 9a948ff..d3fb51a 100644
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -129,7 +129,6 @@ MINUSLPAM+= -lypclnt
LIBPANEL?= ${DESTDIR}${LIBDIR}/libpanel.a
LIBPCAP?= ${DESTDIR}${LIBDIR}/libpcap.a
-LIBPKG?= ${DESTDIR}${LIBDIR}/libpkg.a
LIBPMC?= ${DESTDIR}${LIBDIR}/libpmc.a
LIBPROC?= ${DESTDIR}${LIBDIR}/libproc.a
LIBPTHREAD?= ${DESTDIR}${LIBDIR}/libpthread.a
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index 090b690..b14bba0 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -140,16 +140,20 @@ ath_hal_ether_sprintf(const u_int8_t *mac)
}
#ifdef AH_DEBUG
+
+/* This must match the definition in ath_hal/ah_debug.h */
+#define HAL_DEBUG_UNMASKABLE 0xf0000000
void
DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
{
- if (ath_hal_debug & mask) {
+ if ((mask == HAL_DEBUG_UNMASKABLE) || (ath_hal_debug & mask)) {
__va_list ap;
va_start(ap, fmt);
ath_hal_vprintf(ah, fmt, ap);
va_end(ap);
}
}
+#undef HAL_DEBUG_UNMASKABLE
#endif /* AH_DEBUG */
#ifdef AH_DEBUG_ALQ
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
index 15f3864..0d6adc1 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
@@ -857,7 +857,7 @@ ar5212GetCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type,
case HAL_CAP_MCAST_KEYSRCH: /* multicast frame keycache search */
switch (capability) {
case 0: /* hardware capability */
- return HAL_OK;
+ return pCap->halMcastKeySrchSupport ? HAL_OK : HAL_ENXIO;
case 1:
return (ahp->ah_staId1Defaults &
AR_STA_ID1_MCAST_KSRCH) ? HAL_OK : HAL_ENXIO;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
index d545733..6779bf9 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
@@ -816,7 +816,7 @@ ar5416FillCapabilityInfo(struct ath_hal *ah)
pCap->halPSPollBroken = AH_TRUE; /* XXX fixed in later revs? */
pCap->halVEOLSupport = AH_TRUE;
pCap->halBssIdMaskSupport = AH_TRUE;
- pCap->halMcastKeySrchSupport = AH_FALSE;
+ pCap->halMcastKeySrchSupport = AH_TRUE; /* Works on AR5416 and later */
pCap->halTsfAddSupport = AH_TRUE;
pCap->hal4AddrAggrSupport = AH_FALSE; /* Broken in Owl */
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 929f31b..e336566 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_dl.h>
+#include <net/if_vlan_var.h>
#include "common/t4_hw.h"
#include "common/common.h"
diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h
index db74809..216882c 100644
--- a/sys/dev/pci/pcireg.h
+++ b/sys/dev/pci/pcireg.h
@@ -367,6 +367,7 @@
#define PCIP_SERIALBUS_USB_UHCI 0x00
#define PCIP_SERIALBUS_USB_OHCI 0x10
#define PCIP_SERIALBUS_USB_EHCI 0x20
+#define PCIP_SERIALBUS_USB_XHCI 0x30
#define PCIP_SERIALBUS_USB_DEVICE 0xfe
#define PCIS_SERIALBUS_FC 0x04
#define PCIS_SERIALBUS_SMBUS 0x05
diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c
index 984ed39..40358bf 100644
--- a/sys/dev/usb/controller/xhci_pci.c
+++ b/sys/dev/usb/controller/xhci_pci.c
@@ -137,7 +137,7 @@ xhci_pci_match(device_t self)
{
if ((pci_get_class(self) == PCIC_SERIALBUS)
&& (pci_get_subclass(self) == PCIS_SERIALBUS_USB)
- && (pci_get_progif(self) == PCI_INTERFACE_XHCI)) {
+ && (pci_get_progif(self) == PCIP_SERIALBUS_USB_XHCI)) {
return ("XHCI (generic) USB 3.0 controller");
}
return (NULL); /* dunno */
diff --git a/sys/dev/usb/controller/xhcireg.h b/sys/dev/usb/controller/xhcireg.h
index fb2d1ca..71c5c28 100644
--- a/sys/dev/usb/controller/xhcireg.h
+++ b/sys/dev/usb/controller/xhcireg.h
@@ -33,7 +33,6 @@
#define PCI_XHCI_USBREV 0x60 /* RO USB protocol revision */
#define PCI_USB_REV_3_0 0x30 /* USB 3.0 */
#define PCI_XHCI_FLADJ 0x61 /* RW frame length adjust */
-#define PCI_INTERFACE_XHCI 0x30 /* USB 3.0 - XHCI */
/* XHCI capability registers */
#define XHCI_CAPLENGTH 0x00 /* RO capability */
diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c
index 793e17e..e931e65 100644
--- a/sys/kern/subr_sbuf.c
+++ b/sys/kern/subr_sbuf.c
@@ -67,7 +67,7 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers");
#define SBUF_ISDYNSTRUCT(s) ((s)->s_flags & SBUF_DYNSTRUCT)
#define SBUF_ISFINISHED(s) ((s)->s_flags & SBUF_FINISHED)
#define SBUF_HASROOM(s) ((s)->s_len < (s)->s_size - 1)
-#define SBUF_FREESPACE(s) ((s)->s_size - (s)->s_len - 1)
+#define SBUF_FREESPACE(s) ((s)->s_size - ((s)->s_len + 1))
#define SBUF_CANEXTEND(s) ((s)->s_flags & SBUF_AUTOEXTEND)
/*
@@ -77,8 +77,14 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers");
#define SBUF_CLEARFLAG(s, f) do { (s)->s_flags &= ~(f); } while (0)
#define SBUF_MINEXTENDSIZE 16 /* Should be power of 2. */
+
+#ifdef PAGE_SIZE
#define SBUF_MAXEXTENDSIZE PAGE_SIZE
#define SBUF_MAXEXTENDINCR PAGE_SIZE
+#else
+#define SBUF_MAXEXTENDSIZE 4096
+#define SBUF_MAXEXTENDINCR 4096
+#endif
/*
* Debugging support
@@ -138,7 +144,6 @@ sbuf_extendsize(int size)
return (newsize);
}
-
/*
* Extend an sbuf.
*/
@@ -154,7 +159,7 @@ sbuf_extend(struct sbuf *s, int addlen)
newbuf = SBMALLOC(newsize);
if (newbuf == NULL)
return (-1);
- bcopy(s->s_buf, newbuf, s->s_size);
+ memcpy(newbuf, s->s_buf, s->s_size);
if (SBUF_ISDYNAMIC(s))
SBFREE(s->s_buf);
else
@@ -165,6 +170,38 @@ sbuf_extend(struct sbuf *s, int addlen)
}
/*
+ * Initialize the internals of an sbuf.
+ * If buf is non-NULL, it points to a static or already-allocated string
+ * big enough to hold at least length characters.
+ */
+static struct sbuf *
+sbuf_newbuf(struct sbuf *s, char *buf, int length, int flags)
+{
+
+ memset(s, 0, sizeof(*s));
+ s->s_flags = flags;
+ s->s_size = length;
+ s->s_buf = buf;
+
+ if ((s->s_flags & SBUF_AUTOEXTEND) == 0) {
+ KASSERT(s->s_size > 1,
+ ("attempt to create a too small sbuf"));
+ }
+
+ if (s->s_buf != NULL)
+ return (s);
+
+ if ((flags & SBUF_AUTOEXTEND) != 0)
+ s->s_size = sbuf_extendsize(s->s_size);
+
+ s->s_buf = SBMALLOC(s->s_size);
+ if (s->s_buf == NULL)
+ return (NULL);
+ SBUF_SETFLAG(s, SBUF_DYNAMIC);
+ return (s);
+}
+
+/*
* Initialize an sbuf.
* If buf is non-NULL, it points to a static or already-allocated string
* big enough to hold at least length characters.
@@ -179,31 +216,17 @@ sbuf_new(struct sbuf *s, char *buf, int length, int flags)
("%s called with invalid flags", __func__));
flags &= SBUF_USRFLAGMSK;
- if (s == NULL) {
- s = SBMALLOC(sizeof(*s));
- if (s == NULL)
- return (NULL);
- bzero(s, sizeof(*s));
- s->s_flags = flags;
- SBUF_SETFLAG(s, SBUF_DYNSTRUCT);
- } else {
- bzero(s, sizeof(*s));
- s->s_flags = flags;
- }
- s->s_size = length;
- if (buf != NULL) {
- s->s_buf = buf;
- return (s);
- }
- if ((flags & SBUF_AUTOEXTEND) != 0)
- s->s_size = sbuf_extendsize(s->s_size);
- s->s_buf = SBMALLOC(s->s_size);
- if (s->s_buf == NULL) {
- if (SBUF_ISDYNSTRUCT(s))
- SBFREE(s);
+ if (s != NULL)
+ return (sbuf_newbuf(s, buf, length, flags));
+
+ s = SBMALLOC(sizeof(*s));
+ if (s == NULL)
+ return (NULL);
+ if (sbuf_newbuf(s, buf, length, flags) == NULL) {
+ SBFREE(s);
return (NULL);
}
- SBUF_SETFLAG(s, SBUF_DYNAMIC);
+ SBUF_SETFLAG(s, SBUF_DYNSTRUCT);
return (s);
}
@@ -328,7 +351,7 @@ sbuf_drain(struct sbuf *s)
* buffer and marking overflow.
*/
static void
-sbuf_put_byte(int c, struct sbuf *s)
+sbuf_put_byte(struct sbuf *s, int c)
{
assert_sbuf_integrity(s);
@@ -337,7 +360,7 @@ sbuf_put_byte(int c, struct sbuf *s)
if (s->s_error != 0)
return;
if (SBUF_FREESPACE(s) <= 0) {
- /*
+ /*
* If there is a drain, use it, otherwise extend the
* buffer.
*/
@@ -352,18 +375,6 @@ sbuf_put_byte(int c, struct sbuf *s)
}
/*
- * Append a non-NUL character to an sbuf. This prototype signature is
- * suitable for use with kvprintf(9).
- */
-static void
-sbuf_putc_func(int c, void *arg)
-{
-
- if (c != '\0')
- sbuf_put_byte(c, arg);
-}
-
-/*
* Append a byte string to an sbuf.
*/
int
@@ -378,10 +389,10 @@ sbuf_bcat(struct sbuf *s, const void *buf, size_t len)
if (s->s_error != 0)
return (-1);
for (; str < end; str++) {
- sbuf_put_byte(*str, s);
+ sbuf_put_byte(s, *str);
if (s->s_error != 0)
return (-1);
- }
+ }
return (0);
}
@@ -443,7 +454,7 @@ sbuf_cat(struct sbuf *s, const char *str)
return (-1);
while (*str != '\0') {
- sbuf_put_byte(*str++, s);
+ sbuf_put_byte(s, *str++);
if (s->s_error != 0)
return (-1);
}
@@ -507,6 +518,19 @@ sbuf_cpy(struct sbuf *s, const char *str)
* Format the given argument list and append the resulting string to an sbuf.
*/
#ifdef _KERNEL
+
+/*
+ * Append a non-NUL character to an sbuf. This prototype signature is
+ * suitable for use with kvprintf(9).
+ */
+static void
+sbuf_putc_func(int c, void *arg)
+{
+
+ if (c != '\0')
+ sbuf_put_byte(arg, c);
+}
+
int
sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap)
{
@@ -611,7 +635,7 @@ int
sbuf_putc(struct sbuf *s, int c)
{
- sbuf_putc_func(c, s);
+ sbuf_put_byte(s, c);
if (s->s_error != 0)
return (-1);
return (0);
@@ -654,24 +678,23 @@ sbuf_error(const struct sbuf *s)
int
sbuf_finish(struct sbuf *s)
{
- int error;
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
- error = s->s_error;
if (s->s_drain_func != NULL) {
- while (s->s_len > 0 && error == 0)
- error = sbuf_drain(s);
+ while (s->s_len > 0 && s->s_error == 0)
+ s->s_error = sbuf_drain(s);
}
s->s_buf[s->s_len] = '\0';
- s->s_error = 0;
SBUF_SETFLAG(s, SBUF_FINISHED);
#ifdef _KERNEL
- return (error);
+ return (s->s_error);
#else
- errno = error;
- return (-1);
+ errno = s->s_error;
+ if (s->s_error)
+ return (-1);
+ return (0);
#endif
}
@@ -721,7 +744,7 @@ sbuf_delete(struct sbuf *s)
if (SBUF_ISDYNAMIC(s))
SBFREE(s->s_buf);
isdyn = SBUF_ISDYNSTRUCT(s);
- bzero(s, sizeof(*s));
+ memset(s, 0, sizeof(*s));
if (isdyn)
SBFREE(s);
}
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index ae061f3..83655e8 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -53,10 +53,10 @@ __FBSDID("$FreeBSD$");
#include "opt_sched.h"
#ifdef SMP
-volatile cpuset_t stopped_cpus;
-volatile cpuset_t started_cpus;
-cpuset_t hlt_cpus_mask;
-cpuset_t logical_cpus_mask;
+volatile cpumask_t stopped_cpus;
+volatile cpumask_t started_cpus;
+cpumask_t hlt_cpus_mask;
+cpumask_t logical_cpus_mask;
void (*cpustop_restartfunc)(void);
#endif
@@ -110,6 +110,7 @@ static void (*volatile smp_rv_action_func)(void *arg);
static void (*volatile smp_rv_teardown_func)(void *arg);
static void *volatile smp_rv_func_arg;
static volatile int smp_rv_waiters[3];
+static volatile int smp_rv_generation;
/*
* Shared mutex to restrict busywaits between smp_rendezvous() and
@@ -317,39 +318,63 @@ restart_cpus(cpuset_t map)
void
smp_rendezvous_action(void)
{
- void* local_func_arg = smp_rv_func_arg;
- void (*local_setup_func)(void*) = smp_rv_setup_func;
- void (*local_action_func)(void*) = smp_rv_action_func;
- void (*local_teardown_func)(void*) = smp_rv_teardown_func;
+ void *local_func_arg;
+ void (*local_setup_func)(void*);
+ void (*local_action_func)(void*);
+ void (*local_teardown_func)(void*);
+ int generation;
/* Ensure we have up-to-date values. */
atomic_add_acq_int(&smp_rv_waiters[0], 1);
while (smp_rv_waiters[0] < smp_rv_ncpus)
cpu_spinwait();
- /* setup function */
+ /* Fetch rendezvous parameters after acquire barrier. */
+ local_func_arg = smp_rv_func_arg;
+ local_setup_func = smp_rv_setup_func;
+ local_action_func = smp_rv_action_func;
+ local_teardown_func = smp_rv_teardown_func;
+ generation = smp_rv_generation;
+
+ /*
+ * If requested, run a setup function before the main action
+ * function. Ensure all CPUs have completed the setup
+ * function before moving on to the action function.
+ */
if (local_setup_func != smp_no_rendevous_barrier) {
if (smp_rv_setup_func != NULL)
smp_rv_setup_func(smp_rv_func_arg);
-
- /* spin on entry rendezvous */
atomic_add_int(&smp_rv_waiters[1], 1);
while (smp_rv_waiters[1] < smp_rv_ncpus)
cpu_spinwait();
}
- /* action function */
if (local_action_func != NULL)
local_action_func(local_func_arg);
- /* spin on exit rendezvous */
+ /*
+ * Signal that the main action has been completed. If a
+ * full exit rendezvous is requested, then all CPUs will
+ * wait here until all CPUs have finished the main action.
+ *
+ * Note that the write by the last CPU to finish the action
+ * may become visible to different CPUs at different times.
+ * As a result, the CPU that initiated the rendezvous may
+ * exit the rendezvous and drop the lock allowing another
+ * rendezvous to be initiated on the same CPU or a different
+ * CPU. In that case the exit sentinel may be cleared before
+ * all CPUs have noticed causing those CPUs to hang forever.
+ * Workaround this by using a generation count to notice when
+ * this race occurs and to exit the rendezvous in that case.
+ */
+ MPASS(generation == smp_rv_generation);
atomic_add_int(&smp_rv_waiters[2], 1);
if (local_teardown_func == smp_no_rendevous_barrier)
return;
- while (smp_rv_waiters[2] < smp_rv_ncpus)
+ while (smp_rv_waiters[2] < smp_rv_ncpus &&
+ generation == smp_rv_generation)
cpu_spinwait();
- /* teardown function */
if (local_teardown_func != NULL)
local_teardown_func(local_func_arg);
}
@@ -380,10 +405,11 @@ smp_rendezvous_cpus(cpuset_t map,
if (ncpus == 0)
panic("ncpus is 0 with non-zero map");
- /* obtain rendezvous lock */
mtx_lock_spin(&smp_ipi_mtx);
- /* set static function pointers */
+ atomic_add_acq_int(&smp_rv_generation, 1);
+
+ /* Pass rendezvous parameters via global variables. */
smp_rv_ncpus = ncpus;
smp_rv_setup_func = setup_func;
smp_rv_action_func = action_func;
@@ -393,7 +419,10 @@ smp_rendezvous_cpus(cpuset_t map,
smp_rv_waiters[2] = 0;
atomic_store_rel_int(&smp_rv_waiters[0], 0);
- /* signal other processors, which will enter the IPI with interrupts off */
+ /*
+ * Signal other processors, which will enter the IPI with
+ * interrupts off.
+ */
curcpumap = CPU_ISSET(curcpu, &map);
CPU_CLR(curcpu, &map);
ipi_selected(map, IPI_RENDEZVOUS);
@@ -402,11 +431,15 @@ smp_rendezvous_cpus(cpuset_t map,
if (curcpumap != 0)
smp_rendezvous_action();
+ /*
+ * If the caller did not request an exit barrier to be enforced
+ * on each CPU, ensure that this CPU waits for all the other
+ * CPUs to finish the rendezvous.
+ */
if (teardown_func == smp_no_rendevous_barrier)
while (atomic_load_acq_int(&smp_rv_waiters[2]) < ncpus)
cpu_spinwait();
- /* release lock */
mtx_unlock_spin(&smp_ipi_mtx);
}
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 0dad4e5..aea43b2 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -2210,26 +2210,26 @@ sctp_is_ifa_addr_preferred(struct sctp_ifa *ifa,
* means it is the same scope or higher scope then the destination.
* L = loopback, P = private, G = global
* -----------------------------------------
- * src | dest | result
- * ----------------------------------------
- * L | L | yes
- * -----------------------------------------
- * P | L | yes-v4 no-v6
- * -----------------------------------------
- * G | L | yes-v4 no-v6
- * -----------------------------------------
- * L | P | no
- * -----------------------------------------
- * P | P | yes
- * -----------------------------------------
- * G | P | no
- * -----------------------------------------
- * L | G | no
- * -----------------------------------------
- * P | G | no
- * -----------------------------------------
- * G | G | yes
- * -----------------------------------------
+ * src | dest | result
+ * ----------------------------------------
+ * L | L | yes
+ * -----------------------------------------
+ * P | L | yes-v4 no-v6
+ * -----------------------------------------
+ * G | L | yes-v4 no-v6
+ * -----------------------------------------
+ * L | P | no
+ * -----------------------------------------
+ * P | P | yes
+ * -----------------------------------------
+ * G | P | no
+ * -----------------------------------------
+ * L | G | no
+ * -----------------------------------------
+ * P | G | no
+ * -----------------------------------------
+ * G | G | yes
+ * -----------------------------------------
*/
if (ifa->address.sa.sa_family != fam) {
@@ -2310,14 +2310,14 @@ sctp_is_ifa_addr_acceptable(struct sctp_ifa *ifa,
*
* L = loopback, P = private, G = global
* -----------------------------------------
- * src | dest | result
+ * src | dest | result
* -----------------------------------------
* L | L | yes
* -----------------------------------------
* P | L | yes-v4 no-v6
* -----------------------------------------
* G | L | yes
- * -----------------------------------------
+ * -----------------------------------------
* L | P | no
* -----------------------------------------
* P | P | yes
@@ -2325,7 +2325,7 @@ sctp_is_ifa_addr_acceptable(struct sctp_ifa *ifa,
* G | P | yes - May not work
* -----------------------------------------
* L | G | no
- * -----------------------------------------
+ * -----------------------------------------
* P | G | yes - May not work
* -----------------------------------------
* G | G | yes
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index c9fad80..b3eb805 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -2489,6 +2489,7 @@ flags_out:
paddri->spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT;
paddri->spinfo_rto = net->RTO;
paddri->spinfo_assoc_id = sctp_get_associd(stcb);
+ paddri->spinfo_mtu = net->mtu;
SCTP_TCB_UNLOCK(stcb);
} else {
if (stcb) {
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c
index 7fd55f8..11be68e 100644
--- a/sys/powerpc/booke/pmap.c
+++ b/sys/powerpc/booke/pmap.c
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include <sys/msgbuf.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/vmmeter.h>
diff --git a/tools/build/options/WITH_OFED b/tools/build/options/WITH_OFED
new file mode 100644
index 0000000..6d9c0a1
--- /dev/null
+++ b/tools/build/options/WITH_OFED
@@ -0,0 +1,4 @@
+.\" $FreeBSD: projects/largeSMP/tools/build/options/WITH_OFED 222016 2011-05-17 11:06:41Z ru $
+Set to build the
+.Dq "OpenFabrics Enterprise Distribution"
+Infiniband software stack.
diff --git a/usr.sbin/ifmcstat/ifmcstat.8 b/usr.sbin/ifmcstat/ifmcstat.8
index 5a6956d..9794d70 100644
--- a/usr.sbin/ifmcstat/ifmcstat.8
+++ b/usr.sbin/ifmcstat/ifmcstat.8
@@ -125,7 +125,7 @@ This support is recommended for debugging purposes.
It requires super-user privilege if used to inspect a running kernel.
.Pp
.Sh SEE ALSO
+.Xr netstat 1 ,
.Xr getifaddrs 3 ,
.Xr getifmaddrs 3 ,
-.Xr kvm 3 ,
-.Xr netstat 8
+.Xr kvm 3
diff --git a/usr.sbin/pkg_install/Makefile b/usr.sbin/pkg_install/Makefile
index 0aa1941..bf1a213 100644
--- a/usr.sbin/pkg_install/Makefile
+++ b/usr.sbin/pkg_install/Makefile
@@ -2,11 +2,11 @@
.include <bsd.own.mk>
-SUBDIR= add create delete info updating version
+SUBDIR= lib add create delete info updating version
.include <bsd.subdir.mk>
-DATE!= grep PKG_INSTALL_VERSION ${.CURDIR}/Makefile.inc | sed 's|.*=||'
+DATE!= grep PKG_INSTALL_VERSION ${.CURDIR}/lib/lib.h | sed 's|.*[ ]||'
distfile: clean
@(cd ${.CURDIR}/..; \
diff --git a/usr.sbin/pkg_install/Makefile.inc b/usr.sbin/pkg_install/Makefile.inc
index d929f24..2fa20aa 100644
--- a/usr.sbin/pkg_install/Makefile.inc
+++ b/usr.sbin/pkg_install/Makefile.inc
@@ -2,11 +2,16 @@
.include <bsd.own.mk>
-CFLAGS+= -DPKG_INSTALL_VERSION=20101012
-CFLAGS+= -DYES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
+LIBINSTALL= ${.OBJDIR}/../lib/libinstall.a
-DPADD+= ${LIBPKG}
-LDADD+= -lpkg
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
+
+.if ${MK_OPENSSL} != "no" && \
+ defined(LDADD) && ${LDADD:M-lfetch} != ""
+DPADD+= ${LIBSSL} ${LIBCRYPTO}
+LDADD+= -lssl -lcrypto
+.endif
# Inherit BINDIR from one level up.
.include "../Makefile.inc"
diff --git a/usr.sbin/pkg_install/add/Makefile b/usr.sbin/pkg_install/add/Makefile
index 03a43f0..89988e7 100644
--- a/usr.sbin/pkg_install/add/Makefile
+++ b/usr.sbin/pkg_install/add/Makefile
@@ -1,11 +1,14 @@
# $FreeBSD$
-.include <bsd.own.mk>
-
PROG= pkg_add
SRCS= main.c perform.c futil.c extract.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WARNS?= 3
WFORMAT?= 1
+DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBINSTALL} -lfetch -lmd
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c
index 6c2c4fc..732a13f 100644
--- a/usr.sbin/pkg_install/add/extract.c
+++ b/usr.sbin/pkg_install/add/extract.c
@@ -23,7 +23,7 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "add.h"
diff --git a/usr.sbin/pkg_install/add/futil.c b/usr.sbin/pkg_install/add/futil.c
index c525320..ca095ea 100644
--- a/usr.sbin/pkg_install/add/futil.c
+++ b/usr.sbin/pkg_install/add/futil.c
@@ -22,7 +22,7 @@
__FBSDID("$FreeBSD$");
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "add.h"
/*
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index b8b9b54..f73312a 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -26,7 +26,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <getopt.h>
-#include <pkg.h>
+#include "lib.h"
#include "add.h"
char *Prefix = NULL;
@@ -132,8 +132,6 @@ main(int argc, char **argv)
static char temppackageroot[MAXPATHLEN];
static char pkgaddpath[MAXPATHLEN];
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
if (*argv[0] != '/' && strchr(argv[0], '/') != NULL)
PkgAddCmd = realpath(argv[0], pkgaddpath);
else
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c
index 653a1d6..b23cd52 100644
--- a/usr.sbin/pkg_install/add/perform.c
+++ b/usr.sbin/pkg_install/add/perform.c
@@ -23,7 +23,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <paths.h>
-#include <pkg.h>
+#include "lib.h"
#include "add.h"
#include <libgen.h>
diff --git a/usr.sbin/pkg_install/create/Makefile b/usr.sbin/pkg_install/create/Makefile
index 3334037..42718c6 100644
--- a/usr.sbin/pkg_install/create/Makefile
+++ b/usr.sbin/pkg_install/create/Makefile
@@ -3,10 +3,12 @@
PROG= pkg_create
SRCS= main.c perform.c pl.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WARNS?= 3
WFORMAT?= 1
-DPADD= ${LIBMD}
-LDADD= -lmd
+DPADD= ${LIBINSTALL} ${LIBMD}
+LDADD= ${LIBINSTALL} -lmd
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c
index 5e999da..e4af621 100644
--- a/usr.sbin/pkg_install/create/main.c
+++ b/usr.sbin/pkg_install/create/main.c
@@ -15,7 +15,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "create.h"
match_t MatchType = MATCH_GLOB;
@@ -72,8 +72,6 @@ main(int argc, char **argv)
int ch;
char **pkgs, **start, *tmp;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
pkgs = start = argv;
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
switch(ch) {
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 149bcbd..45786b6 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "create.h"
#include <err.h>
diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c
index fe62d42..18bbaf2 100644
--- a/usr.sbin/pkg_install/create/pl.c
+++ b/usr.sbin/pkg_install/create/pl.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "create.h"
#include <errno.h>
#include <err.h>
diff --git a/usr.sbin/pkg_install/delete/Makefile b/usr.sbin/pkg_install/delete/Makefile
index 4f3b390..c9a0fde 100644
--- a/usr.sbin/pkg_install/delete/Makefile
+++ b/usr.sbin/pkg_install/delete/Makefile
@@ -3,6 +3,11 @@
PROG= pkg_delete
SRCS= main.c perform.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WFORMAT?= 1
+DPADD= ${LIBINSTALL} ${LIBMD}
+LDADD= ${LIBINSTALL} -lmd
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/delete/main.c b/usr.sbin/pkg_install/delete/main.c
index 7677fe9..f09a432 100644
--- a/usr.sbin/pkg_install/delete/main.c
+++ b/usr.sbin/pkg_install/delete/main.c
@@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "delete.h"
char *Prefix = NULL;
@@ -67,8 +67,6 @@ main(int argc, char **argv)
const char *tmp;
struct stat stat_s;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
pkgs = start = argv;
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
switch(ch) {
diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c
index 02f9717..2557dbc 100644
--- a/usr.sbin/pkg_install/delete/perform.c
+++ b/usr.sbin/pkg_install/delete/perform.c
@@ -22,7 +22,7 @@
__FBSDID("$FreeBSD$");
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "delete.h"
static int pkg_do(char *);
diff --git a/usr.sbin/pkg_install/info/Makefile b/usr.sbin/pkg_install/info/Makefile
index ba3909d..485cb22 100644
--- a/usr.sbin/pkg_install/info/Makefile
+++ b/usr.sbin/pkg_install/info/Makefile
@@ -3,9 +3,11 @@
PROG= pkg_info
SRCS= main.c perform.c show.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WFORMAT?= 1
-DPADD= ${LIBMD}
-LDADD= -lmd
+DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBINSTALL} -lfetch -lmd
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h
index 68ec710..46e29b1 100644
--- a/usr.sbin/pkg_install/info/info.h
+++ b/usr.sbin/pkg_install/info/info.h
@@ -33,26 +33,25 @@
#define MAXNAMESIZE 20
#endif
-#define SHOW_COMMENT 0x000001
-#define SHOW_DESC 0x000002
-#define SHOW_PLIST 0x000004
-#define SHOW_INSTALL 0x000008
-#define SHOW_DEINSTALL 0x000010
-#define SHOW_REQUIRE 0x000020
-#define SHOW_PREFIX 0x000040
-#define SHOW_INDEX 0x000080
-#define SHOW_FILES 0x000100
-#define SHOW_DISPLAY 0x000200
-#define SHOW_REQBY 0x000400
-#define SHOW_MTREE 0x000800
-#define SHOW_SIZE 0x001000
-#define SHOW_ORIGIN 0x002000
-#define SHOW_CKSUM 0x004000
-#define SHOW_FMTREV 0x008000
-#define SHOW_PTREV 0x010000
-#define SHOW_DEPEND 0x020000
-#define SHOW_PKGNAME 0x040000
-#define SHOW_LPREV 0x100000
+#define SHOW_COMMENT 0x00001
+#define SHOW_DESC 0x00002
+#define SHOW_PLIST 0x00004
+#define SHOW_INSTALL 0x00008
+#define SHOW_DEINSTALL 0x00010
+#define SHOW_REQUIRE 0x00020
+#define SHOW_PREFIX 0x00040
+#define SHOW_INDEX 0x00080
+#define SHOW_FILES 0x00100
+#define SHOW_DISPLAY 0x00200
+#define SHOW_REQBY 0x00400
+#define SHOW_MTREE 0x00800
+#define SHOW_SIZE 0x01000
+#define SHOW_ORIGIN 0x02000
+#define SHOW_CKSUM 0x04000
+#define SHOW_FMTREV 0x08000
+#define SHOW_PTREV 0x10000
+#define SHOW_DEPEND 0x20000
+#define SHOW_PKGNAME 0x40000
struct which_entry {
TAILQ_ENTRY(which_entry) next;
diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c
index ca4e477..2de638e 100644
--- a/usr.sbin/pkg_install/info/main.c
+++ b/usr.sbin/pkg_install/info/main.c
@@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "info.h"
int Flags = 0;
@@ -68,8 +68,6 @@ main(int argc, char **argv)
char **pkgs, **start;
char *pkgs_split;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
whead = malloc(sizeof(struct which_head));
if (whead == NULL)
err(2, NULL);
@@ -227,10 +225,7 @@ main(int argc, char **argv)
}
case 'P':
- if (Flags & SHOW_PTREV)
- Flags |= SHOW_LPREV;
- else
- Flags = SHOW_PTREV;
+ Flags = SHOW_PTREV;
break;
case 'h':
@@ -247,11 +242,6 @@ main(int argc, char **argv)
if (!Quiet)
printf("Package tools revision: ");
printf("%d\n", PKG_INSTALL_VERSION);
- if (Flags & SHOW_LPREV) {
- if (!Quiet)
- printf("Libpkg revision: ");
- printf("%d\n", libpkg_version());
- }
exit(0);
}
diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c
index d295612..09cad78 100644
--- a/usr.sbin/pkg_install/info/perform.c
+++ b/usr.sbin/pkg_install/info/perform.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "info.h"
#include <err.h>
#include <signal.h>
diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c
index 0d3b4ad..c65c312 100644
--- a/usr.sbin/pkg_install/info/show.c
+++ b/usr.sbin/pkg_install/info/show.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "info.h"
#include <err.h>
#include <stdlib.h>
diff --git a/usr.sbin/pkg_install/lib/Makefile b/usr.sbin/pkg_install/lib/Makefile
new file mode 100644
index 0000000..84a41b8
--- /dev/null
+++ b/usr.sbin/pkg_install/lib/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+LIB= install
+INTERNALLIB=
+SRCS= file.c msg.c plist.c str.c exec.c global.c pen.c match.c \
+ deps.c version.c pkgwrap.c url.c
+
+WARNS?= 3
+WFORMAT?= 1
+
+.include <bsd.lib.mk>
diff --git a/lib/libpkg/deps.c b/usr.sbin/pkg_install/lib/deps.c
index 101d046..66f44a9 100644
--- a/lib/libpkg/deps.c
+++ b/usr.sbin/pkg_install/lib/deps.c
@@ -22,7 +22,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <stdio.h>
diff --git a/lib/libpkg/exec.c b/usr.sbin/pkg_install/lib/exec.c
index 04891d3..fc8220c 100644
--- a/lib/libpkg/exec.c
+++ b/usr.sbin/pkg_install/lib/exec.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
/*
diff --git a/lib/libpkg/file.c b/usr.sbin/pkg_install/lib/file.c
index 7c95f99..c7ab9d6 100644
--- a/lib/libpkg/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <pwd.h>
#include <time.h>
diff --git a/lib/libpkg/global.c b/usr.sbin/pkg_install/lib/global.c
index 8103126..e136ec8 100644
--- a/lib/libpkg/global.c
+++ b/usr.sbin/pkg_install/lib/global.c
@@ -22,7 +22,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
/* These are global for all utils */
Boolean Quiet = FALSE;
diff --git a/lib/libpkg/pkg.h b/usr.sbin/pkg_install/lib/lib.h
index 12e3562..089bfa3 100644
--- a/lib/libpkg/pkg.h
+++ b/usr.sbin/pkg_install/lib/lib.h
@@ -23,10 +23,6 @@
#ifndef _INST_LIB_LIB_H_
#define _INST_LIB_LIB_H_
-#ifndef YES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
-#error "You obviously have no idea what you're doing."
-#endif
-
/* Includes */
#include <sys/param.h>
#include <sys/file.h>
@@ -100,12 +96,13 @@
#define PKG_PREFIX_VNAME "PKG_PREFIX"
/*
- * Version of the package library - increase whenever you make a change
+ * Version of the package tools - increase whenever you make a change
* in the code that is not cosmetic only.
*/
-#define LIBPKG_VERSION 20100423
+#define PKG_INSTALL_VERSION 20100403
#define PKG_WRAPCONF_FNAME "/var/db/pkg_install.conf"
+#define main(argc, argv) real_main(argc, argv)
/* Version numbers to assist with changes in package file format */
#define PLIST_FMT_VER_MAJOR 1
@@ -217,7 +214,7 @@ Boolean make_preserve_name(char *, int, const char *, const char *);
/* For all */
int pkg_perform(char **);
-void pkg_wrap(long, char **);
+int real_main(int, char **);
/* Query installed packages */
char **matchinstalled(match_t, char **, int *);
@@ -232,7 +229,6 @@ int chkifdepends(const char *, const char *);
int requiredby(const char *, struct reqr_by_head **, Boolean, Boolean);
/* Version */
-int libpkg_version(void);
int verscmp(Package *, int, int);
int version_cmp(const char *, const char *);
diff --git a/lib/libpkg/match.c b/usr.sbin/pkg_install/lib/match.c
index ba65442..6c1b2bf 100644
--- a/lib/libpkg/match.c
+++ b/usr.sbin/pkg_install/lib/match.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <fnmatch.h>
#include <fts.h>
@@ -292,7 +292,7 @@ matchallbyorigin(const char **origins, int *retval)
break;
}
}
- if (cmd != PLIST_ORIGIN && 0 != strncmp("bsdpan-", installed[i], 7))
+ if (cmd != PLIST_ORIGIN && ( Verbose || 0 != strncmp("bsdpan-", installed[i], 7 ) ) )
warnx("package %s has no origin recorded", installed[i]);
fclose(fp);
}
diff --git a/lib/libpkg/msg.c b/usr.sbin/pkg_install/lib/msg.c
index 0d25ad1..5b17624 100644
--- a/lib/libpkg/msg.c
+++ b/usr.sbin/pkg_install/lib/msg.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <paths.h>
@@ -61,7 +61,12 @@ y_or_n(Boolean def, const char *msg, ...)
else
fprintf(stderr, " [no]? ");
fflush(stderr);
- ch = toupper(fgetc(tty));
+ if (AutoAnswer) {
+ ch = (AutoAnswer == YES) ? 'Y' : 'N';
+ fprintf(stderr, "%c\n", ch);
+ }
+ else
+ ch = toupper(fgetc(tty));
if (ch == '\n')
ch = (def) ? 'Y' : 'N';
}
diff --git a/lib/libpkg/pen.c b/usr.sbin/pkg_install/lib/pen.c
index 6e30445..2b405a3 100644
--- a/lib/libpkg/pen.c
+++ b/usr.sbin/pkg_install/lib/pen.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <libutil.h>
#include <libgen.h>
@@ -103,7 +103,7 @@ popPen(char *pen)
const char *
make_playpen(char *pen, off_t sz)
{
- char humbuf[6];
+ char humbuf1[6], humbuf2[6];
char cwd[FILENAME_MAX];
if (!find_play_pen(pen, sz))
@@ -114,15 +114,22 @@ make_playpen(char *pen, off_t sz)
errx(2, "%s: can't mktemp '%s'", __func__, pen);
}
- humanize_number(humbuf, sizeof humbuf, sz, "", HN_AUTOSCALE, HN_NOSPACE);
+ if (Verbose) {
+ if (sz) {
+ humanize_number(humbuf1, sizeof humbuf1, sz, "", HN_AUTOSCALE,
+ HN_NOSPACE);
+ humanize_number(humbuf2, sizeof humbuf2, min_free(pen),
+ "", HN_AUTOSCALE, HN_NOSPACE);
+ fprintf(stderr, "Requested space: %s bytes, free space: %s bytes in %s\n", humbuf1, humbuf2, pen);
+ }
+ }
if (min_free(pen) < sz) {
rmdir(pen);
cleanup(0);
errx(2, "%s: not enough free space to create '%s'.\n"
"Please set your PKG_TMPDIR environment variable to a location\n"
- "with at least %s and try the command again",
- __func__, humbuf, pen);
+ "with more space and\ntry the command again", __func__, pen);
}
if (!getcwd(cwd, FILENAME_MAX)) {
diff --git a/usr.sbin/pkg_install/lib/pkgwrap.c b/usr.sbin/pkg_install/lib/pkgwrap.c
new file mode 100644
index 0000000..cbd15cd
--- /dev/null
+++ b/usr.sbin/pkg_install/lib/pkgwrap.c
@@ -0,0 +1,89 @@
+/*
+ * FreeBSD install - a package for the installation and maintenance
+ * of non-core utilities.
+ *
+ * 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.
+ *
+ * Maxim Sobolev
+ * 8 September 2002
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "lib.h"
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#undef main
+
+#define SEPARATORS " \t"
+
+extern char **environ;
+
+int
+main(int argc, char **argv)
+{
+ FILE *f;
+ char buffer[FILENAME_MAX], *cp, *verstr;
+ int len;
+
+ if (getenv("PKG_NOWRAP") != NULL)
+ goto nowrap;
+ f = fopen(PKG_WRAPCONF_FNAME, "r");
+ if (f == NULL)
+ goto nowrap;
+ cp = fgets(buffer, 256, f);
+ fclose(f);
+ if (cp == NULL)
+ goto nowrap;
+ len = strlen(cp);
+ if (cp[len - 1] == '\n')
+ cp[len - 1] = '\0';
+ while (strchr(SEPARATORS, *cp) != NULL)
+ cp++;
+ verstr = cp;
+ cp = strpbrk(cp, SEPARATORS);
+ if (cp == NULL)
+ goto nowrap;
+ *cp = '\0';
+ for (cp = verstr; *cp != '\0'; cp++)
+ if (isdigit(*cp) == 0)
+ goto nowrap;
+ if (atoi(verstr) < PKG_INSTALL_VERSION)
+ goto nowrap;
+ cp++;
+ while (*cp != '\0' && strchr(SEPARATORS, *cp) != NULL)
+ cp++;
+ if (*cp == '\0')
+ goto nowrap;
+ bcopy(cp, buffer, strlen(cp) + 1);
+ cp = strpbrk(buffer, SEPARATORS);
+ if (cp != NULL)
+ *cp = '\0';
+ if (!isdir(buffer))
+ goto nowrap;
+ cp = strrchr(argv[0], '/');
+ if (cp == NULL)
+ cp = argv[0];
+ else
+ cp++;
+ strlcat(buffer, "/", sizeof(buffer));
+ strlcat(buffer, cp, sizeof(buffer));
+ setenv("PKG_NOWRAP", "1", 1);
+ execve(buffer, argv, environ);
+
+nowrap:
+ unsetenv("PKG_NOWRAP");
+ return(real_main(argc, argv));
+}
diff --git a/lib/libpkg/plist.c b/usr.sbin/pkg_install/lib/plist.c
index b14ac20..545b541 100644
--- a/lib/libpkg/plist.c
+++ b/usr.sbin/pkg_install/lib/plist.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <md5.h>
diff --git a/lib/libpkg/str.c b/usr.sbin/pkg_install/lib/str.c
index c26e6cc..0d9e288 100644
--- a/lib/libpkg/str.c
+++ b/usr.sbin/pkg_install/lib/str.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
char *
strconcat(const char *s1, const char *s2)
diff --git a/lib/libpkg/url.c b/usr.sbin/pkg_install/lib/url.c
index 4c10849..8c55347 100644
--- a/lib/libpkg/url.c
+++ b/usr.sbin/pkg_install/lib/url.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <fetch.h>
#include <libgen.h>
@@ -109,7 +109,7 @@ fileGetURL(const char *base, const char *spec, int keep_package)
printf("Error: Unable to get %s: %s\n",
fname, fetchLastErrString);
/* If the fetch fails, yank the package. */
- if (keep_package && unlink(pkg) < 0) {
+ if (keep_package && unlink(pkg) < 0 && Verbose) {
warnx("failed to remove partially fetched package: %s", pkg);
}
return NULL;
diff --git a/lib/libpkg/version.c b/usr.sbin/pkg_install/lib/version.c
index 123fd5d2..d9c4fe7 100644
--- a/lib/libpkg/version.c
+++ b/usr.sbin/pkg_install/lib/version.c
@@ -19,20 +19,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
/*
- * This routine could easily go somewhere else.
- *
- */
-int
-libpkg_version(void)
-{
- return LIBPKG_VERSION;
-}
-
-/*
* Routines to assist with PLIST_FMT_VER numbers in the packing
* lists.
*
@@ -76,7 +66,7 @@ split_version(const char *pkgname, const char **endname, unsigned long *epoch, u
if (pkgname == NULL)
errx(2, "%s: Passed NULL pkgname.", __func__);
- /* Look for the last '-' the pkgname */
+ /* Look for the last '-' the the pkgname */
ch = strrchr(pkgname, '-');
/* Cheat if we are just passed a version, not a valid package name */
versionstr = ch ? ch + 1 : pkgname;
diff --git a/usr.sbin/pkg_install/updating/Makefile b/usr.sbin/pkg_install/updating/Makefile
index f5b7525..b0d3689 100644
--- a/usr.sbin/pkg_install/updating/Makefile
+++ b/usr.sbin/pkg_install/updating/Makefile
@@ -3,6 +3,11 @@
PROG= pkg_updating
SRCS= main.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WFORMAT?= 1
+DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBINSTALL} -lfetch -lmd
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/updating/main.c b/usr.sbin/pkg_install/updating/main.c
index 993ccd5..0ab2ec0 100644
--- a/usr.sbin/pkg_install/updating/main.c
+++ b/usr.sbin/pkg_install/updating/main.c
@@ -19,7 +19,7 @@ __FBSDID("$FreeBSD$");
#include <sysexits.h>
#include <getopt.h>
-#include <pkg.h>
+#include "lib.h"
#include "pathnames.h"
typedef struct installedport {
@@ -87,8 +87,6 @@ main(int argc, char *argv[])
DIR *dir;
FILE *fd;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch (ch) {
case 'd':
diff --git a/usr.sbin/pkg_install/version/Makefile b/usr.sbin/pkg_install/version/Makefile
index fb079e3..3e1d7a5 100644
--- a/usr.sbin/pkg_install/version/Makefile
+++ b/usr.sbin/pkg_install/version/Makefile
@@ -3,8 +3,13 @@
PROG= pkg_version
SRCS= main.c perform.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WFORMAT?= 1
+DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBINSTALL} -lfetch -lmd
+
test:
sh ${.CURDIR}/test-pkg_version.sh
diff --git a/usr.sbin/pkg_install/version/main.c b/usr.sbin/pkg_install/version/main.c
index 4238497..cad8583 100644
--- a/usr.sbin/pkg_install/version/main.c
+++ b/usr.sbin/pkg_install/version/main.c
@@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "version.h"
char *LimitChars = NULL;
@@ -58,8 +58,6 @@ main(int argc, char **argv)
{
int ch, cmp = 0;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
if (argc == 4 && !strcmp(argv[1], "-t")) {
cmp = version_cmp(argv[2], argv[3]);
printf(cmp > 0 ? ">\n" : (cmp < 0 ? "<\n" : "=\n"));
diff --git a/usr.sbin/pkg_install/version/perform.c b/usr.sbin/pkg_install/version/perform.c
index 79575a3..dc85696 100644
--- a/usr.sbin/pkg_install/version/perform.c
+++ b/usr.sbin/pkg_install/version/perform.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "version.h"
#include <err.h>
#include <fetch.h>
OpenPOWER on IntegriCloud