From owner-svn-src-projects@freebsd.org Fri Aug 7 18:14:48 2020 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B26A370F8D for ; Fri, 7 Aug 2020 18:14:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BNYRX3RZRz3WC7; Fri, 7 Aug 2020 18:14:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3ADAC1BF3E; Fri, 7 Aug 2020 18:14:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 077IEm58006541; Fri, 7 Aug 2020 18:14:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077IEgsW006508; Fri, 7 Aug 2020 18:14:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008071814.077IEgsW006508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 7 Aug 2020 18:14:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r364035 - in projects/clang1100-import: . cddl/contrib/opensolaris/lib/libctf/common cddl/contrib/opensolaris/tools/ctf/cvt contrib/telnet/telnet lib/lib80211 lib/libc/locale lib/libc/s... X-SVN-Group: projects X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in projects/clang1100-import: . cddl/contrib/opensolaris/lib/libctf/common cddl/contrib/opensolaris/tools/ctf/cvt contrib/telnet/telnet lib/lib80211 lib/libc/locale lib/libc/stdio release/packages sbi... X-SVN-Commit-Revision: 364035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 18:14:48 -0000 Author: dim Date: Fri Aug 7 18:14:41 2020 New Revision: 364035 URL: https://svnweb.freebsd.org/changeset/base/364035 Log: Merge ^/head r363989 through r364034. Added: projects/clang1100-import/usr.sbin/pwd_mkdb/pwd.h - copied unchanged from r364034, head/usr.sbin/pwd_mkdb/pwd.h Modified: projects/clang1100-import/Makefile.inc1 projects/clang1100-import/UPDATING projects/clang1100-import/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c projects/clang1100-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c projects/clang1100-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h projects/clang1100-import/contrib/telnet/telnet/telnet.1 projects/clang1100-import/lib/lib80211/lib80211_regdomain.h projects/clang1100-import/lib/libc/locale/mbsrtowcs.3 projects/clang1100-import/lib/libc/locale/setlocale.3 projects/clang1100-import/lib/libc/stdio/tmpnam.3 projects/clang1100-import/release/packages/generate-ucl.sh projects/clang1100-import/sbin/ifconfig/ifieee80211.c projects/clang1100-import/sbin/iscontrol/Makefile projects/clang1100-import/sbin/mount/mount.c projects/clang1100-import/share/man/man4/net80211.4 projects/clang1100-import/share/man/man9/seqc.9 projects/clang1100-import/stand/defs.mk projects/clang1100-import/sys/cddl/compat/opensolaris/sys/assfail.h projects/clang1100-import/sys/cddl/compat/opensolaris/sys/stat.h projects/clang1100-import/sys/cddl/compat/opensolaris/sys/time.h projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h projects/clang1100-import/sys/compat/linuxkpi/common/include/linux/radix-tree.h projects/clang1100-import/sys/compat/linuxkpi/common/src/linux_radix.c projects/clang1100-import/sys/dev/acpica/acpi_apei.c projects/clang1100-import/sys/dev/e1000/if_em.c projects/clang1100-import/sys/kern/subr_epoch.c projects/clang1100-import/sys/net/iflib.c projects/clang1100-import/sys/net80211/ieee80211_ioctl.c projects/clang1100-import/sys/net80211/ieee80211_ioctl.h projects/clang1100-import/sys/netinet/udp_usrreq.c projects/clang1100-import/sys/netinet6/udp6_usrreq.c projects/clang1100-import/sys/sys/protosw.h projects/clang1100-import/tools/build/Makefile projects/clang1100-import/usr.bin/grep/Makefile projects/clang1100-import/usr.bin/grep/grep.1 projects/clang1100-import/usr.sbin/makefs/msdos/msdosfs_vnops.c projects/clang1100-import/usr.sbin/pwd_mkdb/Makefile projects/clang1100-import/usr.sbin/tzsetup/Makefile Directory Properties: projects/clang1100-import/ (props changed) projects/clang1100-import/cddl/ (props changed) projects/clang1100-import/cddl/contrib/opensolaris/ (props changed) projects/clang1100-import/sys/cddl/contrib/opensolaris/ (props changed) Modified: projects/clang1100-import/Makefile.inc1 ============================================================================== --- projects/clang1100-import/Makefile.inc1 Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/Makefile.inc1 Fri Aug 7 18:14:41 2020 (r364035) @@ -2179,9 +2179,6 @@ _yacc= usr.bin/yacc _gensnmptree= usr.sbin/bsnmpd/gensnmptree .endif -.if ${MK_LOCALES} != "no" -_localedef= usr.bin/localedef -.endif # We need to build tblgen when we're building clang or lld, either as # bootstrap tools, or as the part of the normal build. @@ -2296,13 +2293,12 @@ ${_bt}-links: .PHONY .for _tool in ${_bootstrap_tools_links} ${_bt}-link-${_tool}: .PHONY .MAKE - @if [ ! -e "${WORLDTMP}/legacy/bin/${_tool}" ]; then \ - source_path=`which ${_tool}`; \ - if [ ! -e "$${source_path}" ] ; then \ - echo "Cannot find host tool '${_tool}'"; false; \ - fi; \ - ln -sfnv "$${source_path}" "${WORLDTMP}/legacy/bin/${_tool}"; \ - fi + @rm -f "${WORLDTMP}/legacy/bin/${_tool}"; \ + source_path=`which ${_tool}`; \ + if [ ! -e "$${source_path}" ] ; then \ + echo "Cannot find host tool '${_tool}'"; false; \ + fi; \ + cp -f "$${source_path}" "${WORLDTMP}/legacy/bin/${_tool}" ${_bt}-links: ${_bt}-link-${_tool} .endfor Modified: projects/clang1100-import/UPDATING ============================================================================== --- projects/clang1100-import/UPDATING Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/UPDATING Fri Aug 7 18:14:41 2020 (r364035) @@ -32,6 +32,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: information about prerequisites and upgrading, if you are not already using clang 3.5.0 or higher. +20200807: + Makefile.inc has been updated to work around the issue documented in + 20200729. It was a case where the optimization of using symbolic links + to point to binaries created a situation where we'd run new binaries + with old libraries starting midway through the installworld process. + 20200729: r363679 has redefined some undefined behavior in regcomp(3); notably, extraneous escapes of most ordinary characters will no longer be Modified: projects/clang1100-import/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c ============================================================================== --- projects/clang1100-import/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Fri Aug 7 18:14:41 2020 (r364035) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include +#include #include #include #include Modified: projects/clang1100-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c ============================================================================== --- projects/clang1100-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c Fri Aug 7 18:14:41 2020 (r364035) @@ -665,6 +665,7 @@ wq_init(workqueue_t *wq, int nfiles) for (i = 0; i < nslots; i++) { pthread_mutex_init(&wq->wq_wip[i].wip_lock, NULL); + pthread_cond_init(&wq->wq_wip[i].wip_cv, NULL); wq->wq_wip[i].wip_batchid = wq->wq_next_batchid++; } Modified: projects/clang1100-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h ============================================================================== --- projects/clang1100-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Fri Aug 7 18:14:41 2020 (r364035) @@ -38,6 +38,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -63,6 +64,15 @@ extern "C" { #ifndef MIN #define MIN(a, b) ((a) > (b) ? (b) : (a)) +#endif + +/* Sanity check for cross-build bootstrap tools */ +#if !defined(BYTE_ORDER) +#error "Missing BYTE_ORDER defines" +#elif !defined(_LITTLE_ENDIAN) +#error "Missing _LITTLE_ENDIAN defines" +#elif !defined(_BIG_ENDIAN) +#error "Missing _BIG_ENDIAN defines" #endif #define TRUE 1 Modified: projects/clang1100-import/contrib/telnet/telnet/telnet.1 ============================================================================== --- projects/clang1100-import/contrib/telnet/telnet/telnet.1 Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/contrib/telnet/telnet/telnet.1 Fri Aug 7 18:14:41 2020 (r364035) @@ -28,7 +28,7 @@ .\" @(#)telnet.1 8.6 (Berkeley) 6/1/94 .\" $FreeBSD$ .\" -.Dd September 18, 2006 +.Dd August 7, 2020 .Dt TELNET 1 .Os .Sh NAME @@ -47,6 +47,7 @@ protocol .Op Fl l Ar user .Op Fl n Ar tracefile .Op Fl s Ar src_addr +.Op Fl P Ar policy .Oo .Ar host .Op Ar port @@ -189,6 +190,13 @@ for recording trace information. See the .Ic set tracefile command below. +.It Fl P Ar policy +Use IPsec policy specification string +.Ar policy , +for the connections. +See +.Xr ipsec_set_policy 3 +for details. .It Fl r Specifies a user interface similar to .Xr rlogin 1 . Modified: projects/clang1100-import/lib/lib80211/lib80211_regdomain.h ============================================================================== --- projects/clang1100-import/lib/lib80211/lib80211_regdomain.h Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/lib/lib80211/lib80211_regdomain.h Fri Aug 7 18:14:41 2020 (r364035) @@ -73,10 +73,10 @@ struct regdomain { netband_head bands_11b; /* 11b operation */ netband_head bands_11g; /* 11g operation */ netband_head bands_11a; /* 11a operation */ - netband_head bands_11ng;/* 11ng operation */ - netband_head bands_11na;/* 11na operation */ - netband_head bands_11ac;/* 11ac 5GHz operation */ - netband_head bands_11acg;/* 11ac 2GHz operation */ + netband_head bands_11ng; /* 11ng operation */ + netband_head bands_11na; /* 11na operation */ + netband_head bands_11ac; /* 11ac 5GHz operation */ + netband_head bands_11acg; /* 11ac 2GHz operation */ LIST_ENTRY(regdomain) next; }; Modified: projects/clang1100-import/lib/libc/locale/mbsrtowcs.3 ============================================================================== --- projects/clang1100-import/lib/libc/locale/mbsrtowcs.3 Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/lib/libc/locale/mbsrtowcs.3 Fri Aug 7 18:14:41 2020 (r364035) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd July 21, 2004 +.Dd August 7, 2020 .Dt MBSRTOWCS 3 .Os .Sh NAME @@ -98,15 +98,29 @@ except that conversion stops after reading at most bytes from the buffer pointed to by .Fa src . .Sh RETURN VALUES -The +If successful, and +.Fa dst +is not NULL, the .Fn mbsrtowcs and .Fn mbsnrtowcs functions return the number of wide characters stored in the array pointed to by +.Fa dst . +.Pp +If .Fa dst -if successful, otherwise it returns -.Po Vt size_t Pc Ns \-1 . +was NULL then the functions +.Fn mbsrtowcs +and +.Fn mbsnrtowcs +return the number of wide characters that would have been stored where +.Fa dst +points to an infinitely large array. +.Pp +If either one of the functions is not successful then +.Po Vt size_t Pc Ns \-1 +is returned. .Sh ERRORS The .Fn mbsrtowcs Modified: projects/clang1100-import/lib/libc/locale/setlocale.3 ============================================================================== --- projects/clang1100-import/lib/libc/locale/setlocale.3 Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/lib/libc/locale/setlocale.3 Fri Aug 7 18:14:41 2020 (r364035) @@ -31,7 +31,7 @@ .\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd September 9, 2019 +.Dd August 7, 2020 .Dt SETLOCALE 3 .Os .Sh NAME @@ -98,6 +98,10 @@ as well as values returned by Set a locale for formatting dates and times using the .Fn strftime function. +.It Dv LANG +Sets the generic locale category for native language, local customs +and coded character set in the absence of more specific locale +variables. .El .Pp Only three locales are defined by default, @@ -153,6 +157,25 @@ if the given combination of and .Fa locale makes no sense. +.Sh EXAMPLES +The following code illustrates how a program can initialize the +international environment for one language, while selectively +modifying the program's locale such that regular expressions and +string operations can be applied to text recorded in a different +language: +.Bd -literal + setlocale(LC_ALL, "de"); + setlocale(LC_COLLATE, "fr"); +.Ed +.Pp +When a process is started, its current locale is set to the C or POSIX +locale. +An internationalized program that depends on locale data not defined in +the C or POSIX locale must invoke the setlocale subroutine in the +following manner before using any of the locale-specific information: +.Bd -literal + setlocale(LC_ALL, ""); +.Ed .Sh FILES .Bl -tag -width /usr/share/locale/locale/category -compact .It Pa $PATH_LOCALE/ Ns Em locale/category Modified: projects/clang1100-import/lib/libc/stdio/tmpnam.3 ============================================================================== --- projects/clang1100-import/lib/libc/stdio/tmpnam.3 Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/lib/libc/stdio/tmpnam.3 Fri Aug 7 18:14:41 2020 (r364035) @@ -32,7 +32,7 @@ .\" @(#)tmpnam.3 8.2 (Berkeley) 11/17/93 .\" $FreeBSD$ .\" -.Dd March 18, 2007 +.Dd August 7, 2020 .Dt TMPFILE 3 .Os .Sh NAME @@ -156,6 +156,8 @@ on error. .Bl -tag -width Ds .It Ev TMPDIR .Pf [ Fn tempnam +and +.Fn tmpfile only] If set, the directory in which the temporary file is stored. Modified: projects/clang1100-import/release/packages/generate-ucl.sh ============================================================================== --- projects/clang1100-import/release/packages/generate-ucl.sh Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/release/packages/generate-ucl.sh Fri Aug 7 18:14:41 2020 (r364035) @@ -97,6 +97,8 @@ main() { outname="${outname%%_*}" + pkgdeps="$(echo ${pkgdeps} | tr '_' '-')" + desc="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESC)" comment="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_COMMENT)" Modified: projects/clang1100-import/sbin/ifconfig/ifieee80211.c ============================================================================== --- projects/clang1100-import/sbin/ifconfig/ifieee80211.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sbin/ifconfig/ifieee80211.c Fri Aug 7 18:14:41 2020 (r364035) @@ -4779,6 +4779,23 @@ getid(int s, int ix, void *data, size_t len, int *plen return 0; } +static int +getdevicename(int s, void *data, size_t len, int *plen) +{ + struct ieee80211req ireq; + + (void) memset(&ireq, 0, sizeof(ireq)); + (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name)); + ireq.i_type = IEEE80211_IOC_IC_NAME; + ireq.i_val = -1; + ireq.i_data = data; + ireq.i_len = len; + if (ioctl(s, SIOCG80211, &ireq) < 0) + return (-1); + *plen = ireq.i_len; + return (0); +} + static void ieee80211_status(int s) { @@ -5501,6 +5518,12 @@ end: LINE_CHECK("hwmpmaxhops %u", val); } } + + LINE_BREAK(); + + if (getdevicename(s, data, sizeof(data), &len) < 0) + return; + LINE_CHECK("parent interface: %s", data); LINE_BREAK(); } Modified: projects/clang1100-import/sbin/iscontrol/Makefile ============================================================================== --- projects/clang1100-import/sbin/iscontrol/Makefile Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sbin/iscontrol/Makefile Fri Aug 7 18:14:41 2020 (r364035) @@ -1,6 +1,6 @@ # $FreeBSD$ -PACKAGE=iscsi_legacy +PACKAGE=iscsilegacy SRCS= iscontrol.c pdu.c fsm.c config.c login.c auth_subr.c misc.c PROG= iscontrol LIBADD= cam md Modified: projects/clang1100-import/sbin/mount/mount.c ============================================================================== --- projects/clang1100-import/sbin/mount/mount.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sbin/mount/mount.c Fri Aug 7 18:14:41 2020 (r364035) @@ -697,9 +697,9 @@ prmount(struct statfs *sfp) (uintmax_t)sfp->f_syncreads, (uintmax_t)sfp->f_asyncreads); if (sfp->f_fsid.val[0] != 0 || sfp->f_fsid.val[1] != 0) { - printf(", fsid "); + (void)printf(", fsid "); for (i = 0; i < sizeof(sfp->f_fsid); i++) - printf("%02x", ((u_char *)&sfp->f_fsid)[i]); + (void)printf("%02x", ((u_char *)&sfp->f_fsid)[i]); } } (void)printf(")\n"); Modified: projects/clang1100-import/share/man/man4/net80211.4 ============================================================================== --- projects/clang1100-import/share/man/man4/net80211.4 Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/share/man/man4/net80211.4 Fri Aug 7 18:14:41 2020 (r364035) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2009 +.Dd August 7, 2020 .Dt NET80211 4 .Os .Sh NAME @@ -393,6 +393,16 @@ Valid values are: and .Dv IEEE80211_HWMP_ROOTMODE_RANN (send broadcast Root Announcement (RANN) frames). +.It Dv IEEE80211_IOC_IC_NAME +Return the underlying hardware +.Xr device 9 +name in the buffer pointed to by +.Va i_data +and the name length including terminating NUL character in +.Va i_len . +If the buffer length is too small to hold the full name +.Er EINVAL +will be returned. .It Dv IEEE80211_IOC_INACTIVITY Return whether or not the system handles inactivity processing in .Va i_val . Modified: projects/clang1100-import/share/man/man9/seqc.9 ============================================================================== --- projects/clang1100-import/share/man/man9/seqc.9 Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/share/man/man9/seqc.9 Fri Aug 7 18:14:41 2020 (r364035) @@ -98,6 +98,7 @@ obj->var2 = 2; seqc_write_end(&obj->seqc); unlock_exclusive(&obj->lock); .Ed +.Pp The following example for a reader reads the .Va var1 and Modified: projects/clang1100-import/stand/defs.mk ============================================================================== --- projects/clang1100-import/stand/defs.mk Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/stand/defs.mk Fri Aug 7 18:14:41 2020 (r364035) @@ -237,6 +237,6 @@ ${_ILINKS}: .NOMETA esac ; \ path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET} "->" $$path ; \ - ln -fhs $$path ${.TARGET} + ln -fns $$path ${.TARGET} .endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ Modified: projects/clang1100-import/sys/cddl/compat/opensolaris/sys/assfail.h ============================================================================== --- projects/clang1100-import/sys/cddl/compat/opensolaris/sys/assfail.h Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/cddl/compat/opensolaris/sys/assfail.h Fri Aug 7 18:14:41 2020 (r364035) @@ -48,9 +48,7 @@ void assfail3(const char *, uintmax_t, const char *, u #ifndef HAVE_ASSFAIL extern int aok; -__inline int __assfail(const char *expr, const char *file, int line); - -__inline int +static __inline int __assfail(const char *expr, const char *file, int line) { Modified: projects/clang1100-import/sys/cddl/compat/opensolaris/sys/stat.h ============================================================================== --- projects/clang1100-import/sys/cddl/compat/opensolaris/sys/stat.h Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/cddl/compat/opensolaris/sys/stat.h Fri Aug 7 18:14:41 2020 (r364035) @@ -32,11 +32,19 @@ #include_next +/* + * When bootstrapping on Linux a stat64/fstat64 functions exists in both + * glibc and musl libc. To avoid compilation errors, use those functions instead + * of redefining them to stat/fstat. + * Similarly, macOS provides (deprecated) stat64 functions that we can use + * for now. + */ +#if !defined(__linux__) && !defined(__APPLE__) #define stat64 stat #define MAXOFFSET_T OFF_MAX -#ifndef _KERNEL +#if !defined(_KERNEL) #include static __inline int @@ -51,6 +59,7 @@ fstat64(int fd, struct stat *sb) } return (ret); } -#endif +#endif /* !defined(_KERNEL) */ +#endif /* !defined(__linux__) && !defined(__APPLE__) */ #endif /* !_COMPAT_OPENSOLARIS_SYS_STAT_H_ */ Modified: projects/clang1100-import/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- projects/clang1100-import/sys/cddl/compat/opensolaris/sys/time.h Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/cddl/compat/opensolaris/sys/time.h Fri Aug 7 18:14:41 2020 (r364035) @@ -29,6 +29,7 @@ #ifndef _OPENSOLARIS_SYS_TIME_H_ #define _OPENSOLARIS_SYS_TIME_H_ +#include #include_next #define SEC 1 Modified: projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Aug 7 18:14:41 2020 (r364035) @@ -175,13 +175,6 @@ static int __dbuf_hold_impl(struct dbuf_hold_impl_data static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx); static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx); -#ifndef __lint -extern inline void dmu_buf_init_user(dmu_buf_user_t *dbu, - dmu_buf_evict_func_t *evict_func_sync, - dmu_buf_evict_func_t *evict_func_async, - dmu_buf_t **clear_on_evict_dbufp); -#endif /* ! __lint */ - /* * Global data structures and functions for the dbuf cache. */ Modified: projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Aug 7 18:14:41 2020 (r364035) @@ -610,7 +610,7 @@ typedef struct dmu_buf_user { * To allow enforcement of this, dbu must already be zeroed on entry. */ /*ARGSUSED*/ -inline void +static inline void dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_sync, dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp) { Modified: projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h ============================================================================== --- projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Fri Aug 7 18:14:41 2020 (r364035) @@ -46,8 +46,12 @@ extern "C" { /* * Disk blocks (sectors) and bytes. */ +#ifndef dtob #define dtob(DD) ((DD) << DEV_BSHIFT) +#endif +#ifndef btod #define btod(BB) (((BB) + DEV_BSIZE - 1) >> DEV_BSHIFT) +#endif #define btodt(BB) ((BB) >> DEV_BSHIFT) #define lbtod(BB) (((offset_t)(BB) + DEV_BSIZE - 1) >> DEV_BSHIFT) @@ -220,9 +224,12 @@ extern unsigned char bcd_to_byte[256]; /* * Macros for counting and rounding. */ +#ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) +#endif +#ifndef roundup #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) - +#endif /* * Macro to determine if value is a power of 2 */ Modified: projects/clang1100-import/sys/compat/linuxkpi/common/include/linux/radix-tree.h ============================================================================== --- projects/clang1100-import/sys/compat/linuxkpi/common/include/linux/radix-tree.h Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/compat/linuxkpi/common/include/linux/radix-tree.h Fri Aug 7 18:14:41 2020 (r364035) @@ -78,6 +78,7 @@ radix_tree_exception(void *arg) void *radix_tree_lookup(struct radix_tree_root *, unsigned long); void *radix_tree_delete(struct radix_tree_root *, unsigned long); int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); +int radix_tree_store(struct radix_tree_root *, unsigned long, void **); bool radix_tree_iter_find(struct radix_tree_root *, struct radix_tree_iter *, void ***); void radix_tree_iter_delete(struct radix_tree_root *, struct radix_tree_iter *, void **); Modified: projects/clang1100-import/sys/compat/linuxkpi/common/src/linux_radix.c ============================================================================== --- projects/clang1100-import/sys/compat/linuxkpi/common/src/linux_radix.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/compat/linuxkpi/common/src/linux_radix.c Fri Aug 7 18:14:41 2020 (r364035) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2020 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,17 @@ radix_pos(long id, int height) return (id >> (RADIX_TREE_MAP_SHIFT * height)) & RADIX_TREE_MAP_MASK; } +static void +radix_tree_clean_root_node(struct radix_tree_root *root) +{ + /* Check if the root node should be freed */ + if (root->rnode->count == 0) { + free(root->rnode, M_RADIX); + root->rnode = NULL; + root->height = 0; + } +} + void * radix_tree_lookup(struct radix_tree_root *root, unsigned long index) { @@ -197,8 +208,10 @@ radix_tree_insert(struct radix_tree_root *root, unsign while (radix_max(root) < index) { /* check if the radix tree is getting too big */ - if (root->height == RADIX_TREE_MAX_HEIGHT) + if (root->height == RADIX_TREE_MAX_HEIGHT) { + radix_tree_clean_root_node(root); return (-E2BIG); + } /* * If the root radix level is not empty, we need to @@ -206,8 +219,16 @@ radix_tree_insert(struct radix_tree_root *root, unsign */ if (node->count != 0) { node = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO); - if (node == NULL) + if (node == NULL) { + /* + * Freeing the already allocated radix + * levels, if any, will be handled by + * the radix_tree_delete() function. + * This code path can only happen when + * the tree is not empty. + */ return (-ENOMEM); + } node->slots[0] = root->rnode; node->count++; root->rnode = node; @@ -231,14 +252,9 @@ radix_tree_insert(struct radix_tree_root *root, unsign temp[idx] = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO); if (temp[idx] == NULL) { - while(idx--) + while (idx--) free(temp[idx], M_RADIX); - /* Check if we should free the root node as well. */ - if (root->rnode->count == 0) { - free(root->rnode, M_RADIX); - root->rnode = NULL; - root->height = 0; - } + radix_tree_clean_root_node(root); return (-ENOMEM); } } @@ -260,5 +276,112 @@ radix_tree_insert(struct radix_tree_root *root, unsign node->slots[idx] = item; node->count++; + return (0); +} + +int +radix_tree_store(struct radix_tree_root *root, unsigned long index, void **ppitem) +{ + struct radix_tree_node *node; + struct radix_tree_node *temp[RADIX_TREE_MAX_HEIGHT - 1]; + void *pitem; + int height; + int idx; + + /* + * Inserting a NULL item means delete it. The old pointer is + * stored at the location pointed to by "ppitem". + */ + if (*ppitem == NULL) { + *ppitem = radix_tree_delete(root, index); + return (0); + } + + /* get root node, if any */ + node = root->rnode; + + /* allocate root node, if any */ + if (node == NULL) { + node = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO); + if (node == NULL) + return (-ENOMEM); + root->rnode = node; + root->height++; + } + + /* expand radix tree as needed */ + while (radix_max(root) < index) { + + /* check if the radix tree is getting too big */ + if (root->height == RADIX_TREE_MAX_HEIGHT) { + radix_tree_clean_root_node(root); + return (-E2BIG); + } + + /* + * If the root radix level is not empty, we need to + * allocate a new radix level: + */ + if (node->count != 0) { + node = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO); + if (node == NULL) { + /* + * Freeing the already allocated radix + * levels, if any, will be handled by + * the radix_tree_delete() function. + * This code path can only happen when + * the tree is not empty. + */ + return (-ENOMEM); + } + node->slots[0] = root->rnode; + node->count++; + root->rnode = node; + } + root->height++; + } + + /* get radix tree height index */ + height = root->height - 1; + + /* walk down the tree until the first missing node, if any */ + for ( ; height != 0; height--) { + idx = radix_pos(index, height); + if (node->slots[idx] == NULL) + break; + node = node->slots[idx]; + } + + /* allocate the missing radix levels, if any */ + for (idx = 0; idx != height; idx++) { + temp[idx] = malloc(sizeof(*node), M_RADIX, + root->gfp_mask | M_ZERO); + if (temp[idx] == NULL) { + while (idx--) + free(temp[idx], M_RADIX); + radix_tree_clean_root_node(root); + return (-ENOMEM); + } + } + + /* setup new radix levels, if any */ + for ( ; height != 0; height--) { + idx = radix_pos(index, height); + node->slots[idx] = temp[height - 1]; + node->count++; + node = node->slots[idx]; + } + + /* + * Insert and adjust count if the item does not already exist. + */ + idx = radix_pos(index, 0); + /* swap */ + pitem = node->slots[idx]; + node->slots[idx] = *ppitem; + *ppitem = pitem; + + if (pitem == NULL) + node->count++; return (0); } Modified: projects/clang1100-import/sys/dev/acpica/acpi_apei.c ============================================================================== --- projects/clang1100-import/sys/dev/acpica/acpi_apei.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/dev/acpica/acpi_apei.c Fri Aug 7 18:14:41 2020 (r364035) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_pci.h" #include #include @@ -207,8 +208,10 @@ static int apei_pcie_handler(ACPI_HEST_GENERIC_DATA *ged) { struct apei_pcie_error *p = (struct apei_pcie_error *)(ged + 1); + int h = 0, off; +#ifdef DEV_PCI device_t dev; - int h = 0, off, sev; + int sev; if ((p->ValidationBits & 0x8) == 0x8) { mtx_lock(&Giant); @@ -235,6 +238,7 @@ apei_pcie_handler(ACPI_HEST_GENERIC_DATA *ged) } if (h) return (h); +#endif printf("APEI %s PCIe Error:\n", apei_severity(ged->ErrorSeverity)); if (p->ValidationBits & 0x01) Modified: projects/clang1100-import/sys/dev/e1000/if_em.c ============================================================================== --- projects/clang1100-import/sys/dev/e1000/if_em.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/dev/e1000/if_em.c Fri Aug 7 18:14:41 2020 (r364035) @@ -1334,6 +1334,11 @@ em_if_init(if_ctx_t ctx) ctrl |= E1000_CTRL_VME; E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); } + } else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl &= ~E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); } /* Don't lose promiscuous settings */ Modified: projects/clang1100-import/sys/kern/subr_epoch.c ============================================================================== --- projects/clang1100-import/sys/kern/subr_epoch.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/kern/subr_epoch.c Fri Aug 7 18:14:41 2020 (r364035) @@ -58,8 +58,6 @@ __FBSDID("$FreeBSD$"); #include -static MALLOC_DEFINE(M_EPOCH, "epoch", "epoch based reclamation"); - #ifdef __amd64__ #define EPOCH_ALIGN CACHE_LINE_SIZE*2 #else @@ -79,7 +77,7 @@ typedef struct epoch_record { struct epoch { struct ck_epoch e_epoch __aligned(EPOCH_ALIGN); epoch_record_t e_pcpu_record; - int e_idx; + int e_in_use; int e_flags; struct sx e_drain_sx; struct mtx e_drain_mtx; @@ -128,19 +126,23 @@ TAILQ_HEAD (threadlist, thread); CK_STACK_CONTAINER(struct ck_epoch_entry, stack_entry, ck_epoch_entry_container) -epoch_t allepochs[MAX_EPOCHS]; +static struct epoch epoch_array[MAX_EPOCHS]; DPCPU_DEFINE(struct grouptask, epoch_cb_task); DPCPU_DEFINE(int, epoch_cb_count); static __read_mostly int inited; -static __read_mostly int epoch_count; __read_mostly epoch_t global_epoch; __read_mostly epoch_t global_epoch_preempt; static void epoch_call_task(void *context __unused); static uma_zone_t pcpu_zone_record; +static struct sx epoch_sx; + +#define EPOCH_LOCK() sx_xlock(&epoch_sx) +#define EPOCH_UNLOCK() sx_xunlock(&epoch_sx) + #ifdef EPOCH_TRACE struct stackentry { RB_ENTRY(stackentry) se_node; @@ -281,6 +283,7 @@ epoch_init(void *arg __unused) #ifdef EPOCH_TRACE SLIST_INIT(&thread0.td_epochs); #endif + sx_init(&epoch_sx, "epoch-sx"); inited = 1; global_epoch = epoch_alloc("Global", 0); global_epoch_preempt = epoch_alloc("Global preemptible", EPOCH_PREEMPT); @@ -326,19 +329,48 @@ epoch_t epoch_alloc(const char *name, int flags) { epoch_t epoch; + int i; + MPASS(name != NULL); + if (__predict_false(!inited)) panic("%s called too early in boot", __func__); - epoch = malloc(sizeof(struct epoch), M_EPOCH, M_ZERO | M_WAITOK); + + EPOCH_LOCK(); + + /* + * Find a free index in the epoch array. If no free index is + * found, try to use the index after the last one. + */ + for (i = 0;; i++) { + /* + * If too many epochs are currently allocated, + * return NULL. + */ + if (i == MAX_EPOCHS) { + epoch = NULL; + goto done; + } + if (epoch_array[i].e_in_use == 0) + break; + } + + epoch = epoch_array + i; ck_epoch_init(&epoch->e_epoch); epoch_ctor(epoch); - MPASS(epoch_count < MAX_EPOCHS - 2); epoch->e_flags = flags; - epoch->e_idx = epoch_count; epoch->e_name = name; sx_init(&epoch->e_drain_sx, "epoch-drain-sx"); mtx_init(&epoch->e_drain_mtx, "epoch-drain-mtx", NULL, MTX_DEF); - allepochs[epoch_count++] = epoch; + + /* + * Set e_in_use last, because when this field is set the + * epoch_call_task() function will start scanning this epoch + * structure. + */ + atomic_store_rel_int(&epoch->e_in_use, 1); +done: + EPOCH_UNLOCK(); return (epoch); } @@ -346,13 +378,24 @@ void epoch_free(epoch_t epoch) { + EPOCH_LOCK(); + + MPASS(epoch->e_in_use != 0); + epoch_drain_callbacks(epoch); - allepochs[epoch->e_idx] = NULL; + + atomic_store_rel_int(&epoch->e_in_use, 0); + /* + * Make sure the epoch_call_task() function see e_in_use equal + * to zero, by calling epoch_wait() on the global_epoch: + */ epoch_wait(global_epoch); uma_zfree_pcpu(pcpu_zone_record, epoch->e_pcpu_record); mtx_destroy(&epoch->e_drain_mtx); sx_destroy(&epoch->e_drain_sx); - free(epoch, M_EPOCH); + memset(epoch, 0, sizeof(*epoch)); + + EPOCH_UNLOCK(); } static epoch_record_t @@ -705,8 +748,10 @@ epoch_call_task(void *arg __unused) ck_stack_init(&cb_stack); critical_enter(); epoch_enter(global_epoch); - for (total = i = 0; i < epoch_count; i++) { - if (__predict_false((epoch = allepochs[i]) == NULL)) + for (total = i = 0; i != MAX_EPOCHS; i++) { + epoch = epoch_array + i; + if (__predict_false( + atomic_load_acq_int(&epoch->e_in_use) == 0)) continue; er = epoch_currecord(epoch); record = &er->er_record; Modified: projects/clang1100-import/sys/net/iflib.c ============================================================================== --- projects/clang1100-import/sys/net/iflib.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/net/iflib.c Fri Aug 7 18:14:41 2020 (r364035) @@ -1076,28 +1076,24 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl struct netmap_adapter *na = kring->na; struct netmap_ring *ring = kring->ring; if_t ifp = na->ifp; - iflib_fl_t fl; uint32_t nm_i; /* index into the netmap ring */ uint32_t nic_i; /* index into the NIC ring */ - u_int i, n; + u_int n; u_int const lim = kring->nkr_num_slots - 1; - u_int const head = kring->rhead; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; - struct if_rxd_info ri; if_ctx_t ctx = ifp->if_softc; iflib_rxq_t rxq = &ctx->ifc_rxqs[kring->ring_id]; - if (head > lim) - return netmap_ring_reinit(kring); + iflib_fl_t fl = &rxq->ifr_fl[0]; + struct if_rxd_info ri; /* - * XXX netmap_fl_refill() only ever (re)fills free list 0 so far. + * netmap only uses free list 0, to avoid out of order consumption + * of receive buffers */ - for (i = 0, fl = rxq->ifr_fl; i < rxq->ifr_nfl; i++, fl++) { - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - } + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* * First part: import newly received packets. @@ -1119,38 +1115,35 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl int crclen = iflib_crcstrip ? 0 : 4; int error, avail; - for (i = 0; i < rxq->ifr_nfl; i++) { - fl = &rxq->ifr_fl[i]; - nic_i = fl->ifl_cidx; - nm_i = netmap_idx_n2k(kring, nic_i); - avail = ctx->isc_rxd_available(ctx->ifc_softc, - rxq->ifr_id, nic_i, USHRT_MAX); - for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, avail--) { - rxd_info_zero(&ri); - ri.iri_frags = rxq->ifr_frags; - ri.iri_qsidx = kring->ring_id; - ri.iri_ifp = ctx->ifc_ifp; - ri.iri_cidx = nic_i; + nic_i = fl->ifl_cidx; + nm_i = netmap_idx_n2k(kring, nic_i); + avail = ctx->isc_rxd_available(ctx->ifc_softc, + rxq->ifr_id, nic_i, USHRT_MAX); + for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, avail--) { + rxd_info_zero(&ri); + ri.iri_frags = rxq->ifr_frags; + ri.iri_qsidx = kring->ring_id; + ri.iri_ifp = ctx->ifc_ifp; + ri.iri_cidx = nic_i; - error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, &ri); - ring->slot[nm_i].len = error ? 0 : ri.iri_len - crclen; - ring->slot[nm_i].flags = 0; - bus_dmamap_sync(fl->ifl_buf_tag, - fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); - nm_i = nm_next(nm_i, lim); - nic_i = nm_next(nic_i, lim); + error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, &ri); + ring->slot[nm_i].len = error ? 0 : ri.iri_len - crclen; + ring->slot[nm_i].flags = 0; + bus_dmamap_sync(fl->ifl_buf_tag, + fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); + nm_i = nm_next(nm_i, lim); + nic_i = nm_next(nic_i, lim); + } + if (n) { /* update the state variables */ + if (netmap_no_pendintr && !force_update) { + /* diagnostics */ + iflib_rx_miss ++; + iflib_rx_miss_bufs += n; } - if (n) { /* update the state variables */ - if (netmap_no_pendintr && !force_update) { - /* diagnostics */ - iflib_rx_miss ++; - iflib_rx_miss_bufs += n; - } - fl->ifl_cidx = nic_i; - kring->nr_hwtail = nm_i; - } - kring->nr_kflags &= ~NKR_PENDINTR; + fl->ifl_cidx = nic_i; + kring->nr_hwtail = nm_i; } + kring->nr_kflags &= ~NKR_PENDINTR; } /* * Second part: skip past packets that userspace has released. @@ -1160,7 +1153,6 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl * nic_i is the index in the NIC ring, and * nm_i == (nic_i + kring->nkr_hwofs) % ring_size */ - /* XXX not sure how this will work with multiple free lists */ nm_i = kring->nr_hwcur; return (netmap_fl_refill(rxq, kring, nm_i, false)); Modified: projects/clang1100-import/sys/net80211/ieee80211_ioctl.c ============================================================================== --- projects/clang1100-import/sys/net80211/ieee80211_ioctl.c Fri Aug 7 18:12:37 2020 (r364034) +++ projects/clang1100-import/sys/net80211/ieee80211_ioctl.c Fri Aug 7 18:14:41 2020 (r364035) @@ -785,6 +785,13 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l int error = 0; switch (ireq->i_type) { + case IEEE80211_IOC_IC_NAME: + len = strlen(ic->ic_name) + 1; + if (len > ireq->i_len) + return (EINVAL); + ireq->i_len = len; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***