Merge ^/head r338595 through r338689, and resolve conflicts.

This commit is contained in:
Dimitry Andric 2018-09-14 19:50:36 +00:00
commit c0b5e99154
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang700-import/; revision=338690
98 changed files with 1212 additions and 347 deletions

View File

@ -113,7 +113,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
20180719: 20180719:
New uid:gid added, ntpd:ntpd (123:123). Be sure to run mergemaster New uid:gid added, ntpd:ntpd (123:123). Be sure to run mergemaster
or take steps to update /etc/passwd before doing installworld on or take steps to update /etc/passwd before doing installworld on
existing systems. Also, rc.d/ntpd now starts ntpd(8) as user ntpd existing systems. Do not skip the "mergemaster -Fp" step before
installworld, as described in the update procedures near the bottom
of this document. Also, rc.d/ntpd now starts ntpd(8) as user ntpd
if the new mac_ntpd(4) policy is available, unless ntpd_flags or if the new mac_ntpd(4) policy is available, unless ntpd_flags or
the ntp config file contain options that change file/dir locations. the ntp config file contain options that change file/dir locations.
When such options (e.g., "statsdir" or "crypto") are used, ntpd can When such options (e.g., "statsdir" or "crypto") are used, ntpd can

View File

@ -111,7 +111,7 @@ progress(void)
{ {
static int outlen; static int outlen;
char si[4 + 1 + 2 + 1]; /* 123 <space> <suffix> NUL */ char si[4 + 1 + 2 + 1]; /* 123 <space> <suffix> NUL */
char iec[4 + 1 + 2 + 1]; /* 123 <space> <suffix> NUL */ char iec[4 + 1 + 3 + 1]; /* 123 <space> <suffix> NUL */
char persec[4 + 1 + 2 + 1]; /* 123 <space> <suffix> NUL */ char persec[4 + 1 + 2 + 1]; /* 123 <space> <suffix> NUL */
char *buf; char *buf;
double secs; double secs;
@ -121,11 +121,11 @@ progress(void)
HN_DECIMAL | HN_DIVISOR_1000); HN_DECIMAL | HN_DIVISOR_1000);
humanize_number(iec, sizeof(iec), (int64_t)st.bytes, "B", HN_AUTOSCALE, humanize_number(iec, sizeof(iec), (int64_t)st.bytes, "B", HN_AUTOSCALE,
HN_DECIMAL | HN_IEC_PREFIXES); HN_DECIMAL | HN_IEC_PREFIXES);
humanize_number(persec, sizeof(iec), (int64_t)(st.bytes / secs), "B", humanize_number(persec, sizeof(persec), (int64_t)(st.bytes / secs), "B",
HN_AUTOSCALE, HN_DECIMAL | HN_DIVISOR_1000); HN_AUTOSCALE, HN_DECIMAL | HN_DIVISOR_1000);
asprintf(&buf, " %'ju bytes (%s, %s) transferred %.3fs, %s/s", asprintf(&buf, " %'ju bytes (%s, %s) transferred %.3fs, %s/s",
(uintmax_t)st.bytes, si, iec, secs, persec); (uintmax_t)st.bytes, si, iec, secs, persec);
outlen = fprintf(stderr, "%-*s\r", outlen, buf); outlen = fprintf(stderr, "%-*s\r", outlen, buf) - 1;
fflush(stderr); fflush(stderr);
free(buf); free(buf);
need_progress = 0; need_progress = 0;

View File

@ -1,10 +1,15 @@
# @(#)Makefile 8.1 (Berkeley) 5/31/93 # @(#)Makefile 8.1 (Berkeley) 5/31/93
# $FreeBSD$ # $FreeBSD$
.include <src.opts.mk>
PACKAGE=runtime PACKAGE=runtime
PROG= rm PROG= rm
LINKS= ${BINDIR}/rm ${BINDIR}/unlink LINKS= ${BINDIR}/rm ${BINDIR}/unlink
MLINKS= rm.1 unlink.1 MLINKS= rm.1 unlink.1
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -32,7 +32,7 @@
.\" @(#)rm.1 8.5 (Berkeley) 12/5/94 .\" @(#)rm.1 8.5 (Berkeley) 12/5/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd November 7, 2015 .Dd September 12, 2018
.Dt RM 1 .Dt RM 1
.Os .Os
.Sh NAME .Sh NAME
@ -45,6 +45,7 @@
.Op Fl dIPRrvWx .Op Fl dIPRrvWx
.Ar .Ar
.Nm unlink .Nm unlink
.Op Fl -
.Ar file .Ar file
.Sh DESCRIPTION .Sh DESCRIPTION
The The
@ -154,6 +155,9 @@ No options may be supplied in this simple mode of operation,
which performs an which performs an
.Xr unlink 2 .Xr unlink 2
operation on the passed argument. operation on the passed argument.
However, the usual option-end delimiter,
.Fl - ,
may optionally precede the argument.
.Sh EXIT STATUS .Sh EXIT STATUS
The The
.Nm .Nm
@ -201,11 +205,12 @@ directory hierarchy:
.Pp .Pp
.Dl $ rm -rf foobar .Dl $ rm -rf foobar
.Pp .Pp
Either of these commands will remove the file Any of these commands will remove the file
.Pa -f : .Pa -f :
.Bd -literal -offset indent .Bd -literal -offset indent
$ rm -- -f $ rm -- -f
$ rm ./-f $ rm ./-f
$ unlink -f
.Ed .Ed
.Sh COMPATIBILITY .Sh COMPATIBILITY
The The

View File

@ -101,13 +101,12 @@ main(int argc, char *argv[])
else else
++p; ++p;
if (strcmp(p, "unlink") == 0) { if (strcmp(p, "unlink") == 0) {
while (getopt(argc, argv, "") != -1) if (argc == 2)
rm_file(&argv[1]);
else if (argc == 3 && strcmp(argv[1], "--") == 0)
rm_file(&argv[2]);
else
usage(); usage();
argc -= optind;
argv += optind;
if (argc != 1)
usage();
rm_file(&argv[0]);
exit(eval); exit(eval);
} }
@ -634,7 +633,7 @@ usage(void)
(void)fprintf(stderr, "%s\n%s\n", (void)fprintf(stderr, "%s\n%s\n",
"usage: rm [-f | -i] [-dIPRrvWx] file ...", "usage: rm [-f | -i] [-dIPRrvWx] file ...",
" unlink file"); " unlink [--] file");
exit(EX_USAGE); exit(EX_USAGE);
} }

5
bin/rm/tests/Makefile Normal file
View File

@ -0,0 +1,5 @@
# $FreeBSD$
ATF_TESTS_SH+= rm_test
.include <bsd.test.mk>

View File

@ -0,0 +1,11 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

45
bin/rm/tests/rm_test.sh Executable file
View File

@ -0,0 +1,45 @@
#
# Copyright 2018 Yuri Pankov
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
atf_test_case unlink_dash_filename
unlink_dash_filename_head()
{
atf_set "descr" "unlink correctly handles -filename"
}
unlink_dash_filename_body()
{
touch -- foo bar -foo -bar
atf_check -s exit:0 unlink foo
atf_check -s exit:0 unlink -- bar
atf_check -s exit:0 unlink -foo
atf_check -s exit:0 unlink -- -bar
}
atf_init_test_cases()
{
atf_add_test_case unlink_dash_filename
}

View File

@ -1,3 +1,13 @@
Sep 03, 2018: libarchive 3.3.3 released
Jul 19, 2018: Avoid super-linear slowdown on malformed mtree files
Jan 27, 2018: Many fixes for building with Visual Studio
Oct 19, 2017: NO_OVERWRITE doesn't change existing directory attributes
Aug 12, 2017: New support for Zstandard read and write filters
Jul 09, 2017: libarchive 3.3.2 released Jul 09, 2017: libarchive 3.3.2 released
Mar 16, 2017: NFSv4 ACL support for Linux (librichacl) Mar 16, 2017: NFSv4 ACL support for Linux (librichacl)

View File

@ -99,6 +99,7 @@ The library also detects and handles any of the following before evaluating the
* lzma, lzip, and xz compression * lzma, lzip, and xz compression
* lz4 compression * lz4 compression
* lzop compression * lzop compression
* zstandard compression
The library can create archives in any of the following formats: The library can create archives in any of the following formats:
* POSIX ustar * POSIX ustar
@ -125,6 +126,7 @@ When creating archives, the result can be filtered with any of the following:
* lzma, lzip, and xz compression * lzma, lzip, and xz compression
* lz4 compression * lz4 compression
* lzop compression * lzop compression
* zstandard compression
## Notes about the Library Design ## Notes about the Library Design
@ -159,7 +161,7 @@ questions we are asked about libarchive:
* On read, compression and format are always detected automatically. * On read, compression and format are always detected automatically.
* The same API is used for all formats; in particular, it's very * The same API is used for all formats; it should be very
easy for software using libarchive to transparently handle easy for software using libarchive to transparently handle
any of libarchive's archiving formats. any of libarchive's archiving formats.

View File

@ -144,49 +144,79 @@ DEFINE_TEST(test_basic)
/* File with 10 bytes content. */ /* File with 10 bytes content. */
assertMakeFile("file", 0644, "1234567890"); assertMakeFile("file", 0644, "1234567890");
fprintf(filelist, "file\n"); fprintf(filelist, "file\n");
if (is_LargeInode("file")) if (is_LargeInode("file")) {
strncat(result, strncat(result,
"bsdcpio: file: large inode number truncated: " "bsdcpio: file: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
strncat(result,
strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result,
"\n",
sizeof(result) - strlen(result) -1);
}
/* hardlink to above file. */ /* hardlink to above file. */
assertMakeHardlink("linkfile", "file"); assertMakeHardlink("linkfile", "file");
fprintf(filelist, "linkfile\n"); fprintf(filelist, "linkfile\n");
if (is_LargeInode("linkfile")) if (is_LargeInode("linkfile")) {
strncat(result, strncat(result,
"bsdcpio: linkfile: large inode number truncated: " "bsdcpio: linkfile: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
strncat(result,
strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result,
"\n",
sizeof(result) - strlen(result) -1);
}
/* Symlink to above file. */ /* Symlink to above file. */
if (canSymlink()) { if (canSymlink()) {
assertMakeSymlink("symlink", "file"); assertMakeSymlink("symlink", "file");
fprintf(filelist, "symlink\n"); fprintf(filelist, "symlink\n");
if (is_LargeInode("symlink")) if (is_LargeInode("symlink")) {
strncat(result, strncat(result,
"bsdcpio: symlink: large inode number truncated: " "bsdcpio: symlink: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
strncat(result,
strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result,
"\n",
sizeof(result) - strlen(result) -1);
}
} }
/* Another file with different permissions. */ /* Another file with different permissions. */
assertMakeFile("file2", 0777, "1234567890"); assertMakeFile("file2", 0777, "1234567890");
fprintf(filelist, "file2\n"); fprintf(filelist, "file2\n");
if (is_LargeInode("file2")) if (is_LargeInode("file2")) {
strncat(result, strncat(result,
"bsdcpio: file2: large inode number truncated: " "bsdcpio: file2: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
strncat(result,
strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result,
"\n",
sizeof(result) - strlen(result) -1);
}
/* Directory. */ /* Directory. */
assertMakeDir("dir", 0775); assertMakeDir("dir", 0775);
fprintf(filelist, "dir\n"); fprintf(filelist, "dir\n");
if (is_LargeInode("dir")) if (is_LargeInode("dir")) {
strncat(result, strncat(result,
"bsdcpio: dir: large inode number truncated: " "bsdcpio: dir: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
strncat(result,
strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result,
"\n",
sizeof(result) - strlen(result) -1);
}
strncat(result, "2 blocks\n", sizeof(result) - strlen(result) -1); strncat(result, "2 blocks\n", sizeof(result) - strlen(result) -1);
/* All done. */ /* All done. */

View File

@ -124,26 +124,42 @@ DEFINE_TEST(test_format_newc)
/* Setup result message. */ /* Setup result message. */
memset(result, 0, sizeof(result)); memset(result, 0, sizeof(result));
if (is_LargeInode("file1")) if (is_LargeInode("file1")) {
strncat(result, strncat(result,
"bsdcpio: file1: large inode number truncated: " "bsdcpio: file1: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
if (canSymlink() && is_LargeInode("symlink")) strncat(result, strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result, "\n",
sizeof(result) - strlen(result) -1);
}
if (canSymlink() && is_LargeInode("symlink")) {
strncat(result, strncat(result,
"bsdcpio: symlink: large inode number truncated: " "bsdcpio: symlink: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
if (is_LargeInode("dir")) strncat(result, strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result, "\n",
sizeof(result) - strlen(result) -1);
}
if (is_LargeInode("dir")) {
strncat(result, strncat(result,
"bsdcpio: dir: large inode number truncated: " "bsdcpio: dir: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
if (is_LargeInode("hardlink")) strncat(result, strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result, "\n",
sizeof(result) - strlen(result) -1);
}
if (is_LargeInode("hardlink")) {
strncat(result, strncat(result,
"bsdcpio: hardlink: large inode number truncated: " "bsdcpio: hardlink: large inode number truncated: ",
"Numerical result out of range\n",
sizeof(result) - strlen(result) -1); sizeof(result) - strlen(result) -1);
strncat(result, strerror(ERANGE),
sizeof(result) - strlen(result) -1);
strncat(result, "\n",
sizeof(result) - strlen(result) -1);
}
/* Record some facts about what we just created: */ /* Record some facts about what we just created: */
now = time(NULL); /* They were all created w/in last two seconds. */ now = time(NULL); /* They were all created w/in last two seconds. */

View File

@ -36,7 +36,7 @@
* assert that ARCHIVE_VERSION_NUMBER >= 2012108. * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
*/ */
/* Note: Compiler will complain if this does not match archive_entry.h! */ /* Note: Compiler will complain if this does not match archive_entry.h! */
#define ARCHIVE_VERSION_NUMBER 3003002 #define ARCHIVE_VERSION_NUMBER 3003003
#include <sys/stat.h> #include <sys/stat.h>
#include <stddef.h> /* for wchar_t */ #include <stddef.h> /* for wchar_t */
@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void);
/* /*
* Textual name/version of the library, useful for version displays. * Textual name/version of the library, useful for version displays.
*/ */
#define ARCHIVE_VERSION_ONLY_STRING "3.3.2" #define ARCHIVE_VERSION_ONLY_STRING "3.3.3"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void); __LA_DECL const char * archive_version_string(void);

View File

@ -153,7 +153,7 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
CCCryptorStatus r; CCCryptorStatus r;
r = CCCryptorReset(ref, NULL); r = CCCryptorReset(ref, NULL);
if (r != kCCSuccess) if (r != kCCSuccess && r != kCCUnimplemented)
return -1; return -1;
r = CCCryptorUpdate(ref, ctx->nonce, AES_BLOCK_SIZE, ctx->encr_buf, r = CCCryptorUpdate(ref, ctx->nonce, AES_BLOCK_SIZE, ctx->encr_buf,
AES_BLOCK_SIZE, NULL); AES_BLOCK_SIZE, NULL);

View File

@ -30,7 +30,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED #define ARCHIVE_ENTRY_H_INCLUDED
/* Note: Compiler will complain if this does not match archive.h! */ /* Note: Compiler will complain if this does not match archive.h! */
#define ARCHIVE_VERSION_NUMBER 3003002 #define ARCHIVE_VERSION_NUMBER 3003003
/* /*
* Note: archive_entry.h is for use outside of libarchive; the * Note: archive_entry.h is for use outside of libarchive; the

View File

@ -57,6 +57,9 @@ __RCSID("$NetBSD$");
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#ifdef HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -183,6 +183,7 @@ struct Configuration {
bool ZHazardplt; bool ZHazardplt;
bool ZIfuncnoplt; bool ZIfuncnoplt;
bool ZInitfirst; bool ZInitfirst;
bool ZInterpose;
bool ZKeepTextSectionPrefix; bool ZKeepTextSectionPrefix;
bool ZNodelete; bool ZNodelete;
bool ZNodlopen; bool ZNodlopen;

View File

@ -846,6 +846,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->ZHazardplt = hasZOption(Args, "hazardplt"); Config->ZHazardplt = hasZOption(Args, "hazardplt");
Config->ZIfuncnoplt = hasZOption(Args, "ifunc-noplt"); Config->ZIfuncnoplt = hasZOption(Args, "ifunc-noplt");
Config->ZInitfirst = hasZOption(Args, "initfirst"); Config->ZInitfirst = hasZOption(Args, "initfirst");
Config->ZInterpose = hasZOption(Args, "interpose");
Config->ZKeepTextSectionPrefix = getZFlag( Config->ZKeepTextSectionPrefix = getZFlag(
Args, "keep-text-section-prefix", "nokeep-text-section-prefix", false); Args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
Config->ZNodelete = hasZOption(Args, "nodelete"); Config->ZNodelete = hasZOption(Args, "nodelete");

View File

@ -1266,6 +1266,8 @@ template <class ELFT> void DynamicSection<ELFT>::finalizeContents() {
DtFlags |= DF_SYMBOLIC; DtFlags |= DF_SYMBOLIC;
if (Config->ZInitfirst) if (Config->ZInitfirst)
DtFlags1 |= DF_1_INITFIRST; DtFlags1 |= DF_1_INITFIRST;
if (Config->ZInterpose)
DtFlags1 |= DF_1_INTERPOSE;
if (Config->ZNodelete) if (Config->ZNodelete)
DtFlags1 |= DF_1_NODELETE; DtFlags1 |= DF_1_NODELETE;
if (Config->ZNodlopen) if (Config->ZNodlopen)

View File

@ -3,7 +3,7 @@
.\" .\"
.\" This man page documents only lld's ELF linking support, obtained originally .\" This man page documents only lld's ELF linking support, obtained originally
.\" from FreeBSD. .\" from FreeBSD.
.Dd August 22, 2018 .Dd September 14, 2018
.Dt LD.LLD 1 .Dt LD.LLD 1
.Os .Os
.Sh NAME .Sh NAME
@ -462,6 +462,12 @@ environments.
Sets the Sets the
.Dv DF_1_INITFIRST .Dv DF_1_INITFIRST
flag to indicate the module should be initialized first. flag to indicate the module should be initialized first.
.It Cm interpose
Set the
.Dv DF_1_INTERPOSE
flag to indicate that the object is an interposer.
Runtime linkers perform symbol resolution by first searching the application,
followed by interposers, and then any other dependencies.
.It Cm muldefs .It Cm muldefs
Do not error if a symbol is defined multiple times. Do not error if a symbol is defined multiple times.
The first definition will be used. The first definition will be used.

View File

@ -84,8 +84,7 @@ static const struct ibdiag_opt *opts_map[256];
static const char *get_build_version(void) static const char *get_build_version(void)
{ {
return "BUILD VERSION: " IBDIAG_VERSION " Build date: " __DATE__ " " return "BUILD VERSION: " IBDIAG_VERSION;
__TIME__;
} }
static void pretty_print(int start, int width, const char *str) static void pretty_print(int start, int width, const char *str)

View File

@ -2069,6 +2069,9 @@ main(int argc, char **argv)
#else #else
cansandbox = (cansandbox && ndo->ndo_nflag); cansandbox = (cansandbox && ndo->ndo_nflag);
#endif /* HAVE_CASPER */ #endif /* HAVE_CASPER */
cansandbox = (cansandbox && (pcap_fileno(pd) != -1 ||
RFileName != NULL));
if (cansandbox && cap_enter() < 0 && errno != ENOSYS) if (cansandbox && cap_enter() < 0 && errno != ENOSYS)
error("unable to enter the capability mode"); error("unable to enter the capability mode");
#endif /* HAVE_CAPSICUM */ #endif /* HAVE_CAPSICUM */

View File

@ -121,7 +121,6 @@ distribution:
${_+_}cd ${.CURDIR}/mtree; ${MAKE} install ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
.if ${MK_UNBOUND} != "no" .if ${MK_UNBOUND} != "no"
if [ ! -e ${DESTDIR}/etc/unbound ]; then \ if [ ! -e ${DESTDIR}/etc/unbound ]; then \
${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \ ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \

View File

@ -34,6 +34,8 @@
.. ..
pwait pwait
.. ..
rm
..
rmdir rmdir
.. ..
sh sh

View File

@ -70,6 +70,8 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \
libpathconv \ libpathconv \
libpcap \ libpcap \
libpjdlog \ libpjdlog \
libpmc \
libpmcstat \
${_libproc} \ ${_libproc} \
libprocstat \ libprocstat \
libregex \ libregex \
@ -198,9 +200,6 @@ _libdl= libdl
.endif .endif
SUBDIR.${MK_OPENSSL}+= libmp SUBDIR.${MK_OPENSSL}+= libmp
.if (${COMPILER_TYPE} == "clang" || (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 && ${MACHINE_CPUARCH} != "riscv"))
SUBDIR.${MK_PMC}+= libpmc libpmcstat
.endif
SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_RADIUS_SUPPORT}+= libradius
SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil
SUBDIR.${MK_TELNET}+= libtelnet SUBDIR.${MK_TELNET}+= libtelnet

View File

@ -25,7 +25,7 @@
# $FreeBSD$ # $FreeBSD$
# The modules link in libpam. They build the static modules as well. # The modules link in libpam. They build the static modules as well.
SUBDIR+= libpam modules SUBDIR+= libpam modules pam.d
SUBDIR_DEPEND_modules= libpam SUBDIR_DEPEND_modules= libpam
SUBDIR+= static_libpam SUBDIR+= static_libpam
SUBDIR_DEPEND_static_libpam= modules SUBDIR_DEPEND_static_libpam= modules

View File

@ -4,9 +4,8 @@
NO_OBJ= NO_OBJ=
FILESGROUPS= FILES CONFGROUPS= CONFS
CONFS= README \
FILES= README \
cron \ cron \
imap \ imap \
login \ login \
@ -15,34 +14,28 @@ FILES= README \
sshd su system \ sshd su system \
xdm xdm
FILESDIR= /etc/pam.d CONFDIR= /etc/pam.d
FILESMODE= 644 CONFSMODE_README= 444
.if ${MK_AT} != "no" .if ${MK_AT} != "no"
FILESGROUPS+= AT CONFGROUPS+= AT
AT+= atrun AT+= atrun
ATPACKAGE+= at ATPACKAGE+= at
ATDIR= ${FILESDIR}
ATMODE= ${FILESMODE}
.endif .endif
.if ${MK_FTP} != "no" .if ${MK_FTP} != "no"
FILESGROUPS+= FTP CONFGROUPS+= FTP
FTP+= ftpd FTP+= ftpd
FTPPACKAGE+= ftp FTPPACKAGE+= ftp
FTPDIR= ${FILESDIR}
FTPMODE= ${FILESMODE} afterinstallconfig:
LINKS= ${FILESDIR}/ftpd ${FILESDIR}/ftp ${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}${CONFDIR}/ftpd ${DESTDIR}${CONFDIR}/ftp
.endif .endif
.if ${MK_TELNET} != "no" .if ${MK_TELNET} != "no"
FILESGROUPS+= TELNET CONFGROUPS+= TELNET
TELNET+= telnetd TELNET+= telnetd
TELNETPACKAGE+= telnet TELNETPACKAGE+= telnet
TELNETDIR= ${FILESDIR}
TELNETMODE= ${FILESMODE}
.endif .endif
FILESMODE_README= 444
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -7,7 +7,7 @@ SRCS= libpmc.c pmclog.c libpmc_pmu_util.c libpmc_json.cc
INCS= pmc.h pmclog.h pmcformat.h INCS= pmc.h pmclog.h pmcformat.h
CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}
CWARNFLAGS.gcc+= -Wno-shadow CWARNFLAGS.gcc+= -Wno-shadow -Wno-cast-align
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"

View File

@ -237,6 +237,7 @@ pmu_parse_event(struct pmu_event_desc *ped, const char *eventin)
return (ENOMEM); return (ENOMEM);
r = event; r = event;
bzero(ped, sizeof(*ped)); bzero(ped, sizeof(*ped));
ped->ped_period = DEFAULT_SAMPLE_COUNT;
ped->ped_umask = -1; ped->ped_umask = -1;
while ((kvp = strsep(&event, ",")) != NULL) { while ((kvp = strsep(&event, ",")) != NULL) {
key = strsep(&kvp, "="); key = strsep(&kvp, "=");

View File

@ -114,6 +114,19 @@ libusb_set_nonblocking(int f)
fcntl(f, F_SETFL, flags); fcntl(f, F_SETFL, flags);
} }
static void
libusb10_wakeup_event_loop(libusb_context *ctx)
{
uint8_t dummy = 0;
int err;
err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
if (err < (int)sizeof(dummy)) {
/* ignore error, if any */
DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "Waking up event loop failed!");
}
}
int int
libusb_init(libusb_context **context) libusb_init(libusb_context **context)
{ {
@ -484,7 +497,6 @@ libusb_open(libusb_device *dev, libusb_device_handle **devh)
{ {
libusb_context *ctx = dev->ctx; libusb_context *ctx = dev->ctx;
struct libusb20_device *pdev = dev->os_priv; struct libusb20_device *pdev = dev->os_priv;
uint8_t dummy;
int err; int err;
if (devh == NULL) if (devh == NULL)
@ -506,12 +518,8 @@ libusb_open(libusb_device *dev, libusb_device_handle **devh)
POLLOUT | POLLRDNORM | POLLWRNORM); POLLOUT | POLLRDNORM | POLLWRNORM);
/* make sure our event loop detects the new device */ /* make sure our event loop detects the new device */
dummy = 0; libusb10_wakeup_event_loop(ctx);
err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
if (err < (int)sizeof(dummy)) {
/* ignore error, if any */
DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open write failed!");
}
*devh = pdev; *devh = pdev;
return (0); return (0);
@ -564,8 +572,6 @@ libusb_close(struct libusb20_device *pdev)
{ {
libusb_context *ctx; libusb_context *ctx;
struct libusb_device *dev; struct libusb_device *dev;
uint8_t dummy;
int err;
if (pdev == NULL) if (pdev == NULL)
return; /* be NULL safe */ return; /* be NULL safe */
@ -581,12 +587,7 @@ libusb_close(struct libusb20_device *pdev)
libusb_unref_device(dev); libusb_unref_device(dev);
/* make sure our event loop detects the closed device */ /* make sure our event loop detects the closed device */
dummy = 0; libusb10_wakeup_event_loop(ctx);
err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
if (err < (int)sizeof(dummy)) {
/* ignore error, if any */
DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_close write failed!");
}
} }
libusb_device * libusb_device *
@ -1314,7 +1315,6 @@ libusb10_submit_transfer_sub(struct libusb20_device *pdev, uint8_t endpoint)
int buffsize; int buffsize;
int maxframe; int maxframe;
int temp; int temp;
uint8_t dummy;
dev = libusb_get_device(pdev); dev = libusb_get_device(pdev);
@ -1415,10 +1415,8 @@ libusb10_submit_transfer_sub(struct libusb20_device *pdev, uint8_t endpoint)
failure: failure:
libusb10_complete_transfer(pxfer0, sxfer, LIBUSB_TRANSFER_ERROR); libusb10_complete_transfer(pxfer0, sxfer, LIBUSB_TRANSFER_ERROR);
/* make sure our event loop spins the done handler */ /* make sure our event loop spins the done handler */
dummy = 0; libusb10_wakeup_event_loop(dev->ctx);
err = write(dev->ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
} }
/* The following function must be called unlocked */ /* The following function must be called unlocked */
@ -1459,6 +1457,8 @@ libusb_submit_transfer(struct libusb_transfer *uxfer)
(libusb20_tr_get_priv_sc1(pxfer0) == sxfer) || (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) ||
(libusb20_tr_get_priv_sc1(pxfer1) == sxfer)) { (libusb20_tr_get_priv_sc1(pxfer1) == sxfer)) {
err = LIBUSB_ERROR_BUSY; err = LIBUSB_ERROR_BUSY;
} else if (dev->device_is_gone != 0) {
err = LIBUSB_ERROR_NO_DEVICE;
} else { } else {
/* set pending state */ /* set pending state */
@ -1490,6 +1490,7 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer)
struct libusb20_transfer *pxfer1; struct libusb20_transfer *pxfer1;
struct libusb_super_transfer *sxfer; struct libusb_super_transfer *sxfer;
struct libusb_device *dev; struct libusb_device *dev;
struct libusb_device_handle *devh;
uint8_t endpoint; uint8_t endpoint;
int retval; int retval;
@ -1497,12 +1498,12 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer)
return (LIBUSB_ERROR_INVALID_PARAM); return (LIBUSB_ERROR_INVALID_PARAM);
/* check if not initialised */ /* check if not initialised */
if (uxfer->dev_handle == NULL) if ((devh = uxfer->dev_handle) == NULL)
return (LIBUSB_ERROR_NOT_FOUND); return (LIBUSB_ERROR_NOT_FOUND);
endpoint = uxfer->endpoint; endpoint = uxfer->endpoint;
dev = libusb_get_device(uxfer->dev_handle); dev = libusb_get_device(devh);
DPRINTF(dev->ctx, LIBUSB_DEBUG_FUNCTION, "libusb_cancel_transfer enter"); DPRINTF(dev->ctx, LIBUSB_DEBUG_FUNCTION, "libusb_cancel_transfer enter");
@ -1513,8 +1514,8 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer)
CTX_LOCK(dev->ctx); CTX_LOCK(dev->ctx);
pxfer0 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 0); pxfer0 = libusb10_get_transfer(devh, endpoint, 0);
pxfer1 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 1); pxfer1 = libusb10_get_transfer(devh, endpoint, 1);
if (sxfer->state != LIBUSB_SUPER_XFER_ST_PEND) { if (sxfer->state != LIBUSB_SUPER_XFER_ST_PEND) {
/* only update the transfer status */ /* only update the transfer status */
@ -1526,23 +1527,38 @@ libusb_cancel_transfer(struct libusb_transfer *uxfer)
sxfer->entry.tqe_prev = NULL; sxfer->entry.tqe_prev = NULL;
libusb10_complete_transfer(NULL, libusb10_complete_transfer(NULL,
sxfer, LIBUSB_TRANSFER_CANCELLED); sxfer, LIBUSB_TRANSFER_CANCELLED);
/* make sure our event loop spins the done handler */
libusb10_wakeup_event_loop(dev->ctx);
} else if (pxfer0 == NULL || pxfer1 == NULL) { } else if (pxfer0 == NULL || pxfer1 == NULL) {
/* not started */ /* not started */
retval = LIBUSB_ERROR_NOT_FOUND; retval = LIBUSB_ERROR_NOT_FOUND;
} else if (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) { } else if (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) {
libusb10_complete_transfer(pxfer0, libusb10_complete_transfer(pxfer0,
sxfer, LIBUSB_TRANSFER_CANCELLED); sxfer, LIBUSB_TRANSFER_CANCELLED);
libusb20_tr_stop(pxfer0); if (dev->device_is_gone != 0) {
/* make sure the queue doesn't stall */ /* clear transfer pointer */
libusb10_submit_transfer_sub( libusb20_tr_set_priv_sc1(pxfer0, NULL);
uxfer->dev_handle, endpoint); /* make sure our event loop spins the done handler */
libusb10_wakeup_event_loop(dev->ctx);
} else {
libusb20_tr_stop(pxfer0);
/* make sure the queue doesn't stall */
libusb10_submit_transfer_sub(devh, endpoint);
}
} else if (libusb20_tr_get_priv_sc1(pxfer1) == sxfer) { } else if (libusb20_tr_get_priv_sc1(pxfer1) == sxfer) {
libusb10_complete_transfer(pxfer1, libusb10_complete_transfer(pxfer1,
sxfer, LIBUSB_TRANSFER_CANCELLED); sxfer, LIBUSB_TRANSFER_CANCELLED);
libusb20_tr_stop(pxfer1); /* check if handle is still active */
/* make sure the queue doesn't stall */ if (dev->device_is_gone != 0) {
libusb10_submit_transfer_sub( /* clear transfer pointer */
uxfer->dev_handle, endpoint); libusb20_tr_set_priv_sc1(pxfer1, NULL);
/* make sure our event loop spins the done handler */
libusb10_wakeup_event_loop(dev->ctx);
} else {
libusb20_tr_stop(pxfer1);
/* make sure the queue doesn't stall */
libusb10_submit_transfer_sub(devh, endpoint);
}
} else { } else {
/* not started */ /* not started */
retval = LIBUSB_ERROR_NOT_FOUND; retval = LIBUSB_ERROR_NOT_FOUND;
@ -1571,6 +1587,35 @@ libusb10_cancel_all_transfer(libusb_device *dev)
} }
} }
UNEXPORTED void
libusb10_cancel_all_transfer_locked(struct libusb20_device *pdev, struct libusb_device *dev)
{
struct libusb_super_transfer *sxfer;
unsigned x;
for (x = 0; x != LIBUSB_NUM_SW_ENDPOINTS; x++) {
struct libusb20_transfer *xfer;
xfer = libusb20_tr_get_pointer(pdev, x);
if (xfer == NULL)
continue;
if (libusb20_tr_pending(xfer) == 0)
continue;
sxfer = libusb20_tr_get_priv_sc1(xfer);
if (sxfer == NULL)
continue;
/* complete pending transfer */
libusb10_complete_transfer(xfer, sxfer, LIBUSB_TRANSFER_ERROR);
}
while ((sxfer = TAILQ_FIRST(&dev->tr_head))) {
TAILQ_REMOVE(&dev->tr_head, sxfer, entry);
/* complete pending transfer */
libusb10_complete_transfer(NULL, sxfer, LIBUSB_TRANSFER_ERROR);
}
}
uint16_t uint16_t
libusb_cpu_to_le16(uint16_t x) libusb_cpu_to_le16(uint16_t x)
{ {

View File

@ -41,22 +41,24 @@
#define HOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock) #define HOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock)
#define HOTPLUG_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->hotplug_lock) #define HOTPLUG_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->hotplug_lock)
#define DPRINTF(ctx, dbg, format, args...) do { \ #define DPRINTF(ctx, dbg, format, ...) do { \
if ((ctx)->debug == dbg) { \ switch (dbg) { \
switch (dbg) { \ case LIBUSB_DEBUG_FUNCTION: \
case LIBUSB_DEBUG_FUNCTION: \ if ((ctx)->debug & LIBUSB_DEBUG_FUNCTION) { \
printf("LIBUSB_FUNCTION: " \ printf("LIBUSB_FUNCTION: " \
format "\n", ## args); \ format "\n", ## __VA_ARGS__); \
break; \ } \
case LIBUSB_DEBUG_TRANSFER: \ break; \
printf("LIBUSB_TRANSFER: " \ case LIBUSB_DEBUG_TRANSFER: \
format "\n", ## args); \ if ((ctx)->debug & LIBUSB_DEBUG_TRANSFER) { \
break; \ printf("LIBUSB_TRANSFER: " \
default: \ format "\n", ## __VA_ARGS__); \
break; \ } \
} \ break; \
} \ default: \
} while(0) break; \
} \
} while (0)
/* internal structures */ /* internal structures */
@ -116,6 +118,8 @@ struct libusb_context {
struct libusb_device { struct libusb_device {
int refcnt; int refcnt;
int device_is_gone;
uint32_t claimed_interfaces; uint32_t claimed_interfaces;
struct libusb_super_pollfd dev_poll; struct libusb_super_pollfd dev_poll;
@ -134,5 +138,6 @@ extern struct libusb_context *usbi_default_context;
void libusb10_add_pollfd(libusb_context *ctx, struct libusb_super_pollfd *pollfd, struct libusb20_device *pdev, int fd, short events); void libusb10_add_pollfd(libusb_context *ctx, struct libusb_super_pollfd *pollfd, struct libusb20_device *pdev, int fd, short events);
void libusb10_remove_pollfd(libusb_context *ctx, struct libusb_super_pollfd *pollfd); void libusb10_remove_pollfd(libusb_context *ctx, struct libusb_super_pollfd *pollfd);
void libusb10_cancel_all_transfer(libusb_device *dev); void libusb10_cancel_all_transfer(libusb_device *dev);
void libusb10_cancel_all_transfer_locked(struct libusb20_device *pdev, struct libusb_device *dev);
#endif /* __LIBUSB10_H__ */ #endif /* __LIBUSB10_H__ */

View File

@ -161,17 +161,19 @@ libusb10_handle_events_sub(struct libusb_context *ctx, struct timeval *tv)
if (ppdev[i] != NULL) { if (ppdev[i] != NULL) {
dev = libusb_get_device(ppdev[i]); dev = libusb_get_device(ppdev[i]);
if (fds[i].revents == 0) if (fds[i].revents != 0) {
err = 0; /* nothing to do */
else
err = libusb20_dev_process(ppdev[i]); err = libusb20_dev_process(ppdev[i]);
if (err) { if (err) {
/* cancel all transfers - device is gone */ /* set device is gone */
libusb10_cancel_all_transfer(dev); dev->device_is_gone = 1;
/* remove USB device from polling loop */ /* remove USB device from polling loop */
libusb10_remove_pollfd(dev->ctx, &dev->dev_poll); libusb10_remove_pollfd(dev->ctx, &dev->dev_poll);
/* cancel all pending transfers */
libusb10_cancel_all_transfer_locked(ppdev[i], dev);
}
} }
CTX_UNLOCK(ctx); CTX_UNLOCK(ctx);
libusb_unref_device(dev); libusb_unref_device(dev);
@ -180,10 +182,8 @@ libusb10_handle_events_sub(struct libusb_context *ctx, struct timeval *tv)
} else { } else {
uint8_t dummy; uint8_t dummy;
while (1) { while (read(fds[i].fd, &dummy, 1) == 1)
if (read(fds[i].fd, &dummy, 1) != 1) ;
break;
}
} }
} }
@ -489,13 +489,26 @@ libusb_control_transfer(libusb_device_handle *devh,
return (actlen); return (actlen);
} }
static libusb_context *
libusb10_get_context_by_device_handle(libusb_device_handle *devh)
{
libusb_context *ctx;
if (devh != NULL)
ctx = libusb_get_device(devh)->ctx;
else
ctx = NULL;
return (GET_CONTEXT(ctx));
}
static void static void
libusb10_do_transfer_cb(struct libusb_transfer *transfer) libusb10_do_transfer_cb(struct libusb_transfer *transfer)
{ {
libusb_context *ctx; libusb_context *ctx;
int *pdone; int *pdone;
ctx = GET_CONTEXT(NULL); ctx = libusb10_get_context_by_device_handle(transfer->dev_handle);
DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done"); DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "sync I/O done");
@ -585,7 +598,8 @@ libusb_bulk_transfer(libusb_device_handle *devh,
libusb_context *ctx; libusb_context *ctx;
int ret; int ret;
ctx = GET_CONTEXT(NULL); ctx = libusb10_get_context_by_device_handle(devh);
DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_bulk_transfer enter"); DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_bulk_transfer enter");
ret = libusb10_do_transfer(devh, endpoint, data, length, transferred, ret = libusb10_do_transfer(devh, endpoint, data, length, transferred,
@ -603,7 +617,8 @@ libusb_interrupt_transfer(libusb_device_handle *devh,
libusb_context *ctx; libusb_context *ctx;
int ret; int ret;
ctx = GET_CONTEXT(NULL); ctx = libusb10_get_context_by_device_handle(devh);
DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_interrupt_transfer enter"); DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_interrupt_transfer enter");
ret = libusb10_do_transfer(devh, endpoint, data, length, transferred, ret = libusb10_do_transfer(devh, endpoint, data, length, transferred,

View File

@ -24,7 +24,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd January 5, 2011 .Dd September 14, 2018
.Dt GEOM 8 .Dt GEOM 8
.Os .Os
.Sh NAME .Sh NAME
@ -52,6 +52,11 @@
.Ar class .Ar class
.Cm unload .Cm unload
.Op Fl v .Op Fl v
.Nm
.Fl p
.Ar provider-name
.Nm
.Fl t
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Nm .Nm
@ -103,6 +108,15 @@ This command is only available if the given class is loaded as a
kernel module. kernel module.
.El .El
.Pp .Pp
Additional options include:
.Bl -tag -width ".Cm status"
.It Fl p Ar provider-name
Print detailed information about the geom which provides
.Ar provider-name .
.It Fl t
Display geoms hierarchy as a tree.
.El
.Pp
Class-specific commands are implemented as shared libraries which Class-specific commands are implemented as shared libraries which
are stored in are stored in
.Pa /lib/geom/ .Pa /lib/geom/

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@ -65,9 +66,13 @@ static uint32_t *version = NULL;
static int verbose = 0; static int verbose = 0;
static struct g_command *class_commands = NULL; static struct g_command *class_commands = NULL;
#define GEOM_CLASS_CMDS 0x01 #define GEOM_CLASS_CMDS 0x01
#define GEOM_STD_CMDS 0x02 #define GEOM_STD_CMDS 0x02
#define GEOM_CLASS_WIDTH 10
static struct g_command *find_command(const char *cmdstr, int flags); static struct g_command *find_command(const char *cmdstr, int flags);
static void list_one_geom_by_provider(const char *provider_name);
static int std_available(const char *name); static int std_available(const char *name);
static void std_help(struct gctl_req *req, unsigned flags); static void std_help(struct gctl_req *req, unsigned flags);
@ -146,6 +151,8 @@ usage(void)
if (class_name == NULL) { if (class_name == NULL) {
fprintf(stderr, "usage: geom <class> <command> [options]\n"); fprintf(stderr, "usage: geom <class> <command> [options]\n");
fprintf(stderr, " geom -p <provider-name>\n");
fprintf(stderr, " geom -t\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else { } else {
struct g_command *cmd; struct g_command *cmd;
@ -650,9 +657,186 @@ get_class(int *argc, char ***argv)
usage(); usage();
} }
static struct ggeom *
find_geom_by_provider(struct gmesh *mesh, const char *name)
{
struct gclass *classp;
struct ggeom *gp;
struct gprovider *pp;
LIST_FOREACH(classp, &mesh->lg_class, lg_class) {
LIST_FOREACH(gp, &classp->lg_geom, lg_geom) {
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
if (strcmp(pp->lg_name, name) == 0)
return (gp);
}
}
}
return (NULL);
}
static int
compute_tree_width_geom(struct gmesh *mesh, struct ggeom *gp, int indent)
{
struct gclass *classp2;
struct ggeom *gp2;
struct gconsumer *cp2;
struct gprovider *pp;
int max_width, width;
max_width = width = indent + strlen(gp->lg_name);
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
LIST_FOREACH(classp2, &mesh->lg_class, lg_class) {
LIST_FOREACH(gp2, &classp2->lg_geom, lg_geom) {
LIST_FOREACH(cp2,
&gp2->lg_consumer, lg_consumer) {
if (pp != cp2->lg_provider)
continue;
width = compute_tree_width_geom(mesh,
gp2, indent + 2);
if (width > max_width)
max_width = width;
}
}
}
}
return (max_width);
}
static int
compute_tree_width(struct gmesh *mesh)
{
struct gclass *classp;
struct ggeom *gp;
int max_width, width;
max_width = width = 0;
LIST_FOREACH(classp, &mesh->lg_class, lg_class) {
LIST_FOREACH(gp, &classp->lg_geom, lg_geom) {
if (!LIST_EMPTY(&gp->lg_consumer))
continue;
width = compute_tree_width_geom(mesh, gp, 0);
if (width > max_width)
max_width = width;
}
}
return (max_width);
}
static void
show_tree_geom(struct gmesh *mesh, struct ggeom *gp, int indent, int width)
{
struct gclass *classp2;
struct ggeom *gp2;
struct gconsumer *cp2;
struct gprovider *pp;
if (LIST_EMPTY(&gp->lg_provider)) {
printf("%*s%-*.*s %-*.*s\n", indent, "",
width - indent, width - indent, gp->lg_name,
GEOM_CLASS_WIDTH, GEOM_CLASS_WIDTH, gp->lg_class->lg_name);
return;
}
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
printf("%*s%-*.*s %-*.*s %s\n", indent, "",
width - indent, width - indent, gp->lg_name,
GEOM_CLASS_WIDTH, GEOM_CLASS_WIDTH, gp->lg_class->lg_name,
pp->lg_name);
LIST_FOREACH(classp2, &mesh->lg_class, lg_class) {
LIST_FOREACH(gp2, &classp2->lg_geom, lg_geom) {
LIST_FOREACH(cp2,
&gp2->lg_consumer, lg_consumer) {
if (pp != cp2->lg_provider)
continue;
show_tree_geom(mesh, gp2,
indent + 2, width);
}
}
}
}
}
static void
show_tree(void)
{
struct gmesh mesh;
struct gclass *classp;
struct ggeom *gp;
int error, width;
error = geom_gettree(&mesh);
if (error != 0)
errc(EXIT_FAILURE, error, "Cannot get GEOM tree");
width = compute_tree_width(&mesh);
printf("%-*.*s %-*.*s %s\n",
width, width, "Geom",
GEOM_CLASS_WIDTH, GEOM_CLASS_WIDTH, "Class",
"Provider");
LIST_FOREACH(classp, &mesh.lg_class, lg_class) {
LIST_FOREACH(gp, &classp->lg_geom, lg_geom) {
if (!LIST_EMPTY(&gp->lg_consumer))
continue;
show_tree_geom(&mesh, gp, 0, width);
}
}
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char *provider_name;
bool tflag;
int ch;
provider_name = NULL;
tflag = false;
if (strcmp(getprogname(), "geom") == 0) {
while ((ch = getopt(argc, argv, "hp:t")) != -1) {
switch (ch) {
case 'p':
provider_name = strdup(optarg);
if (provider_name == NULL)
err(1, "strdup");
break;
case 't':
tflag = true;
break;
case 'h':
default:
usage();
}
}
/*
* Don't adjust argc and argv, it would break get_class().
*/
}
if (tflag && provider_name != NULL) {
errx(EXIT_FAILURE,
"At most one of -P and -t may be specified.");
}
if (provider_name != NULL) {
list_one_geom_by_provider(provider_name);
return (0);
}
if (tflag) {
show_tree();
return (0);
}
get_class(&argc, &argv); get_class(&argc, &argv);
run_command(argc, argv); run_command(argc, argv);
@ -767,6 +951,25 @@ list_one_geom(struct ggeom *gp)
printf("\n"); printf("\n");
} }
static void
list_one_geom_by_provider(const char *provider_name)
{
struct gmesh mesh;
struct ggeom *gp;
int error;
error = geom_gettree(&mesh);
if (error != 0)
errc(EXIT_FAILURE, error, "Cannot get GEOM tree");
gp = find_geom_by_provider(&mesh, provider_name);
if (gp == NULL)
errx(EXIT_FAILURE, "Cannot find provider '%s'.", provider_name);
printf("Geom class: %s\n", gp->lg_class->lg_name);
list_one_geom(gp);
}
static void static void
std_help(struct gctl_req *req __unused, unsigned flags __unused) std_help(struct gctl_req *req __unused, unsigned flags __unused)
{ {

View File

@ -73,7 +73,7 @@ main(int argc, char *argv[])
u_int pageins; u_int pageins;
const char *user, *kernel = NULL; const char *user, *kernel = NULL;
if (strcmp(getprogname(), "halt") == 0) { if (strstr(getprogname(), "halt") != NULL) {
dohalt = 1; dohalt = 1;
howto = RB_HALT; howto = RB_HALT;
} else } else

View File

@ -136,10 +136,6 @@ main(int argc, char *argv[])
if ((fflag & MNT_FORCE) != 0 && (fflag & MNT_NONBUSY) != 0) if ((fflag & MNT_FORCE) != 0 && (fflag & MNT_NONBUSY) != 0)
err(1, "-f and -n are mutually exclusive"); err(1, "-f and -n are mutually exclusive");
/* Start disks transferring immediately. */
if ((fflag & (MNT_FORCE | MNT_NONBUSY)) == 0 && nfsforce == 0)
sync();
if ((argc == 0 && !all) || (argc != 0 && all)) if ((argc == 0 && !all) || (argc != 0 && all))
usage(); usage();

View File

@ -24,12 +24,12 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd October 03, 2016 .Dd September 13, 2018
.Dt IG4 4 .Dt IG4 4
.Os .Os
.Sh NAME .Sh NAME
.Nm ig4 .Nm ig4
.Nd Intel(R) fourth generation mobile CPU integrated I2C driver .Nd Synopsys DesignWare I2C Controller
.Sh SYNOPSIS .Sh SYNOPSIS
To compile this driver into the kernel, place the following lines into To compile this driver into the kernel, place the following lines into
the kernel configuration file: the kernel configuration file:
@ -49,9 +49,9 @@ The
driver provides access to peripherals attached to an I2C controller. driver provides access to peripherals attached to an I2C controller.
.Sh HARDWARE .Sh HARDWARE
.Nm .Nm
supports the I2C controllers found in fourth generation Intel(R) Core(TM) supports the I2C controllers based on Synopsys DesignWare IP that can be found
processors based on the mobile U-processor line for intelligent systems. in Intel(R) Core(TM) processors starting from the fourth generation, Intel(R)
This includes the i7-4650U, i5-4300U, i3-4010U, and 2980U. Bay Trail, Apollo Lake SoC families, and some AMD systems.
.Sh SYSCTL VARIABLES .Sh SYSCTL VARIABLES
These These
.Xr sysctl 8 .Xr sysctl 8

View File

@ -1,6 +1,6 @@
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
.\" $FreeBSD$ .\" $FreeBSD$
.Dd August 28, 2018 .Dd September 13, 2018
.Dt SRC.CONF 5 .Dt SRC.CONF 5
.Os .Os
.Sh NAME .Sh NAME
@ -1534,10 +1534,10 @@ by proxy.
.It Va WITHOUT_RBOOTD .It Va WITHOUT_RBOOTD
Set to not build or install Set to not build or install
.Xr rbootd 8 . .Xr rbootd 8 .
.It Va WITH_REPRODUCIBLE_BUILD .It Va WITHOUT_REPRODUCIBLE_BUILD
Set to exclude build metadata (such as the build time, user, or host) Set to include build metadata (such as the build time, user, and host)
from the kernel, boot loaders, and uname output, so that builds produce in the kernel, boot loaders, and uname output.
bit-for-bit identical output. Successive builds will not be bit-for-bit identical.
.It Va WITHOUT_RESCUE .It Va WITHOUT_RESCUE
Set to not build Set to not build
.Xr rescue 8 . .Xr rescue 8 .

View File

@ -159,6 +159,7 @@ __DEFAULT_YES_OPTIONS = \
QUOTAS \ QUOTAS \
RADIUS_SUPPORT \ RADIUS_SUPPORT \
RBOOTD \ RBOOTD \
REPRODUCIBLE_BUILD \
RESCUE \ RESCUE \
ROUTED \ ROUTED \
SENDMAIL \ SENDMAIL \
@ -201,7 +202,6 @@ __DEFAULT_NO_OPTIONS = \
NAND \ NAND \
OFED_EXTRA \ OFED_EXTRA \
OPENLDAP \ OPENLDAP \
REPRODUCIBLE_BUILD \
RPCBIND_WARMSTART_SUPPORT \ RPCBIND_WARMSTART_SUPPORT \
SHARED_TOOLCHAIN \ SHARED_TOOLCHAIN \
SORT_THREADS \ SORT_THREADS \

View File

@ -131,6 +131,7 @@ __FBSDID("$FreeBSD$");
#include <machine/trap.h> #include <machine/trap.h>
#include <machine/tss.h> #include <machine/tss.h>
#include <x86/ucode.h> #include <x86/ucode.h>
#include <x86/ifunc.h>
#ifdef SMP #ifdef SMP
#include <machine/smp.h> #include <machine/smp.h>
#endif #endif
@ -2661,3 +2662,43 @@ outb_(u_short port, u_char data)
} }
#endif /* KDB */ #endif /* KDB */
#undef memset
#undef memmove
#undef memcpy
void *memset_std(void *buf, int c, size_t len);
void *memset_erms(void *buf, int c, size_t len);
DEFINE_IFUNC(, void *, memset, (void *, int, size_t), static)
{
return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ?
memset_erms : memset_std);
}
void *memmove_std(void * _Nonnull dst, const void * _Nonnull src, size_t len);
void *memmove_erms(void * _Nonnull dst, const void * _Nonnull src, size_t len);
DEFINE_IFUNC(, void *, memmove, (void * _Nonnull, const void * _Nonnull, size_t), static)
{
return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ?
memmove_erms : memmove_std);
}
void *memcpy_std(void * _Nonnull dst, const void * _Nonnull src, size_t len);
void *memcpy_erms(void * _Nonnull dst, const void * _Nonnull src, size_t len);
DEFINE_IFUNC(, void *, memcpy, (void * _Nonnull, const void * _Nonnull, size_t), static)
{
return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ?
memcpy_erms : memcpy_std);
}
void pagezero_std(void *addr);
void pagezero_erms(void *addr);
DEFINE_IFUNC(, void , pagezero, (void *), static)
{
return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ?
pagezero_erms : pagezero_std);
}

View File

@ -41,7 +41,7 @@
.text .text
/* Address: %rdi */ /* Address: %rdi */
ENTRY(pagezero) ENTRY(pagezero_std)
PUSH_FRAME_POINTER PUSH_FRAME_POINTER
movq $PAGE_SIZE/8,%rcx movq $PAGE_SIZE/8,%rcx
xorl %eax,%eax xorl %eax,%eax
@ -49,7 +49,17 @@ ENTRY(pagezero)
stosq stosq
POP_FRAME_POINTER POP_FRAME_POINTER
ret ret
END(pagezero) END(pagezero_std)
ENTRY(pagezero_erms)
PUSH_FRAME_POINTER
movq $PAGE_SIZE,%rcx
xorl %eax,%eax
rep
stosb
POP_FRAME_POINTER
ret
END(pagezero_erms)
/* /*
* pagecopy(%rdi=from, %rsi=to) * pagecopy(%rdi=from, %rsi=to)
@ -96,7 +106,7 @@ END(sse2_pagezero)
* Adapted from bcopy written by: * Adapted from bcopy written by:
* ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
*/ */
ENTRY(memmove) ENTRY(memmove_std)
PUSH_FRAME_POINTER PUSH_FRAME_POINTER
movq %rdi,%r9 movq %rdi,%r9
movq %rdx,%rcx movq %rdx,%rcx
@ -142,7 +152,37 @@ ENTRY(memmove)
movq %r9,%rax movq %r9,%rax
POP_FRAME_POINTER POP_FRAME_POINTER
ret ret
END(memmove) END(memmove_std)
ENTRY(memmove_erms)
PUSH_FRAME_POINTER
movq %rdi,%r9
movq %rdx,%rcx
movq %rdi,%rax
subq %rsi,%rax
cmpq %rcx,%rax /* overlapping && src < dst? */
jb 1f
rep
movsb
movq %r9,%rax
POP_FRAME_POINTER
ret
1:
addq %rcx,%rdi /* copy backwards */
addq %rcx,%rsi
decq %rdi
decq %rsi
std
rep
movsb
cld
movq %r9,%rax
POP_FRAME_POINTER
ret
END(memmove_erms)
/* /*
* memcpy(dst, src, len) * memcpy(dst, src, len)
@ -150,7 +190,7 @@ END(memmove)
* *
* Note: memcpy does not support overlapping copies * Note: memcpy does not support overlapping copies
*/ */
ENTRY(memcpy) ENTRY(memcpy_std)
PUSH_FRAME_POINTER PUSH_FRAME_POINTER
movq %rdi,%rax movq %rdi,%rax
movq %rdx,%rcx movq %rdx,%rcx
@ -167,13 +207,23 @@ ENTRY(memcpy)
movsb movsb
POP_FRAME_POINTER POP_FRAME_POINTER
ret ret
END(memcpy) END(memcpy_std)
ENTRY(memcpy_erms)
PUSH_FRAME_POINTER
movq %rdi,%rax
movq %rdx,%rcx
rep
movsb
POP_FRAME_POINTER
ret
END(memcpy_erms)
/* /*
* memset(dst, c, len) * memset(dst, c, len)
* rdi, rsi, rdx * rdi, rsi, rdx
*/ */
ENTRY(memset) ENTRY(memset_std)
PUSH_FRAME_POINTER PUSH_FRAME_POINTER
movq %rdi,%r9 movq %rdi,%r9
movq %rdx,%rcx movq %rdx,%rcx
@ -195,7 +245,19 @@ ENTRY(memset)
movq %r9,%rax movq %r9,%rax
POP_FRAME_POINTER POP_FRAME_POINTER
ret ret
END(memset) END(memset_std)
ENTRY(memset_erms)
PUSH_FRAME_POINTER
movq %rdi,%r9
movq %rdx,%rcx
movb %sil,%al
rep
stosb
movq %r9,%rax
POP_FRAME_POINTER
ret
END(memset_erms)
/* fillw(pat, base, cnt) */ /* fillw(pat, base, cnt) */
/* %rdi,%rsi, %rdx */ /* %rdi,%rsi, %rdx */

View File

@ -25,6 +25,7 @@ makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support
options SCHED_ULE # ULE scheduler options SCHED_ULE # ULE scheduler
options NUMA # Non-Uniform Memory Architecture support
options PREEMPTION # Enable kernel thread preemption options PREEMPTION # Enable kernel thread preemption
options VIMAGE # Subsystem virtualization, e.g. VNET options VIMAGE # Subsystem virtualization, e.g. VNET
options INET # InterNETworking options INET # InterNETworking

View File

@ -39,6 +39,7 @@ makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support
options SCHED_ULE # ULE scheduler options SCHED_ULE # ULE scheduler
options NUMA # Non-Uniform Memory Architecture support
options PREEMPTION # Enable kernel thread preemption options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking options INET # InterNETworking
options INET6 # IPv6 communications protocols options INET6 # IPv6 communications protocols

View File

@ -41,6 +41,8 @@ options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
options KBD_INSTALL_CDEV # install a CDEV entry in /dev options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
options CAPABILITY_MODE # Capsicum capability mode
options CAPABILITIES # Capsicum capabilites
options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8) options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8)
options VFP # Enable floating point hardware support options VFP # Enable floating point hardware support
options MAC # Support for Mandatory Access Control (MAC) options MAC # Support for Mandatory Access Control (MAC)

View File

@ -41,6 +41,8 @@ options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
options KBD_INSTALL_CDEV # install a CDEV entry in /dev options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
options CAPABILITY_MODE # Capsicum capability mode
options CAPABILITIES # Capsicum capabilites
options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8) options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8)
options VFP # Enable floating point hardware support options VFP # Enable floating point hardware support
options MAC # Support for Mandatory Access Control (MAC) options MAC # Support for Mandatory Access Control (MAC)

View File

@ -9,6 +9,7 @@
#NO_UNIVERSE #NO_UNIVERSE
include GENERIC include GENERIC
ident GENERIC-MMCCAM
# Add CAMDEBUG stuff # Add CAMDEBUG stuff
options CAMDEBUG options CAMDEBUG

View File

@ -538,9 +538,14 @@ typedef struct arc_state {
*/ */
int zfs_arc_meta_prune = 10000; int zfs_arc_meta_prune = 10000;
unsigned long zfs_arc_dnode_limit_percent = 10; unsigned long zfs_arc_dnode_limit_percent = 10;
int zfs_arc_meta_strategy = ARC_STRATEGY_META_BALANCED; int zfs_arc_meta_strategy = ARC_STRATEGY_META_ONLY;
int zfs_arc_meta_adjust_restarts = 4096; int zfs_arc_meta_adjust_restarts = 4096;
SYSCTL_INT(_vfs_zfs, OID_AUTO, arc_meta_strategy, CTLFLAG_RWTUN,
&zfs_arc_meta_strategy, 0,
"ARC metadata reclamation strategy "
"(0 = metadata only, 1 = balance data and metadata)");
/* The 6 states: */ /* The 6 states: */
static arc_state_t ARC_anon; static arc_state_t ARC_anon;
static arc_state_t ARC_mru; static arc_state_t ARC_mru;

View File

@ -656,17 +656,24 @@ static __inline void
x86bios_unmap_mem(void) x86bios_unmap_mem(void)
{ {
free(x86bios_map, M_DEVBUF); if (x86bios_map != NULL) {
if (x86bios_ivt != NULL) free(x86bios_map, M_DEVBUF);
x86bios_map = NULL;
}
if (x86bios_ivt != NULL) {
#ifdef X86BIOS_NATIVE_ARCH #ifdef X86BIOS_NATIVE_ARCH
pmap_unmapbios((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE); pmap_unmapbios((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
#else #else
free(x86bios_ivt, M_DEVBUF); free(x86bios_ivt, M_DEVBUF);
x86bios_ivt = NULL;
#endif #endif
}
if (x86bios_rom != NULL) if (x86bios_rom != NULL)
pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE); pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE);
if (x86bios_seg != NULL) if (x86bios_seg != NULL) {
contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF); contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF);
x86bios_seg = NULL;
}
} }
static __inline int static __inline int
@ -674,7 +681,9 @@ x86bios_map_mem(void)
{ {
x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF, x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF,
M_WAITOK | M_ZERO); M_NOWAIT | M_ZERO);
if (x86bios_map == NULL)
goto fail;
#ifdef X86BIOS_NATIVE_ARCH #ifdef X86BIOS_NATIVE_ARCH
x86bios_ivt = pmap_mapbios(X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE); x86bios_ivt = pmap_mapbios(X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE);
@ -688,7 +697,9 @@ x86bios_map_mem(void)
rounddown(x86bios_rom_phys, X86BIOS_PAGE_SIZE); rounddown(x86bios_rom_phys, X86BIOS_PAGE_SIZE);
else else
#else #else
x86bios_ivt = malloc(X86BIOS_IVT_SIZE, M_DEVBUF, M_ZERO | M_WAITOK); x86bios_ivt = malloc(X86BIOS_IVT_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO);
if (x86bios_ivt == NULL)
goto fail;
#endif #endif
x86bios_rom_phys = X86BIOS_ROM_BASE; x86bios_rom_phys = X86BIOS_ROM_BASE;
@ -703,8 +714,10 @@ x86bios_map_mem(void)
goto fail; goto fail;
#endif #endif
x86bios_seg = contigmalloc(X86BIOS_SEG_SIZE, M_DEVBUF, M_WAITOK, x86bios_seg = contigmalloc(X86BIOS_SEG_SIZE, M_DEVBUF, M_NOWAIT,
X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0); X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0);
if (x86bios_seg == NULL)
goto fail;
x86bios_seg_phys = vtophys(x86bios_seg); x86bios_seg_phys = vtophys(x86bios_seg);
x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE, x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE,

View File

@ -33,14 +33,14 @@ arm/allwinner/aw_nmi.c optional aw_nmi fdt \
compile-with "${NORMAL_C} -I$S/gnu/dts/include" compile-with "${NORMAL_C} -I$S/gnu/dts/include"
arm/allwinner/aw_rsb.c optional aw_rsb fdt arm/allwinner/aw_rsb.c optional aw_rsb fdt
arm/allwinner/aw_rtc.c optional aw_rtc fdt arm/allwinner/aw_rtc.c optional aw_rtc fdt
arm/allwinner/aw_sid.c optional aw_sid fdt arm/allwinner/aw_sid.c optional aw_sid nvmem fdt
arm/allwinner/aw_spi.c optional aw_spi fdt arm/allwinner/aw_spi.c optional aw_spi fdt
arm/allwinner/aw_syscon.c optional aw_syscon ext_resources syscon fdt arm/allwinner/aw_syscon.c optional aw_syscon ext_resources syscon fdt
arm/allwinner/aw_thermal.c optional aw_thermal fdt arm/allwinner/aw_thermal.c optional aw_thermal nvmem fdt
arm/allwinner/aw_usbphy.c optional ehci aw_usbphy fdt arm/allwinner/aw_usbphy.c optional ehci aw_usbphy fdt
arm/allwinner/aw_wdog.c optional aw_wdog fdt arm/allwinner/aw_wdog.c optional aw_wdog fdt
arm/allwinner/axp81x.c optional axp81x fdt arm/allwinner/axp81x.c optional axp81x fdt
arm/allwinner/if_awg.c optional awg ext_resources syscon fdt arm/allwinner/if_awg.c optional awg ext_resources syscon aw_sid nvmem fdt
# Allwinner clock driver # Allwinner clock driver
arm/allwinner/clkng/aw_ccung.c optional aw_ccu fdt arm/allwinner/clkng/aw_ccung.c optional aw_ccu fdt

View File

@ -42,6 +42,7 @@ __DEFAULT_YES_OPTIONS = \
MODULE_DRM2 \ MODULE_DRM2 \
NETGRAPH \ NETGRAPH \
PF \ PF \
REPRODUCIBLE_BUILD \
SOURCELESS_HOST \ SOURCELESS_HOST \
SOURCELESS_UCODE \ SOURCELESS_UCODE \
TESTS \ TESTS \
@ -53,8 +54,7 @@ __DEFAULT_NO_OPTIONS = \
KERNEL_RETPOLINE \ KERNEL_RETPOLINE \
NAND \ NAND \
OFED \ OFED \
RATELIMIT \ RATELIMIT
REPRODUCIBLE_BUILD
# Some options are totally broken on some architectures. We disable # Some options are totally broken on some architectures. We disable
# them. If you need to enable them on an experimental basis, you # them. If you need to enable them on an experimental basis, you

View File

@ -382,7 +382,7 @@ config.o env.o hints.o vers.o vnode_if.o:
${NORMAL_CTFCONVERT} ${NORMAL_CTFCONVERT}
.if ${MK_REPRODUCIBLE_BUILD} != "no" .if ${MK_REPRODUCIBLE_BUILD} != "no"
REPRO_FLAG="-r" REPRO_FLAG="-R"
.endif .endif
vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
MAKE="${MAKE}" sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} MAKE="${MAKE}" sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT}

View File

@ -46,7 +46,7 @@
TYPE="FreeBSD" TYPE="FreeBSD"
REVISION="12.0" REVISION="12.0"
BRANCH="ALPHA5" BRANCH="ALPHA6"
if [ -n "${BRANCH_OVERRIDE}" ]; then if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE} BRANCH=${BRANCH_OVERRIDE}
fi fi

View File

@ -362,7 +362,7 @@ update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td)
set_cpu(cpu, td); set_cpu(cpu, td);
critical_enter(); critical_enter();
ret = ucode_intel_load(ptr, true); ret = ucode_intel_load(ptr, true, NULL, NULL);
critical_exit(); critical_exit();
restore_cpu(oldcpu, is_bound, td); restore_cpu(oldcpu, is_bound, td);

View File

@ -2524,8 +2524,10 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
struct c4iw_dev *dev = to_c4iw_dev(cm_id->device); struct c4iw_dev *dev = to_c4iw_dev(cm_id->device);
struct c4iw_ep *ep = NULL; struct c4iw_ep *ep = NULL;
struct ifnet *nh_ifp; /* Logical egress interface */ struct ifnet *nh_ifp; /* Logical egress interface */
#ifdef VIMAGE
struct rdma_cm_id *rdma_id = (struct rdma_cm_id*)cm_id->context; struct rdma_cm_id *rdma_id = (struct rdma_cm_id*)cm_id->context;
struct vnet *vnet = rdma_id->route.addr.dev_addr.net; struct vnet *vnet = rdma_id->route.addr.dev_addr.net;
#endif
CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id); CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id);

View File

@ -3954,7 +3954,7 @@ get_params__post_init(struct adapter *sc)
sc->toecaps = 0; sc->toecaps = 0;
param[0] = FW_PARAM_DEV(NTID); param[0] = FW_PARAM_DEV(NTID);
rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 6, param, val); rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val);
if (rc != 0) { if (rc != 0) {
device_printf(sc->dev, device_printf(sc->dev,
"failed to query HASHFILTER parameters: %d.\n", rc); "failed to query HASHFILTER parameters: %d.\n", rc);

View File

@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sx.h> #include <sys/sx.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/sysent.h> #include <sys/sysent.h>
#include <sys/syslog.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/vnode.h> #include <sys/vnode.h>
@ -3942,9 +3943,16 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
pmc->pm_flags = pa.pm_flags; pmc->pm_flags = pa.pm_flags;
/* XXX set lower bound on sampling for process counters */ /* XXX set lower bound on sampling for process counters */
if (PMC_IS_SAMPLING_MODE(mode)) if (PMC_IS_SAMPLING_MODE(mode)) {
pmc->pm_sc.pm_reloadcount = pa.pm_count; /*
else * Don't permit requested sample rate to be less than 1000
*/
if (pa.pm_count < 1000)
log(LOG_WARNING,
"pmcallocate: passed sample rate %ju - setting to 1000\n",
(uintmax_t)pa.pm_count);
pmc->pm_sc.pm_reloadcount = MAX(1000, pa.pm_count);
} else
pmc->pm_sc.pm_initial = pa.pm_count; pmc->pm_sc.pm_initial = pa.pm_count;
/* switch thread to CPU 'cpu' */ /* switch thread to CPU 'cpu' */
@ -4460,9 +4468,16 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
break; break;
} }
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) {
pm->pm_sc.pm_reloadcount = sc.pm_count; /*
else * Don't permit requested sample rate to be less than 1000
*/
if (sc.pm_count < 1000)
log(LOG_WARNING,
"pmcsetcount: passed sample rate %ju - setting to 1000\n",
(uintmax_t)sc.pm_count);
pm->pm_sc.pm_reloadcount = MAX(1000, sc.pm_count);
} else
pm->pm_sc.pm_initial = sc.pm_count; pm->pm_sc.pm_initial = sc.pm_count;
} }
break; break;

View File

@ -80,6 +80,8 @@ static int ig4iic_pci_detach(device_t dev);
#define PCI_CHIP_SKYLAKE_I2C_3 0x9d638086 #define PCI_CHIP_SKYLAKE_I2C_3 0x9d638086
#define PCI_CHIP_SKYLAKE_I2C_4 0x9d648086 #define PCI_CHIP_SKYLAKE_I2C_4 0x9d648086
#define PCI_CHIP_SKYLAKE_I2C_5 0x9d658086 #define PCI_CHIP_SKYLAKE_I2C_5 0x9d658086
#define PCI_CHIP_KABYLAKE_I2C_0 0xa1608086
#define PCI_CHIP_KABYLAKE_I2C_1 0xa1618086
#define PCI_CHIP_APL_I2C_0 0x5aac8086 #define PCI_CHIP_APL_I2C_0 0x5aac8086
#define PCI_CHIP_APL_I2C_1 0x5aae8086 #define PCI_CHIP_APL_I2C_1 0x5aae8086
#define PCI_CHIP_APL_I2C_2 0x5ab08086 #define PCI_CHIP_APL_I2C_2 0x5ab08086
@ -110,6 +112,8 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = {
{ PCI_CHIP_SKYLAKE_I2C_3, "Intel Sunrise Point-LP I2C Controller-3", IG4_SKYLAKE}, { PCI_CHIP_SKYLAKE_I2C_3, "Intel Sunrise Point-LP I2C Controller-3", IG4_SKYLAKE},
{ PCI_CHIP_SKYLAKE_I2C_4, "Intel Sunrise Point-LP I2C Controller-4", IG4_SKYLAKE}, { PCI_CHIP_SKYLAKE_I2C_4, "Intel Sunrise Point-LP I2C Controller-4", IG4_SKYLAKE},
{ PCI_CHIP_SKYLAKE_I2C_5, "Intel Sunrise Point-LP I2C Controller-5", IG4_SKYLAKE}, { PCI_CHIP_SKYLAKE_I2C_5, "Intel Sunrise Point-LP I2C Controller-5", IG4_SKYLAKE},
{ PCI_CHIP_KABYLAKE_I2C_0, "Intel Sunrise Point-LP I2C Controller-0", IG4_SKYLAKE},
{ PCI_CHIP_KABYLAKE_I2C_1, "Intel Sunrise Point-LP I2C Controller-1", IG4_SKYLAKE},
{ PCI_CHIP_APL_I2C_0, "Intel Apollo Lake I2C Controller-0", IG4_APL}, { PCI_CHIP_APL_I2C_0, "Intel Apollo Lake I2C Controller-0", IG4_APL},
{ PCI_CHIP_APL_I2C_1, "Intel Apollo Lake I2C Controller-1", IG4_APL}, { PCI_CHIP_APL_I2C_1, "Intel Apollo Lake I2C Controller-1", IG4_APL},
{ PCI_CHIP_APL_I2C_2, "Intel Apollo Lake I2C Controller-2", IG4_APL}, { PCI_CHIP_APL_I2C_2, "Intel Apollo Lake I2C Controller-2", IG4_APL},

View File

@ -232,9 +232,21 @@ privcmd_ioctl(struct cdev *dev, unsigned long cmd, caddr_t arg,
struct ioctl_privcmd_hypercall *hcall; struct ioctl_privcmd_hypercall *hcall;
hcall = (struct ioctl_privcmd_hypercall *)arg; hcall = (struct ioctl_privcmd_hypercall *)arg;
#ifdef __amd64__
/*
* The hypervisor page table walker will refuse to access
* user-space pages if SMAP is enabled, so temporary disable it
* while performing the hypercall.
*/
if (cpu_stdext_feature & CPUID_STDEXT_SMAP)
stac();
#endif
error = privcmd_hypercall(hcall->op, hcall->arg[0], error = privcmd_hypercall(hcall->op, hcall->arg[0],
hcall->arg[1], hcall->arg[2], hcall->arg[3], hcall->arg[4]); hcall->arg[1], hcall->arg[2], hcall->arg[3], hcall->arg[4]);
#ifdef __amd64__
if (cpu_stdext_feature & CPUID_STDEXT_SMAP)
clac();
#endif
if (error >= 0) { if (error >= 0) {
hcall->retval = error; hcall->retval = error;
error = 0; error = 0;

View File

@ -839,7 +839,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
break; break;
case PT_INTERP: case PT_INTERP:
/* Path to interpreter */ /* Path to interpreter */
if (phdr[i].p_filesz > MAXPATHLEN) { if (phdr[i].p_filesz < 2 ||
phdr[i].p_filesz > MAXPATHLEN) {
uprintf("Invalid PT_INTERP\n"); uprintf("Invalid PT_INTERP\n");
error = ENOEXEC; error = ENOEXEC;
goto ret; goto ret;
@ -870,6 +871,11 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
} else { } else {
interp = __DECONST(char *, imgp->image_header) + interp = __DECONST(char *, imgp->image_header) +
phdr[i].p_offset; phdr[i].p_offset;
if (interp[interp_name_len - 1] != '\0') {
uprintf("Invalid PT_INTERP\n");
error = ENOEXEC;
goto ret;
}
} }
break; break;
case PT_GNU_STACK: case PT_GNU_STACK:

View File

@ -527,6 +527,8 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset,
struct vn_io_fault_args args; struct vn_io_fault_args args;
int error, lock_flags; int error, lock_flags;
if (offset < 0 && vp->v_type != VCHR)
return (EINVAL);
auio.uio_iov = &aiov; auio.uio_iov = &aiov;
auio.uio_iovcnt = 1; auio.uio_iovcnt = 1;
aiov.iov_base = base; aiov.iov_base = base;

View File

@ -273,7 +273,7 @@ extern struct sx vnet_sxlock;
/* struct _hack is to stop this from being used with static data */ /* struct _hack is to stop this from being used with static data */
#define VNET_DEFINE(t, n) \ #define VNET_DEFINE(t, n) \
struct _hack; t VNET_NAME(n) __section(VNET_SETNAME) __used struct _hack; t VNET_NAME(n) __section(VNET_SETNAME) __used
#if defined(KLD_MODULE) && defined(__aarch64__) #if defined(KLD_MODULE) && (defined(__aarch64__) || defined(__riscv))
/* /*
* As with DPCPU_DEFINE_STATIC we are unable to mark this data as static * As with DPCPU_DEFINE_STATIC we are unable to mark this data as static
* in modules on some architectures. * in modules on some architectures.

View File

@ -5400,14 +5400,6 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so,
} }
if (thflags & TH_RST) if (thflags & TH_RST)
return (rack_process_rst(m, th, so, tp)); return (rack_process_rst(m, th, so, tp));
/*
* RFC5961 Section 4.2 Send challenge ACK for any SYN in
* synchronized state.
*/
if (thflags & TH_SYN) {
rack_challenge_ack(m, th, tp, &ret_val);
return (ret_val);
}
/* /*
* RFC 1323 PAWS: If we have a timestamp reply on this segment and * RFC 1323 PAWS: If we have a timestamp reply on this segment and
* it's less than ts_recent, drop it. * it's less than ts_recent, drop it.
@ -5478,6 +5470,16 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so,
* FIN-WAIT-1 * FIN-WAIT-1
*/ */
tp->t_starttime = ticks; tp->t_starttime = ticks;
if (IS_FASTOPEN(tp->t_flags) && tp->t_tfo_pending) {
tcp_fastopen_decrement_counter(tp->t_tfo_pending);
tp->t_tfo_pending = NULL;
/*
* Account for the ACK of our SYN prior to
* regular ACK processing below.
*/
tp->snd_una++;
}
if (tp->t_flags & TF_NEEDFIN) { if (tp->t_flags & TF_NEEDFIN) {
tcp_state_change(tp, TCPS_FIN_WAIT_1); tcp_state_change(tp, TCPS_FIN_WAIT_1);
tp->t_flags &= ~TF_NEEDFIN; tp->t_flags &= ~TF_NEEDFIN;
@ -5485,16 +5487,6 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so,
tcp_state_change(tp, TCPS_ESTABLISHED); tcp_state_change(tp, TCPS_ESTABLISHED);
TCP_PROBE5(accept__established, NULL, tp, TCP_PROBE5(accept__established, NULL, tp,
mtod(m, const char *), tp, th); mtod(m, const char *), tp, th);
if (IS_FASTOPEN(tp->t_flags) && tp->t_tfo_pending) {
tcp_fastopen_decrement_counter(tp->t_tfo_pending);
tp->t_tfo_pending = NULL;
/*
* Account for the ACK of our SYN prior to regular
* ACK processing below.
*/
tp->snd_una++;
}
/* /*
* TFO connections call cc_conn_init() during SYN * TFO connections call cc_conn_init() during SYN
* processing. Calling it again here for such connections * processing. Calling it again here for such connections
@ -6924,16 +6916,6 @@ rack_output(struct tcpcb *tp)
if (tp->t_flags & TF_TOE) if (tp->t_flags & TF_TOE)
return (tcp_offload_output(tp)); return (tcp_offload_output(tp));
#endif #endif
/*
* For TFO connections in SYN_RECEIVED, only allow the initial
* SYN|ACK and those sent by the retransmit timer.
*/
if (IS_FASTOPEN(tp->t_flags) &&
(tp->t_state == TCPS_SYN_RECEIVED) &&
SEQ_GT(tp->snd_max, tp->snd_una) && /* initial SYN|ACK sent */
(rack->r_ctl.rc_resend == NULL)) /* not a retransmit */
return (0);
#ifdef INET6 #ifdef INET6
if (rack->r_state) { if (rack->r_state) {
/* Use the cache line loaded if possible */ /* Use the cache line loaded if possible */
@ -6975,6 +6957,17 @@ rack_output(struct tcpcb *tp)
} }
rack->r_wanted_output = 0; rack->r_wanted_output = 0;
rack->r_timer_override = 0; rack->r_timer_override = 0;
/*
* For TFO connections in SYN_SENT or SYN_RECEIVED,
* only allow the initial SYN or SYN|ACK and those sent
* by the retransmit timer.
*/
if (IS_FASTOPEN(tp->t_flags) &&
((tp->t_state == TCPS_SYN_RECEIVED) ||
(tp->t_state == TCPS_SYN_SENT)) &&
SEQ_GT(tp->snd_max, tp->snd_una) && /* initial SYN or SYN|ACK sent */
(tp->t_rxtshift == 0)) /* not a retransmit */
return (0);
/* /*
* Determine length of data that should be transmitted, and flags * Determine length of data that should be transmitted, and flags
* that will be used. If there is some data or critical controls * that will be used. If there is some data or critical controls
@ -7353,8 +7346,10 @@ rack_output(struct tcpcb *tp)
(((flags & TH_SYN) && (tp->t_rxtshift > 0)) || (((flags & TH_SYN) && (tp->t_rxtshift > 0)) ||
((tp->t_state == TCPS_SYN_SENT) && ((tp->t_state == TCPS_SYN_SENT) &&
(tp->t_tfo_client_cookie_len == 0)) || (tp->t_tfo_client_cookie_len == 0)) ||
(flags & TH_RST))) (flags & TH_RST))) {
sack_rxmit = 0;
len = 0; len = 0;
}
/* Without fast-open there should never be data sent on a SYN */ /* Without fast-open there should never be data sent on a SYN */
if ((flags & TH_SYN) && (!IS_FASTOPEN(tp->t_flags))) if ((flags & TH_SYN) && (!IS_FASTOPEN(tp->t_flags)))
len = 0; len = 0;

View File

@ -30,7 +30,7 @@ makeoptions WITHOUT_MODULES="usb otusfw mwlfw ispfw mwlfw ralfw rtwnfw"
options SCHED_ULE # ULE scheduler options SCHED_ULE # ULE scheduler
options PREEMPTION # Enable kernel thread preemption options PREEMPTION # Enable kernel thread preemption
# options VIMAGE # Subsystem virtualization, e.g. VNET options VIMAGE # Subsystem virtualization, e.g. VNET
options INET # InterNETworking options INET # InterNETworking
options INET6 # IPv6 communications protocols options INET6 # IPv6 communications protocols
options TCP_HHOOK # hhook(9) framework for TCP options TCP_HHOOK # hhook(9) framework for TCP

View File

@ -330,11 +330,9 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
break; break;
case R_RISCV_RELATIVE: case R_RISCV_RELATIVE:
val = relocbase + addend;
before64 = *where; before64 = *where;
if (*where != val)
*where = val; *where = elf_relocaddr(lf, relocbase + addend);
if (debug_kld) if (debug_kld)
printf("%p %c %-24s %016lx -> %016lx\n", printf("%p %c %-24s %016lx -> %016lx\n",

View File

@ -84,7 +84,7 @@ extern uintptr_t dpcpu_off[];
/* struct _hack is to stop this from being used with the static keyword. */ /* struct _hack is to stop this from being used with the static keyword. */
#define DPCPU_DEFINE(t, n) \ #define DPCPU_DEFINE(t, n) \
struct _hack; t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used struct _hack; t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
#if defined(KLD_MODULE) && defined(__aarch64__) #if defined(KLD_MODULE) && (defined(__aarch64__) || defined(__riscv))
/* /*
* On some architectures the compiler will use PC-relative load to * On some architectures the compiler will use PC-relative load to
* find the address of DPCPU data with the static keyword. We then * find the address of DPCPU data with the static keyword. We then

View File

@ -58,7 +58,8 @@ struct ucode_intel_extsig_table {
} entries[0]; } entries[0];
}; };
int ucode_intel_load(void *data, bool unsafe); int ucode_intel_load(void *data, bool unsafe,
uint64_t *nrevp, uint64_t *orevp);
size_t ucode_load_bsp(uintptr_t free); size_t ucode_load_bsp(uintptr_t free);
void ucode_load_ap(int cpu); void ucode_load_ap(int cpu);
void ucode_reload(void); void ucode_reload(void);

View File

@ -855,7 +855,8 @@ native_lapic_intrcnt(void *dummy __unused)
STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
la = &lapics[pc->pc_apic_id]; la = &lapics[pc->pc_apic_id];
KASSERT(la->la_present, ("missing APIC structure")); if (!la->la_present)
continue;
snprintf(buf, sizeof(buf), "cpu%d:timer", pc->pc_cpuid); snprintf(buf, sizeof(buf), "cpu%d:timer", pc->pc_cpuid);
intrcnt_add(buf, &la->la_timer_count); intrcnt_add(buf, &la->la_timer_count);

View File

@ -331,7 +331,6 @@ msi_init(void)
} }
#endif #endif
MPASS(num_io_irqs > 0);
first_msi_irq = max(MINIMUM_MSI_INT, num_io_irqs); first_msi_irq = max(MINIMUM_MSI_INT, num_io_irqs);
num_io_irqs = first_msi_irq + NUM_MSI_INTS; num_io_irqs = first_msi_irq + NUM_MSI_INTS;

View File

@ -59,7 +59,7 @@ static int ucode_intel_verify(struct ucode_intel_header *hdr,
static struct ucode_ops { static struct ucode_ops {
const char *vendor; const char *vendor;
int (*load)(void *, bool); int (*load)(void *, bool, uint64_t *, uint64_t *);
void *(*match)(uint8_t *, size_t *); void *(*match)(uint8_t *, size_t *);
} loaders[] = { } loaders[] = {
{ {
@ -72,35 +72,46 @@ static struct ucode_ops {
/* Selected microcode update data. */ /* Selected microcode update data. */
static void *early_ucode_data; static void *early_ucode_data;
static void *ucode_data; static void *ucode_data;
static struct ucode_ops *ucode_loader;
static char errbuf[128]; /* Variables used for reporting success or failure. */
enum {
static void __printflike(1, 2) NO_ERROR,
log_err(const char *fmt, ...) NO_MATCH,
{ VERIFICATION_FAILED,
va_list ap; } ucode_error = NO_ERROR;
static uint64_t ucode_nrev, ucode_orev;
va_start(ap, fmt);
vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
va_end(ap);
}
static void static void
print_err(void *arg __unused) log_msg(void *arg __unused)
{ {
if (errbuf[0] != '\0') if (ucode_nrev != 0) {
printf("microcode load error: %s\n", errbuf); printf("CPU microcode: updated from %#jx to %#jx\n",
(uintmax_t)ucode_orev, (uintmax_t)ucode_nrev);
return;
}
switch (ucode_error) {
case NO_MATCH:
printf("CPU microcode: no matching update found\n");
break;
case VERIFICATION_FAILED:
printf("CPU microcode: microcode verification failed\n");
break;
default:
break;
}
} }
SYSINIT(ucode_print_err, SI_SUB_CPU, SI_ORDER_FIRST, print_err, NULL); SYSINIT(ucode_log, SI_SUB_CPU, SI_ORDER_FIRST, log_msg, NULL);
int int
ucode_intel_load(void *data, bool unsafe) ucode_intel_load(void *data, bool unsafe, uint64_t *nrevp, uint64_t *orevp)
{ {
uint64_t rev0, rev1; uint64_t nrev, orev;
uint32_t cpuid[4]; uint32_t cpuid[4];
rev0 = rdmsr(MSR_BIOS_SIGN); orev = rdmsr(MSR_BIOS_SIGN) >> 32;
/* /*
* Perform update. Flush caches first to work around seemingly * Perform update. Flush caches first to work around seemingly
@ -118,8 +129,15 @@ ucode_intel_load(void *data, bool unsafe)
*/ */
do_cpuid(0, cpuid); do_cpuid(0, cpuid);
rev1 = rdmsr(MSR_BIOS_SIGN); /*
if (rev1 <= rev0) * Verify that the microcode revision changed.
*/
nrev = rdmsr(MSR_BIOS_SIGN) >> 32;
if (nrevp != NULL)
*nrevp = nrev;
if (orevp != NULL)
*orevp = orev;
if (nrev <= orev)
return (EEXIST); return (EEXIST);
return (0); return (0);
} }
@ -130,36 +148,26 @@ ucode_intel_verify(struct ucode_intel_header *hdr, size_t resid)
uint32_t cksum, *data, size; uint32_t cksum, *data, size;
int i; int i;
if (resid < sizeof(struct ucode_intel_header)) { if (resid < sizeof(struct ucode_intel_header))
log_err("truncated update header");
return (1); return (1);
}
size = hdr->total_size; size = hdr->total_size;
if (size == 0) if (size == 0)
size = UCODE_INTEL_DEFAULT_DATA_SIZE + size = UCODE_INTEL_DEFAULT_DATA_SIZE +
sizeof(struct ucode_intel_header); sizeof(struct ucode_intel_header);
if (hdr->header_version != 1) { if (hdr->header_version != 1)
log_err("unexpected header version %u", hdr->header_version);
return (1); return (1);
} if (size % 16 != 0)
if (size % 16 != 0) {
log_err("unexpected update size %u", hdr->total_size);
return (1); return (1);
} if (resid < size)
if (resid < size) {
log_err("truncated update");
return (1); return (1);
}
cksum = 0; cksum = 0;
data = (uint32_t *)hdr; data = (uint32_t *)hdr;
for (i = 0; i < size / sizeof(uint32_t); i++) for (i = 0; i < size / sizeof(uint32_t); i++)
cksum += data[i]; cksum += data[i];
if (cksum != 0) { if (cksum != 0)
log_err("checksum failed");
return (1); return (1);
}
return (0); return (0);
} }
@ -182,8 +190,10 @@ ucode_intel_match(uint8_t *data, size_t *len)
for (resid = *len; resid > 0; data += total_size, resid -= total_size) { for (resid = *len; resid > 0; data += total_size, resid -= total_size) {
hdr = (struct ucode_intel_header *)data; hdr = (struct ucode_intel_header *)data;
if (ucode_intel_verify(hdr, resid) != 0) if (ucode_intel_verify(hdr, resid) != 0) {
ucode_error = VERIFICATION_FAILED;
break; break;
}
data_size = hdr->data_size; data_size = hdr->data_size;
total_size = hdr->total_size; total_size = hdr->total_size;
@ -264,7 +274,7 @@ ucode_load_ap(int cpu)
#endif #endif
if (ucode_data != NULL) if (ucode_data != NULL)
(void)ucode_intel_load(ucode_data, false); (void)ucode_loader->load(ucode_data, false, NULL, NULL);
} }
static void * static void *
@ -308,11 +318,12 @@ ucode_load_bsp(uintptr_t free)
uint32_t regs[4]; uint32_t regs[4];
char vendor[13]; char vendor[13];
} cpuid; } cpuid;
struct ucode_ops *loader;
uint8_t *addr, *fileaddr, *match; uint8_t *addr, *fileaddr, *match;
char *type; char *type;
uint64_t nrev, orev;
caddr_t file; caddr_t file;
size_t i, len, ucode_len; size_t i, len;
int error;
KASSERT(free % PAGE_SIZE == 0, ("unaligned boundary %p", (void *)free)); KASSERT(free % PAGE_SIZE == 0, ("unaligned boundary %p", (void *)free));
@ -320,17 +331,16 @@ ucode_load_bsp(uintptr_t free)
cpuid.regs[0] = cpuid.regs[1]; cpuid.regs[0] = cpuid.regs[1];
cpuid.regs[1] = cpuid.regs[3]; cpuid.regs[1] = cpuid.regs[3];
cpuid.vendor[12] = '\0'; cpuid.vendor[12] = '\0';
for (i = 0, loader = NULL; i < nitems(loaders); i++) for (i = 0; i < nitems(loaders); i++)
if (strcmp(cpuid.vendor, loaders[i].vendor) == 0) { if (strcmp(cpuid.vendor, loaders[i].vendor) == 0) {
loader = &loaders[i]; ucode_loader = &loaders[i];
break; break;
} }
if (loader == NULL) if (ucode_loader == NULL)
return (0); return (0);
file = 0; file = 0;
fileaddr = match = NULL; fileaddr = match = NULL;
ucode_len = 0;
for (;;) { for (;;) {
file = preload_search_next_name(file); file = preload_search_next_name(file);
if (file == 0) if (file == 0)
@ -341,7 +351,7 @@ ucode_load_bsp(uintptr_t free)
fileaddr = preload_fetch_addr(file); fileaddr = preload_fetch_addr(file);
len = preload_fetch_size(file); len = preload_fetch_size(file);
match = loader->match(fileaddr, &len); match = ucode_loader->match(fileaddr, &len);
if (match != NULL) { if (match != NULL) {
addr = map_ucode(free, len); addr = map_ucode(free, len);
/* We can't use memcpy() before ifunc resolution. */ /* We can't use memcpy() before ifunc resolution. */
@ -349,18 +359,19 @@ ucode_load_bsp(uintptr_t free)
addr[i] = ((volatile uint8_t *)match)[i]; addr[i] = ((volatile uint8_t *)match)[i];
match = addr; match = addr;
if (loader->load(match, false) == 0) { error = ucode_loader->load(match, false, &nrev, &orev);
ucode_data = match; if (error == 0) {
ucode_len = len; ucode_data = early_ucode_data = match;
early_ucode_data = ucode_data; ucode_nrev = nrev;
break; ucode_orev = orev;
return (len);
} }
unmap_ucode(free, len); unmap_ucode(free, len);
} }
} }
if (fileaddr != NULL && ucode_data == NULL) if (fileaddr != NULL && ucode_error == NO_ERROR)
log_err("no matching update found"); ucode_error = NO_MATCH;
return (ucode_len); return (0);
} }
/* /*

View File

@ -163,6 +163,12 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
{ {
uint32_t regs[4]; uint32_t regs[4];
/* Legacy PVH will get here without the cpuid leaf being set. */
if (cpuid_base == 0)
cpuid_base = xen_hvm_cpuid_base();
if (cpuid_base == 0)
return (ENXIO);
if (xen_domain() && init_type == XEN_HVM_INIT_LATE) { if (xen_domain() && init_type == XEN_HVM_INIT_LATE) {
/* /*
* If the domain type is already set we can assume that the * If the domain type is already set we can assume that the
@ -173,10 +179,6 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
return 0; return 0;
} }
cpuid_base = xen_hvm_cpuid_base();
if (cpuid_base == 0)
return (ENXIO);
if (init_type == XEN_HVM_INIT_LATE) if (init_type == XEN_HVM_INIT_LATE)
hypervisor_version(); hypervisor_version();
@ -419,6 +421,9 @@ xen_hvm_cpu_init(void)
*/ */
KASSERT(cpuid_base != 0, ("Invalid base Xen CPUID leaf")); KASSERT(cpuid_base != 0, ("Invalid base Xen CPUID leaf"));
cpuid_count(cpuid_base + 4, 0, regs); cpuid_count(cpuid_base + 4, 0, regs);
KASSERT((regs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) ||
!xen_pv_domain(),
("Xen PV domain without vcpu_id in cpuid"));
PCPU_SET(vcpu_id, (regs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) ? PCPU_SET(vcpu_id, (regs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) ?
regs[1] : PCPU_GET(acpi_id)); regs[1] : PCPU_GET(acpi_id));

View File

@ -204,6 +204,7 @@ hammer_time_xen_legacy(start_info_t *si, uint64_t xenstack)
uint64_t *PT3 = (u_int64_t *)(xenstack + PAGE_SIZE); uint64_t *PT3 = (u_int64_t *)(xenstack + PAGE_SIZE);
uint64_t *PT2 = (u_int64_t *)(xenstack + 2 * PAGE_SIZE); uint64_t *PT2 = (u_int64_t *)(xenstack + 2 * PAGE_SIZE);
int i; int i;
char *kenv;
xen_domain_type = XEN_PV_DOMAIN; xen_domain_type = XEN_PV_DOMAIN;
vm_guest = VM_GUEST_XEN; vm_guest = VM_GUEST_XEN;
@ -252,6 +253,15 @@ hammer_time_xen_legacy(start_info_t *si, uint64_t xenstack)
} }
load_cr3(((uint64_t)&PT4[0]) - KERNBASE); load_cr3(((uint64_t)&PT4[0]) - KERNBASE);
/*
* Init an empty static kenv using a free page. The contents will be
* filled from the parse_preload_data hook.
*/
kenv = (void *)(physfree + KERNBASE);
physfree += PAGE_SIZE;
bzero(kenv, PAGE_SIZE);
init_static_kenv(kenv, PAGE_SIZE);
/* Set the hooks for early functions that diverge from bare metal */ /* Set the hooks for early functions that diverge from bare metal */
init_ops = xen_legacy_init_ops; init_ops = xen_legacy_init_ops;
apic_ops = xen_apic_ops; apic_ops = xen_apic_ops;

View File

@ -193,54 +193,67 @@ xenpv_setup_io(void)
{ {
if (xen_initial_domain()) { if (xen_initial_domain()) {
int i, ret;
/* Map MADT */
madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
madt_length = madt->Header.Length;
/* Try to initialize ACPI so that we can access the FADT. */
i = acpi_Startup();
if (ACPI_FAILURE(i)) {
printf("MADT: ACPI Startup failed with %s\n",
AcpiFormatException(i));
printf("Try disabling either ACPI or apic support.\n");
panic("Using MADT but ACPI doesn't work");
}
/* Run through the table to see if there are any overrides. */
madt_walk_table(madt_parse_ints, NULL);
/* /*
* If there was not an explicit override entry for the SCI, * NB: we could iterate over the MADT IOAPIC entries in order
* force it to use level trigger and active-low polarity. * to figure out the exact number of IOAPIC interrupts, but
* this is legacy code so just keep using the previous
* behaviour and assume a maximum of 256 interrupts.
*/ */
if (!madt_found_sci_override) { num_io_irqs = max(MINIMUM_MSI_INT - 1, num_io_irqs);
printf(
"MADT: Forcing active-low polarity and level trigger for SCI\n");
ret = xen_register_pirq(AcpiGbl_FADT.SciInterrupt,
INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW);
if (ret != 0)
panic("Unable to register SCI IRQ");
}
/* Register legacy ISA IRQs */
for (i = 1; i < 16; i++) {
if (intr_lookup_source(i) != NULL)
continue;
ret = xen_register_pirq(i, INTR_TRIGGER_EDGE,
INTR_POLARITY_LOW);
if (ret != 0 && bootverbose)
printf("Unable to register legacy IRQ#%d: %d\n",
i, ret);
}
acpi_SetDefaultIntrModel(ACPI_INTR_APIC); acpi_SetDefaultIntrModel(ACPI_INTR_APIC);
} }
return (0); return (0);
} }
void
xenpv_register_pirqs(struct pic *pic __unused)
{
unsigned int i;
int ret;
/* Map MADT */
madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
madt_length = madt->Header.Length;
/* Try to initialize ACPI so that we can access the FADT. */
ret = acpi_Startup();
if (ACPI_FAILURE(ret)) {
printf("MADT: ACPI Startup failed with %s\n",
AcpiFormatException(ret));
printf("Try disabling either ACPI or apic support.\n");
panic("Using MADT but ACPI doesn't work");
}
/* Run through the table to see if there are any overrides. */
madt_walk_table(madt_parse_ints, NULL);
/*
* If there was not an explicit override entry for the SCI,
* force it to use level trigger and active-low polarity.
*/
if (!madt_found_sci_override) {
printf(
"MADT: Forcing active-low polarity and level trigger for SCI\n");
ret = xen_register_pirq(AcpiGbl_FADT.SciInterrupt,
INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW);
if (ret != 0)
panic("Unable to register SCI IRQ");
}
/* Register legacy ISA IRQs */
for (i = 1; i < 16; i++) {
if (intr_lookup_source(i) != NULL)
continue;
ret = xen_register_pirq(i, INTR_TRIGGER_EDGE,
INTR_POLARITY_LOW);
if (ret != 0 && bootverbose)
printf("Unable to register legacy IRQ#%u: %d\n", i,
ret);
}
}
static void static void
xenpv_register(void *dummy __unused) xenpv_register(void *dummy __unused)
{ {
@ -249,19 +262,3 @@ xenpv_register(void *dummy __unused)
} }
} }
SYSINIT(xenpv_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, xenpv_register, NULL); SYSINIT(xenpv_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, xenpv_register, NULL);
/*
* Setup per-CPU vCPU IDs
*/
static void
xenpv_set_ids(void *dummy)
{
struct pcpu *pc;
int i;
CPU_FOREACH(i) {
pc = pcpu_find(i);
pc->pc_vcpu_id = i;
}
}
SYSINIT(xenpv_set_ids, SI_SUB_CPU, SI_ORDER_MIDDLE, xenpv_set_ids, NULL);

View File

@ -592,6 +592,6 @@ xen_setup_cpus(void)
apic_ops.ipi_vectored = xen_pv_lapic_ipi_vectored; apic_ops.ipi_vectored = xen_pv_lapic_ipi_vectored;
} }
/* We need to setup IPIs before APs are started */ /* Switch to using PV IPIs as soon as the vcpu_id is set. */
SYSINIT(xen_setup_cpus, SI_SUB_SMP-1, SI_ORDER_FIRST, xen_setup_cpus, NULL); SYSINIT(xen_setup_cpus, SI_SUB_SMP, SI_ORDER_SECOND, xen_setup_cpus, NULL);
#endif /* SMP */ #endif /* SMP */

View File

@ -178,6 +178,9 @@ struct pic xen_intr_pic = {
* physical interrupt sources. * physical interrupt sources.
*/ */
struct pic xen_intr_pirq_pic = { struct pic xen_intr_pirq_pic = {
#ifdef __amd64__
.pic_register_sources = xenpv_register_pirqs,
#endif
.pic_enable_source = xen_intr_pirq_enable_source, .pic_enable_source = xen_intr_pirq_enable_source,
.pic_disable_source = xen_intr_pirq_disable_source, .pic_disable_source = xen_intr_pirq_disable_source,
.pic_eoi_source = xen_intr_pirq_eoi_source, .pic_eoi_source = xen_intr_pirq_eoi_source,
@ -656,7 +659,8 @@ xen_intr_init(void *dummy __unused)
xen_intr_pirq_eoi_map_enabled = true; xen_intr_pirq_eoi_map_enabled = true;
intr_register_pic(&xen_intr_pic); intr_register_pic(&xen_intr_pic);
intr_register_pic(&xen_intr_pirq_pic); if (xen_pv_domain() && xen_initial_domain())
intr_register_pic(&xen_intr_pirq_pic);
if (bootverbose) if (bootverbose)
printf("Xen interrupt system initialized\n"); printf("Xen interrupt system initialized\n");

View File

@ -274,4 +274,14 @@ int xen_intr_add_handler(const char *name, driver_filter_t filter,
int xen_intr_get_evtchn_from_port(evtchn_port_t port, int xen_intr_get_evtchn_from_port(evtchn_port_t port,
xen_intr_handle_t *handlep); xen_intr_handle_t *handlep);
/**
* Register the IO-APIC PIRQs when running in legacy PVH Dom0 mode.
*
* \param pic PIC instance.
*
* NB: this should be removed together with the support for legacy PVH mode.
*/
struct pic;
void xenpv_register_pirqs(struct pic *pic);
#endif /* _XEN_INTR_H_ */ #endif /* _XEN_INTR_H_ */

View File

@ -3,6 +3,8 @@
TESTSDIR= ${TESTSBASE}/sys/netinet TESTSDIR= ${TESTSBASE}/sys/netinet
BINDIR= ${TESTSDIR} BINDIR= ${TESTSDIR}
ATF_TESTS_C= reuseport_lb
ATF_TESTS_SH= fibs_test ATF_TESTS_SH= fibs_test
PROGS= udp_dontroute tcp_user_cookie PROGS= udp_dontroute tcp_user_cookie

View File

@ -0,0 +1,242 @@
/*-
* Copyright (c) 2018 The FreeBSD Foundation
*
* This software was developed by Mark Johnston under sponsorship from
* the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <err.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <atf-c.h>
/*
* Given an array of non-blocking listening sockets configured in a LB group
* for "addr", try connecting to "addr" in a loop and verify that connections
* are roughly balanced across the sockets.
*/
static void
lb_simple_accept_loop(int domain, const struct sockaddr *addr, int sds[],
size_t nsds, int nconns)
{
size_t i;
int *acceptcnt;
int csd, error, excnt, sd;
/*
* We expect each listening socket to accept roughly nconns/nsds
* connections, but allow for some error.
*/
excnt = nconns / nsds / 8;
acceptcnt = calloc(nsds, sizeof(*acceptcnt));
ATF_REQUIRE_MSG(acceptcnt != NULL, "calloc() failed: %s",
strerror(errno));
while (nconns-- > 0) {
sd = socket(domain, SOCK_STREAM, 0);
ATF_REQUIRE_MSG(sd >= 0, "socket() failed: %s",
strerror(errno));
error = connect(sd, addr, addr->sa_len);
ATF_REQUIRE_MSG(error == 0, "connect() failed: %s",
strerror(errno));
/*
* Poll the listening sockets.
*/
do {
for (i = 0; i < nsds; i++) {
csd = accept(sds[i], NULL, NULL);
if (csd < 0) {
ATF_REQUIRE_MSG(errno == EWOULDBLOCK ||
errno == EAGAIN,
"accept() failed: %s",
strerror(errno));
continue;
}
error = close(csd);
ATF_REQUIRE_MSG(error == 0,
"close() failed: %s", strerror(errno));
acceptcnt[i]++;
break;
}
} while (i == nsds);
error = close(sd);
ATF_REQUIRE_MSG(error == 0, "close() failed: %s",
strerror(errno));
}
for (i = 0; i < nsds; i++)
ATF_REQUIRE_MSG(acceptcnt[i] > excnt, "uneven balancing");
}
static int
lb_listen_socket(int domain, int flags)
{
size_t one;
int error, sd;
sd = socket(domain, SOCK_STREAM | flags, 0);
ATF_REQUIRE_MSG(sd >= 0, "socket() failed: %s", strerror(errno));
one = 1;
error = setsockopt(sd, SOL_SOCKET, SO_REUSEPORT_LB, &one, sizeof(one));
ATF_REQUIRE_MSG(error == 0, "setsockopt(SO_REUSEPORT_LB) failed: %s",
strerror(errno));
return (sd);
}
ATF_TC_WITHOUT_HEAD(basic_ipv4);
ATF_TC_BODY(basic_ipv4, tc)
{
struct sockaddr_in addr;
socklen_t slen;
size_t i;
const int nconns = 16384;
int error, sds[16];
uint16_t port;
sds[0] = lb_listen_socket(PF_INET, SOCK_NONBLOCK);
memset(&addr, 0, sizeof(addr));
addr.sin_len = sizeof(addr);
addr.sin_family = AF_INET;
addr.sin_port = htons(0);
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
error = bind(sds[0], (const struct sockaddr *)&addr, sizeof(addr));
ATF_REQUIRE_MSG(error == 0, "bind() failed: %s", strerror(errno));
error = listen(sds[0], 1);
ATF_REQUIRE_MSG(error == 0, "listen() failed: %s", strerror(errno));
slen = sizeof(addr);
error = getsockname(sds[0], (struct sockaddr *)&addr, &slen);
ATF_REQUIRE_MSG(error == 0, "getsockname() failed: %s",
strerror(errno));
ATF_REQUIRE_MSG(slen == sizeof(addr), "sockaddr size changed");
port = addr.sin_port;
memset(&addr, 0, sizeof(addr));
addr.sin_len = sizeof(addr);
addr.sin_family = AF_INET;
addr.sin_port = port;
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
for (i = 1; i < nitems(sds); i++) {
sds[i] = lb_listen_socket(PF_INET, SOCK_NONBLOCK);
error = bind(sds[i], (const struct sockaddr *)&addr,
sizeof(addr));
ATF_REQUIRE_MSG(error == 0, "bind() failed: %s",
strerror(errno));
error = listen(sds[i], 1);
ATF_REQUIRE_MSG(error == 0, "listen() failed: %s",
strerror(errno));
}
lb_simple_accept_loop(PF_INET, (struct sockaddr *)&addr, sds,
nitems(sds), nconns);
for (i = 0; i < nitems(sds); i++) {
error = close(sds[i]);
ATF_REQUIRE_MSG(error == 0, "close() failed: %s",
strerror(errno));
}
}
ATF_TC_WITHOUT_HEAD(basic_ipv6);
ATF_TC_BODY(basic_ipv6, tc)
{
const struct in6_addr loopback6 = IN6ADDR_LOOPBACK_INIT;
struct sockaddr_in6 addr;
socklen_t slen;
size_t i;
const int nconns = 16384;
int error, sds[16];
uint16_t port;
sds[0] = lb_listen_socket(PF_INET6, SOCK_NONBLOCK);
memset(&addr, 0, sizeof(addr));
addr.sin6_len = sizeof(addr);
addr.sin6_family = AF_INET6;
addr.sin6_port = htons(0);
addr.sin6_addr = loopback6;
error = bind(sds[0], (const struct sockaddr *)&addr, sizeof(addr));
ATF_REQUIRE_MSG(error == 0, "bind() failed: %s", strerror(errno));
error = listen(sds[0], 1);
ATF_REQUIRE_MSG(error == 0, "listen() failed: %s", strerror(errno));
slen = sizeof(addr);
error = getsockname(sds[0], (struct sockaddr *)&addr, &slen);
ATF_REQUIRE_MSG(error == 0, "getsockname() failed: %s",
strerror(errno));
ATF_REQUIRE_MSG(slen == sizeof(addr), "sockaddr size changed");
port = addr.sin6_port;
memset(&addr, 0, sizeof(addr));
addr.sin6_len = sizeof(addr);
addr.sin6_family = AF_INET6;
addr.sin6_port = port;
addr.sin6_addr = loopback6;
for (i = 1; i < nitems(sds); i++) {
sds[i] = lb_listen_socket(PF_INET6, SOCK_NONBLOCK);
error = bind(sds[i], (const struct sockaddr *)&addr,
sizeof(addr));
ATF_REQUIRE_MSG(error == 0, "bind() failed: %s",
strerror(errno));
error = listen(sds[i], 1);
ATF_REQUIRE_MSG(error == 0, "listen() failed: %s",
strerror(errno));
}
lb_simple_accept_loop(PF_INET6, (struct sockaddr *)&addr, sds,
nitems(sds), nconns);
for (i = 0; i < nitems(sds); i++) {
error = close(sds[i]);
ATF_REQUIRE_MSG(error == 0, "close() failed: %s",
strerror(errno));
}
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, basic_ipv4);
ATF_TP_ADD_TC(tp, basic_ipv6);
return (atf_no_error());
}

View File

@ -0,0 +1,4 @@
.\" $FreeBSD$
Set to include build metadata (such as the build time, user, and host)
in the kernel, boot loaders, and uname output.
Successive builds will not be bit-for-bit identical.

View File

@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
_LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive _LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive
PROG= bsdcat PROG= bsdcat
BSDCAT_VERSION_STRING= 3.3.2 BSDCAT_VERSION_STRING= 3.3.3
.PATH: ${_LIBARCHIVEDIR}/cat .PATH: ${_LIBARCHIVEDIR}/cat
SRCS= bsdcat.c cmdline.c SRCS= bsdcat.c cmdline.c

View File

@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
_LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive _LIBARCHIVECONFDIR= ${SRCTOP}/lib/libarchive
PROG= bsdcpio PROG= bsdcpio
BSDCPIO_VERSION_STRING= 3.3.2 BSDCPIO_VERSION_STRING= 3.3.3
.PATH: ${_LIBARCHIVEDIR}/cpio .PATH: ${_LIBARCHIVEDIR}/cpio
SRCS= cpio.c cmdline.c SRCS= cpio.c cmdline.c

View File

@ -10,7 +10,7 @@ ELFCOPYDIR= ${ELFTCDIR}/elfcopy
PROG= objcopy PROG= objcopy
objcopy.1: elfcopy.1 objcopy.1: elfcopy.1
sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \ sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \
-e 's/\.Nm elfcopy/.Nm objcopy/' < ${.ALLSRC} > ${.TARGET} -e '/\.Nm elfcopy ,/d' < ${.ALLSRC} > ${.TARGET}
CLEANFILES+= objcopy.1 CLEANFILES+= objcopy.1
SRCS= archive.c ascii.c binary.c main.c pe.c sections.c segments.c symbols.c SRCS= archive.c ascii.c binary.c main.c pe.c sections.c segments.c symbols.c

View File

@ -4,7 +4,7 @@
_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
PROG= bsdtar PROG= bsdtar
BSDTAR_VERSION_STRING= 3.3.2 BSDTAR_VERSION_STRING= 3.3.3
.PATH: ${_LIBARCHIVEDIR}/tar .PATH: ${_LIBARCHIVEDIR}/tar
SRCS= bsdtar.c \ SRCS= bsdtar.c \

View File

@ -59,6 +59,9 @@ SUBDIR= adduser \
nologin \ nologin \
pciconf \ pciconf \
periodic \ periodic \
pmcannotate \
pmccontrol \
pmcstat \
pnfsdscopymr \ pnfsdscopymr \
pnfsdsfile \ pnfsdsfile \
pnfsdskill \ pnfsdskill \
@ -185,11 +188,8 @@ SUBDIR.${MK_OPENSSL}+= keyserv
SUBDIR.${MK_PC_SYSINSTALL}+= pc-sysinstall SUBDIR.${MK_PC_SYSINSTALL}+= pc-sysinstall
SUBDIR.${MK_PF}+= ftp-proxy SUBDIR.${MK_PF}+= ftp-proxy
SUBDIR.${MK_PKGBOOTSTRAP}+= pkg SUBDIR.${MK_PKGBOOTSTRAP}+= pkg
.if (${COMPILER_TYPE} == "clang" || (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 && ${MACHINE_CPUARCH} != "riscv")) .if ${COMPILER_FEATURES:Mc++11}
SUBDIR.${MK_PMC}+= pmc SUBDIR.${MK_PMC}+= pmc
SUBDIR.${MK_PMC}+= pmcannotate
SUBDIR.${MK_PMC}+= pmccontrol
SUBDIR.${MK_PMC}+= pmcstat
.endif .endif
SUBDIR.${MK_PMC}+= pmcstudy SUBDIR.${MK_PMC}+= pmcstudy
SUBDIR.${MK_PORTSNAP}+= portsnap SUBDIR.${MK_PORTSNAP}+= portsnap