svn commit: r357350 - in projects/clang1000-import: . contrib/apr/random/unix contrib/apr/strings contrib/bmake/mk gnu/lib include lib/csu lib/libc/amd64/string lib/libc/stdio lib/libusb release/ar...

Dimitry Andric dim at FreeBSD.org
Fri Jan 31 19:40:46 UTC 2020


Author: dim
Date: Fri Jan 31 19:40:40 2020
New Revision: 357350
URL: https://svnweb.freebsd.org/changeset/base/357350

Log:
  Merge ^/head r357270 through r357349.

Added:
  projects/clang1000-import/sys/kern/subr_smr.c
     - copied unchanged from r357349, head/sys/kern/subr_smr.c
  projects/clang1000-import/sys/sys/_smr.h
     - copied unchanged from r357349, head/sys/sys/_smr.h
  projects/clang1000-import/sys/sys/smr.h
     - copied unchanged from r357349, head/sys/sys/smr.h
  projects/clang1000-import/tools/uma/
     - copied from r357349, head/tools/uma/
Deleted:
  projects/clang1000-import/release/packages/acct.ucl
  projects/clang1000-import/release/packages/acpi.ucl
  projects/clang1000-import/release/packages/amd.ucl
  projects/clang1000-import/release/packages/apm.ucl
  projects/clang1000-import/release/packages/at.ucl
  projects/clang1000-import/release/packages/autofs.ucl
  projects/clang1000-import/release/packages/bhyve.ucl
  projects/clang1000-import/release/packages/bluetooth.ucl
  projects/clang1000-import/release/packages/bsdinstall.ucl
  projects/clang1000-import/release/packages/bsnmp.ucl
  projects/clang1000-import/release/packages/dma.ucl
  projects/clang1000-import/release/packages/ee.ucl
  projects/clang1000-import/release/packages/hostapd.ucl
  projects/clang1000-import/release/packages/jail-debug.ucl
  projects/clang1000-import/release/packages/jail-development.ucl
  projects/clang1000-import/release/packages/jail-lib32-debug.ucl
  projects/clang1000-import/release/packages/jail-lib32-development.ucl
  projects/clang1000-import/release/packages/jail-lib32-profile.ucl
  projects/clang1000-import/release/packages/jail-lib32.ucl
  projects/clang1000-import/release/packages/jail-profile.ucl
  projects/clang1000-import/release/packages/rcmds.ucl
  projects/clang1000-import/release/packages/runtime-debug.ucl
  projects/clang1000-import/release/packages/runtime-development.ucl
  projects/clang1000-import/release/packages/runtime-lib32.ucl
  projects/clang1000-import/release/packages/runtime-manuals.ucl
  projects/clang1000-import/release/packages/runtime-profile.ucl
  projects/clang1000-import/release/packages/syscons.ucl
  projects/clang1000-import/release/packages/tests.ucl
  projects/clang1000-import/release/packages/vi.ucl
  projects/clang1000-import/release/packages/wpa.ucl
  projects/clang1000-import/tools/build/options/WITHOUT_BSD_CRTBEGIN
  projects/clang1000-import/tools/build/options/WITH_BSD_CRTBEGIN
Modified:
  projects/clang1000-import/Makefile.inc1
  projects/clang1000-import/contrib/apr/random/unix/apr_random.c
  projects/clang1000-import/contrib/apr/strings/apr_snprintf.c
  projects/clang1000-import/contrib/bmake/mk/meta2deps.sh
  projects/clang1000-import/gnu/lib/Makefile
  projects/clang1000-import/include/stdio.h
  projects/clang1000-import/lib/csu/Makefile.inc
  projects/clang1000-import/lib/libc/amd64/string/memcmp.S
  projects/clang1000-import/lib/libc/stdio/Makefile.inc
  projects/clang1000-import/lib/libc/stdio/Symbol.map
  projects/clang1000-import/lib/libc/stdio/fflush.3
  projects/clang1000-import/lib/libc/stdio/fflush.c
  projects/clang1000-import/lib/libc/stdio/fputc.c
  projects/clang1000-import/lib/libc/stdio/fputs.3
  projects/clang1000-import/lib/libc/stdio/fputs.c
  projects/clang1000-import/lib/libc/stdio/fread.3
  projects/clang1000-import/lib/libc/stdio/fread.c
  projects/clang1000-import/lib/libc/stdio/fwrite.c
  projects/clang1000-import/lib/libc/stdio/putc.3
  projects/clang1000-import/lib/libusb/libusb10_hotplug.c
  projects/clang1000-import/release/arm64/RPI3.conf
  projects/clang1000-import/release/packages/binutils.ucl
  projects/clang1000-import/release/packages/caroot.ucl
  projects/clang1000-import/release/packages/clang.ucl
  projects/clang1000-import/release/packages/gdb.ucl
  projects/clang1000-import/release/packages/generate-ucl.sh
  projects/clang1000-import/release/packages/groff.ucl
  projects/clang1000-import/release/packages/jail.ucl
  projects/clang1000-import/release/packages/lld.ucl
  projects/clang1000-import/release/packages/lldb.ucl
  projects/clang1000-import/release/packages/runtime.ucl
  projects/clang1000-import/release/packages/ssh.ucl
  projects/clang1000-import/release/packages/svn.ucl
  projects/clang1000-import/release/packages/unbound.ucl
  projects/clang1000-import/share/man/man4/cpufreq.4
  projects/clang1000-import/share/man/man5/src.conf.5
  projects/clang1000-import/share/man/man9/stack.9
  projects/clang1000-import/share/mk/local.dirdeps-options.mk
  projects/clang1000-import/share/mk/local.dirdeps.mk
  projects/clang1000-import/share/mk/local.gendirdeps.mk
  projects/clang1000-import/share/mk/meta2deps.sh
  projects/clang1000-import/share/mk/src.opts.mk
  projects/clang1000-import/sys/amd64/amd64/support.S
  projects/clang1000-import/sys/amd64/amd64/trap.c
  projects/clang1000-import/sys/arm/arm/stack_machdep.c
  projects/clang1000-import/sys/arm64/acpica/acpi_iort.c
  projects/clang1000-import/sys/arm64/arm64/gicv3_its.c
  projects/clang1000-import/sys/arm64/arm64/stack_machdep.c
  projects/clang1000-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h
  projects/clang1000-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
  projects/clang1000-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
  projects/clang1000-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  projects/clang1000-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  projects/clang1000-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
  projects/clang1000-import/sys/conf/config.mk
  projects/clang1000-import/sys/conf/files
  projects/clang1000-import/sys/dev/acpi_support/acpi_ibm.c
  projects/clang1000-import/sys/dev/aic7xxx/aic79xx_inline.h
  projects/clang1000-import/sys/dev/bwi/if_bwi.c
  projects/clang1000-import/sys/dev/bwn/if_bwn.c
  projects/clang1000-import/sys/dev/ipw/if_ipw.c
  projects/clang1000-import/sys/dev/iwi/if_iwi.c
  projects/clang1000-import/sys/dev/iwm/if_iwm.c
  projects/clang1000-import/sys/dev/iwn/if_iwn.c
  projects/clang1000-import/sys/dev/malo/if_malo.c
  projects/clang1000-import/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c
  projects/clang1000-import/sys/dev/mlx5/cq.h
  projects/clang1000-import/sys/dev/mlx5/driver.h
  projects/clang1000-import/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  projects/clang1000-import/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  projects/clang1000-import/sys/dev/mwl/if_mwl.c
  projects/clang1000-import/sys/dev/ral/rt2560.c
  projects/clang1000-import/sys/dev/ral/rt2661.c
  projects/clang1000-import/sys/dev/ral/rt2860.c
  projects/clang1000-import/sys/dev/rtwn/pci/rtwn_pci_rx.c
  projects/clang1000-import/sys/dev/usb/wlan/if_rum.c
  projects/clang1000-import/sys/dev/usb/wlan/if_run.c
  projects/clang1000-import/sys/dev/usb/wlan/if_uath.c
  projects/clang1000-import/sys/dev/usb/wlan/if_upgt.c
  projects/clang1000-import/sys/dev/usb/wlan/if_ural.c
  projects/clang1000-import/sys/dev/usb/wlan/if_urtw.c
  projects/clang1000-import/sys/dev/usb/wlan/if_zyd.c
  projects/clang1000-import/sys/dev/wi/if_wi.c
  projects/clang1000-import/sys/dev/wpi/if_wpi.c
  projects/clang1000-import/sys/dev/wtap/if_wtap.c
  projects/clang1000-import/sys/fs/nullfs/null_subr.c
  projects/clang1000-import/sys/fs/nullfs/null_vnops.c
  projects/clang1000-import/sys/i386/i386/trap.c
  projects/clang1000-import/sys/kern/imgact_binmisc.c
  projects/clang1000-import/sys/kern/imgact_elf.c
  projects/clang1000-import/sys/kern/init_main.c
  projects/clang1000-import/sys/kern/kern_alq.c
  projects/clang1000-import/sys/kern/kern_conf.c
  projects/clang1000-import/sys/kern/kern_exit.c
  projects/clang1000-import/sys/kern/kern_hhook.c
  projects/clang1000-import/sys/kern/kern_jail.c
  projects/clang1000-import/sys/kern/kern_kcov.c
  projects/clang1000-import/sys/kern/kern_kthread.c
  projects/clang1000-import/sys/kern/kern_linker.c
  projects/clang1000-import/sys/kern/kern_lockf.c
  projects/clang1000-import/sys/kern/kern_mib.c
  projects/clang1000-import/sys/kern/kern_mtxpool.c
  projects/clang1000-import/sys/kern/kern_pmc.c
  projects/clang1000-import/sys/kern/kern_poll.c
  projects/clang1000-import/sys/kern/kern_proc.c
  projects/clang1000-import/sys/kern/kern_resource.c
  projects/clang1000-import/sys/kern/kern_rmlock.c
  projects/clang1000-import/sys/kern/kern_sig.c
  projects/clang1000-import/sys/kern/kern_switch.c
  projects/clang1000-import/sys/kern/kern_sysctl.c
  projects/clang1000-import/sys/kern/kern_tc.c
  projects/clang1000-import/sys/kern/kern_time.c
  projects/clang1000-import/sys/kern/kern_ubsan.c
  projects/clang1000-import/sys/kern/kern_umtx.c
  projects/clang1000-import/sys/kern/link_elf.c
  projects/clang1000-import/sys/kern/link_elf_obj.c
  projects/clang1000-import/sys/kern/sched_4bsd.c
  projects/clang1000-import/sys/kern/sched_ule.c
  projects/clang1000-import/sys/kern/subr_acl_posix1e.c
  projects/clang1000-import/sys/kern/subr_blist.c
  projects/clang1000-import/sys/kern/subr_bufring.c
  projects/clang1000-import/sys/kern/subr_bus.c
  projects/clang1000-import/sys/kern/subr_clock.c
  projects/clang1000-import/sys/kern/subr_csan.c
  projects/clang1000-import/sys/kern/subr_fattime.c
  projects/clang1000-import/sys/kern/subr_filter.c
  projects/clang1000-import/sys/kern/subr_gtaskqueue.c
  projects/clang1000-import/sys/kern/subr_hints.c
  projects/clang1000-import/sys/kern/subr_intr.c
  projects/clang1000-import/sys/kern/subr_kdb.c
  projects/clang1000-import/sys/kern/subr_sbuf.c
  projects/clang1000-import/sys/kern/subr_sleepqueue.c
  projects/clang1000-import/sys/kern/subr_smp.c
  projects/clang1000-import/sys/kern/subr_stats.c
  projects/clang1000-import/sys/kern/subr_unit.c
  projects/clang1000-import/sys/kern/subr_vmem.c
  projects/clang1000-import/sys/kern/subr_witness.c
  projects/clang1000-import/sys/kern/sys_generic.c
  projects/clang1000-import/sys/kern/sys_pipe.c
  projects/clang1000-import/sys/kern/sys_process.c
  projects/clang1000-import/sys/kern/sysv_msg.c
  projects/clang1000-import/sys/kern/sysv_shm.c
  projects/clang1000-import/sys/kern/tty_info.c
  projects/clang1000-import/sys/kern/uipc_mbuf.c
  projects/clang1000-import/sys/kern/uipc_usrreq.c
  projects/clang1000-import/sys/kern/vfs_acl.c
  projects/clang1000-import/sys/kern/vfs_bio.c
  projects/clang1000-import/sys/kern/vfs_cluster.c
  projects/clang1000-import/sys/kern/vfs_extattr.c
  projects/clang1000-import/sys/kern/vfs_init.c
  projects/clang1000-import/sys/kern/vfs_subr.c
  projects/clang1000-import/sys/kern/vfs_syscalls.c
  projects/clang1000-import/sys/kern/vfs_vnops.c
  projects/clang1000-import/sys/mips/mips/stack_machdep.c
  projects/clang1000-import/sys/modules/if_lagg/Makefile
  projects/clang1000-import/sys/modules/if_vlan/Makefile
  projects/clang1000-import/sys/netinet/tcp_usrreq.c
  projects/clang1000-import/sys/netinet6/udp6_usrreq.c
  projects/clang1000-import/sys/powerpc/powerpc/stack_machdep.c
  projects/clang1000-import/sys/riscv/include/db_machdep.h
  projects/clang1000-import/sys/riscv/include/pcb.h
  projects/clang1000-import/sys/riscv/include/riscvreg.h
  projects/clang1000-import/sys/riscv/riscv/exception.S
  projects/clang1000-import/sys/riscv/riscv/genassym.c
  projects/clang1000-import/sys/riscv/riscv/machdep.c
  projects/clang1000-import/sys/riscv/riscv/stack_machdep.c
  projects/clang1000-import/sys/sparc64/sparc64/stack_machdep.c
  projects/clang1000-import/sys/sys/rmlock.h
  projects/clang1000-import/sys/sys/stack.h
  projects/clang1000-import/sys/sys/vnode.h
  projects/clang1000-import/sys/ufs/ufs/ufs_inode.c
  projects/clang1000-import/sys/vm/uma.h
  projects/clang1000-import/sys/vm/uma_core.c
  projects/clang1000-import/sys/vm/uma_int.h
  projects/clang1000-import/sys/x86/cpufreq/hwpstate_amd.c
  projects/clang1000-import/sys/x86/include/apicvar.h
  projects/clang1000-import/sys/x86/include/stack.h
  projects/clang1000-import/sys/x86/x86/mp_x86.c
  projects/clang1000-import/sys/x86/x86/stack_machdep.c
  projects/clang1000-import/targets/pseudo/userland/gnu/Makefile.depend
  projects/clang1000-import/tests/sys/sys/qmath_test.c
  projects/clang1000-import/usr.sbin/makefs/msdos/msdosfs_denode.c
  projects/clang1000-import/usr.sbin/services_mkdb/services
Directory Properties:
  projects/clang1000-import/   (props changed)
  projects/clang1000-import/contrib/apr/   (props changed)
  projects/clang1000-import/contrib/bmake/   (props changed)
  projects/clang1000-import/gnu/lib/   (props changed)
  projects/clang1000-import/sys/cddl/contrib/opensolaris/   (props changed)

Modified: projects/clang1000-import/Makefile.inc1
==============================================================================
--- projects/clang1000-import/Makefile.inc1	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/Makefile.inc1	Fri Jan 31 19:40:40 2020	(r357350)
@@ -2783,13 +2783,10 @@ _prereq_libs+= lib/libssp_nonshared
 
 # These dependencies are not automatically generated:
 #
-# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
+# gnu/lib/libgcc, lib/csu and lib/libc must be built before
 # all shared libraries for ELF.
 #
 _startup_libs=	lib/csu
-.if ${MK_BSD_CRTBEGIN} == "no"
-_startup_libs+=	gnu/lib/csu
-.endif
 _startup_libs+=	lib/libc
 _startup_libs+=	lib/libc_nonshared
 .if ${MK_LIBCPLUSPLUS} != "no"

Modified: projects/clang1000-import/contrib/apr/random/unix/apr_random.c
==============================================================================
--- projects/clang1000-import/contrib/apr/random/unix/apr_random.c	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/contrib/apr/random/unix/apr_random.c	Fri Jan 31 19:40:40 2020	(r357350)
@@ -13,285 +13,51 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * See the paper "On Randomness" by Ben Laurie for an explanation of this PRNG.
- * http://www.apache-ssl.org/randomness.pdf
- * XXX: Is there a formal proof of this PRNG? Couldn't we use the more popular
- * Mersenne Twister PRNG (and BSD licensed)?
- */
 
 #include "apr.h"
 #include "apr_pools.h"
 #include "apr_random.h"
 #include "apr_thread_proc.h"
 #include <assert.h>
+#include <stdlib.h>
 
-#ifdef min
-#undef min
-#endif
-#define min(a,b) ((a) < (b) ? (a) : (b))
-
-#define APR_RANDOM_DEFAULT_POOLS 32
-#define APR_RANDOM_DEFAULT_REHASH_SIZE 1024
-#define APR_RANDOM_DEFAULT_RESEED_SIZE 32
-#define APR_RANDOM_DEFAULT_HASH_SECRET_SIZE 32
-#define APR_RANDOM_DEFAULT_G_FOR_INSECURE 32
-#define APR_RANDOM_DEFAULT_G_FOR_SECURE 320
-
-typedef struct apr_random_pool_t {
-    unsigned char *pool;
-    unsigned int bytes;
-    unsigned int pool_size;
-} apr_random_pool_t;
-
-#define hash_init(h)            (h)->init(h)
-#define hash_add(h,b,n)         (h)->add(h,b,n)
-#define hash_finish(h,r)        (h)->finish(h,r)
-
-#define hash(h,r,b,n)           hash_init(h),hash_add(h,b,n),hash_finish(h,r)
-
-#define crypt_setkey(c,k)       (c)->set_key((c)->data,k)
-#define crypt_crypt(c,out,in)   (c)->crypt((c)->date,out,in)
-
-struct apr_random_t {
-    apr_pool_t *apr_pool;
-    apr_crypto_hash_t *pool_hash;
-    unsigned int npools;
-    apr_random_pool_t *pools;
-    unsigned int next_pool;
-    unsigned int generation;
-    apr_size_t rehash_size;
-    apr_size_t reseed_size;
-    apr_crypto_hash_t *key_hash;
-#define K_size(g) ((g)->key_hash->size)
-    apr_crypto_hash_t *prng_hash;
-#define B_size(g) ((g)->prng_hash->size)
-
-    unsigned char *H;
-    unsigned char *H_waiting;
-#define H_size(g) (B_size(g)+K_size(g))
-#define H_current(g) (((g)->insecure_started && !(g)->secure_started) \
-                      ? (g)->H_waiting : (g)->H)
-
-    unsigned char *randomness;
-    apr_size_t random_bytes;
-    unsigned int g_for_insecure;
-    unsigned int g_for_secure;
-    unsigned int secure_base;
-    unsigned int insecure_started:1;
-    unsigned int secure_started:1;
-
-    apr_random_t *next;
-};
-
-static apr_random_t *all_random;
-
-static apr_status_t random_cleanup(void *data)
-{
-    apr_random_t *remove_this = data,
-                 *cur = all_random,
-                 **prev_ptr = &all_random;
-    while (cur) {
-        if (cur == remove_this) {
-            *prev_ptr = cur->next;
-            break;
-        }
-        prev_ptr = &cur->next;
-        cur = cur->next;
-    }
-    return APR_SUCCESS;
-}
-
-
 APR_DECLARE(void) apr_random_init(apr_random_t *g,apr_pool_t *p,
                                   apr_crypto_hash_t *pool_hash,
                                   apr_crypto_hash_t *key_hash,
                                   apr_crypto_hash_t *prng_hash)
 {
-    unsigned int n;
-
-    g->apr_pool = p;
-
-    g->pool_hash = pool_hash;
-    g->key_hash = key_hash;
-    g->prng_hash = prng_hash;
-
-    g->npools = APR_RANDOM_DEFAULT_POOLS;
-    g->pools = apr_palloc(p,g->npools*sizeof *g->pools);
-    for (n = 0; n < g->npools; ++n) {
-        g->pools[n].bytes = g->pools[n].pool_size = 0;
-        g->pools[n].pool = NULL;
-    }
-    g->next_pool = 0;
-
-    g->generation = 0;
-
-    g->rehash_size = APR_RANDOM_DEFAULT_REHASH_SIZE;
-    /* Ensure that the rehash size is twice the size of the pool hasher */
-    g->rehash_size = ((g->rehash_size+2*g->pool_hash->size-1)/g->pool_hash->size
-                    /2)*g->pool_hash->size*2;
-    g->reseed_size = APR_RANDOM_DEFAULT_RESEED_SIZE;
-
-    g->H = apr_pcalloc(p,H_size(g));
-    g->H_waiting = apr_pcalloc(p,H_size(g));
-
-    g->randomness = apr_palloc(p,B_size(g));
-    g->random_bytes = 0;
-
-    g->g_for_insecure = APR_RANDOM_DEFAULT_G_FOR_INSECURE;
-    g->secure_base = 0;
-    g->g_for_secure = APR_RANDOM_DEFAULT_G_FOR_SECURE;
-    g->secure_started = g->insecure_started = 0;
-
-    g->next = all_random;
-    all_random = g;
-    apr_pool_cleanup_register(p, g, random_cleanup, apr_pool_cleanup_null);
+    (void)g;
+    (void)p;
+    (void)pool_hash;
+    (void)key_hash;
+    (void)prng_hash;
 }
 
-static void mix_pid(apr_random_t *g,unsigned char *H,pid_t pid)
-{
-    hash_init(g->key_hash);
-    hash_add(g->key_hash,H,H_size(g));
-    hash_add(g->key_hash,&pid,sizeof pid);
-    hash_finish(g->key_hash,H);
-}
-
-static void mixer(apr_random_t *g,pid_t pid)
-{
-    unsigned char *H = H_current(g);
-
-    /* mix the PID into the current H */
-    mix_pid(g,H,pid);
-    /* if we are in waiting, then also mix into main H */
-    if (H != g->H)
-        mix_pid(g,g->H,pid);
-    /* change order of pool mixing for good measure - note that going
-       backwards is much better than going forwards */
-    --g->generation;
-    /* blow away any lingering randomness */
-    g->random_bytes = 0;
-}
-
 APR_DECLARE(void) apr_random_after_fork(apr_proc_t *proc)
 {
-    apr_random_t *r;
-
-    for (r = all_random; r; r = r->next)
-        /* 
-         * XXX Note: the pid does not provide sufficient entropy to 
-         * actually call this secure.  See Ben's paper referenced at 
-         * the top of this file. 
-         */
-        mixer(r,proc->pid);
+    (void)proc;
 }
 
 APR_DECLARE(apr_random_t *) apr_random_standard_new(apr_pool_t *p)
 {
-    apr_random_t *r = apr_palloc(p,sizeof *r);
-    
-    apr_random_init(r,p,apr_crypto_sha256_new(p),apr_crypto_sha256_new(p),
-                    apr_crypto_sha256_new(p));
-    return r;
+    /* apr_random_t is an opaque struct type. */
+    return (void *)0x1;
 }
 
-static void rekey(apr_random_t *g)
-{
-    unsigned int n;
-    unsigned char *H = H_current(g);
-
-    hash_init(g->key_hash);
-    hash_add(g->key_hash,H,H_size(g));
-    for (n = 0 ; n < g->npools && (n == 0 || g->generation&(1 << (n-1)))
-            ; ++n) {
-        hash_add(g->key_hash,g->pools[n].pool,g->pools[n].bytes);
-        g->pools[n].bytes = 0;
-    }
-    hash_finish(g->key_hash,H+B_size(g));
-
-    ++g->generation;
-    if (!g->insecure_started && g->generation > g->g_for_insecure) {
-        g->insecure_started = 1;
-        if (!g->secure_started) {
-            memcpy(g->H_waiting,g->H,H_size(g));
-            g->secure_base = g->generation;
-        }
-    }
-
-    if (!g->secure_started && g->generation > g->secure_base+g->g_for_secure) {
-        g->secure_started = 1;
-        memcpy(g->H,g->H_waiting,H_size(g));
-    }
-}
-
 APR_DECLARE(void) apr_random_add_entropy(apr_random_t *g,const void *entropy_,
                                          apr_size_t bytes)
 {
-    unsigned int n;
-    const unsigned char *entropy = entropy_;
-
-    for (n = 0; n < bytes; ++n) {
-        apr_random_pool_t *p = &g->pools[g->next_pool];
-
-        if (++g->next_pool == g->npools)
-            g->next_pool = 0;
-
-        if (p->pool_size < p->bytes+1) {
-            unsigned char *np = apr_palloc(g->apr_pool,(p->bytes+1)*2);
-
-            memcpy(np,p->pool,p->bytes);
-            p->pool = np;
-            p->pool_size = (p->bytes+1)*2;
-        }
-        p->pool[p->bytes++] = entropy[n];
-
-        if (p->bytes == g->rehash_size) {
-            apr_size_t r;
-
-            for (r = 0; r < p->bytes/2; r+=g->pool_hash->size)
-                hash(g->pool_hash,p->pool+r,p->pool+r*2,g->pool_hash->size*2);
-            p->bytes/=2;
-        }
-        assert(p->bytes < g->rehash_size);
-    }
-
-    if (g->pools[0].bytes >= g->reseed_size)
-        rekey(g);
+    (void)g;
+    (void)entropy_;
+    (void)bytes;
 }
 
-/* This will give g->B_size bytes of randomness */
-static void apr_random_block(apr_random_t *g,unsigned char *random)
-{
-    /* FIXME: in principle, these are different hashes */
-    hash(g->prng_hash,g->H,g->H,H_size(g));
-    hash(g->prng_hash,random,g->H,B_size(g));
-}
-
-static void apr_random_bytes(apr_random_t *g,unsigned char *random,
-                             apr_size_t bytes)
-{
-    apr_size_t n;
-
-    for (n = 0; n < bytes; ) {
-        apr_size_t l;
-
-        if (g->random_bytes == 0) {
-            apr_random_block(g,g->randomness);
-            g->random_bytes = B_size(g);
-        }
-        l = min(bytes-n,g->random_bytes);
-        memcpy(&random[n],g->randomness+B_size(g)-g->random_bytes,l);
-        g->random_bytes-=l;
-        n+=l;
-    }
-}
-
 APR_DECLARE(apr_status_t) apr_random_secure_bytes(apr_random_t *g,
                                                   void *random,
                                                   apr_size_t bytes)
 {
-    if (!g->secure_started)
-        return APR_ENOTENOUGHENTROPY;
-    apr_random_bytes(g,random,bytes);
+    (void)g;
+    arc4random_buf(random, bytes);
     return APR_SUCCESS;
 }
 
@@ -299,28 +65,24 @@ APR_DECLARE(apr_status_t) apr_random_insecure_bytes(ap
                                                     void *random,
                                                     apr_size_t bytes)
 {
-    if (!g->insecure_started)
-        return APR_ENOTENOUGHENTROPY;
-    apr_random_bytes(g,random,bytes);
+    (void)g;
+    arc4random_buf(random, bytes);
     return APR_SUCCESS;
 }
 
 APR_DECLARE(void) apr_random_barrier(apr_random_t *g)
 {
-    g->secure_started = 0;
-    g->secure_base = g->generation;
+    (void)g;
 }
 
 APR_DECLARE(apr_status_t) apr_random_secure_ready(apr_random_t *r)
 {
-    if (!r->secure_started)
-        return APR_ENOTENOUGHENTROPY;
+    (void)r;
     return APR_SUCCESS;
 }
 
 APR_DECLARE(apr_status_t) apr_random_insecure_ready(apr_random_t *r)
 {
-    if (!r->insecure_started)
-        return APR_ENOTENOUGHENTROPY;
+    (void)r;
     return APR_SUCCESS;
 }

Modified: projects/clang1000-import/contrib/apr/strings/apr_snprintf.c
==============================================================================
--- projects/clang1000-import/contrib/apr/strings/apr_snprintf.c	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/contrib/apr/strings/apr_snprintf.c	Fri Jan 31 19:40:40 2020	(r357350)
@@ -708,6 +708,7 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_
 
     char num_buf[NUM_BUF_SIZE];
     char char_buf[2];                /* for printing %% and %<unknown> */
+    char buf[5];                     /* for printing %B, %F, and %S */
 
     enum var_type_enum {
             IS_QUAD, IS_LONG, IS_SHORT, IS_INT
@@ -1246,7 +1247,6 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_
                 case 'F':
                 case 'S':
                 {
-                    char buf[5];
                     apr_off_t size = 0;
 
                     if (*fmt == 'B') {

Modified: projects/clang1000-import/contrib/bmake/mk/meta2deps.sh
==============================================================================
--- projects/clang1000-import/contrib/bmake/mk/meta2deps.sh	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/contrib/bmake/mk/meta2deps.sh	Fri Jan 31 19:40:40 2020	(r357350)
@@ -49,7 +49,6 @@
 #	The output, is a set of absolute paths with "SB" like:
 #.nf
 #
-#	$SB/obj-i386/bsd/gnu/lib/csu
 #	$SB/obj-i386/bsd/gnu/lib/libgcc
 #	$SB/obj-i386/bsd/include
 #	$SB/obj-i386/bsd/lib/csu/i386

Modified: projects/clang1000-import/gnu/lib/Makefile
==============================================================================
--- projects/clang1000-import/gnu/lib/Makefile	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/gnu/lib/Makefile	Fri Jan 31 19:40:40 2020	(r357350)
@@ -10,10 +10,6 @@ SUBDIR+=		libgomp
 .endif
 SUBDIR.${MK_TESTS}+=	tests
 
-.if ${MK_BSD_CRTBEGIN} == "no"
-SUBDIR+=		csu
-.endif
-
 .if ${MK_GNU_GREP} != "no" || ${MK_GNU_GREP_COMPAT} != "no" || \
     ${MK_GDB} != "no"
 SUBDIR+=		libregex

Modified: projects/clang1000-import/include/stdio.h
==============================================================================
--- projects/clang1000-import/include/stdio.h	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/include/stdio.h	Fri Jan 31 19:40:40 2020	(r357350)
@@ -346,7 +346,12 @@ int	 putchar_unlocked(int);
 void	 clearerr_unlocked(FILE *);
 int	 feof_unlocked(FILE *);
 int	 ferror_unlocked(FILE *);
+int	 fflush_unlocked(FILE *);
 int	 fileno_unlocked(FILE *);
+int	 fputs_unlocked(const char * __restrict, FILE * __restrict);
+size_t	 fread_unlocked(void * __restrict, size_t, size_t, FILE * __restrict);
+size_t	 fwrite_unlocked(const void * __restrict, size_t, size_t,
+    FILE * __restrict);
 #endif
 
 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
@@ -507,10 +512,11 @@ extern int __isthreaded;
  * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
  * B.8.2.7 for the rationale behind the *_unlocked() macros.
  */
+#define	clearerr_unlocked(p)	__sclearerr(p)
 #define	feof_unlocked(p)	__sfeof(p)
 #define	ferror_unlocked(p)	__sferror(p)
-#define	clearerr_unlocked(p)	__sclearerr(p)
 #define	fileno_unlocked(p)	__sfileno(p)
+#define	fputc_unlocked(s, p)	__sputc(s, p)
 #endif
 #if __POSIX_VISIBLE >= 199506
 #define	getc_unlocked(fp)	__sgetc(fp)

Modified: projects/clang1000-import/lib/csu/Makefile.inc
==============================================================================
--- projects/clang1000-import/lib/csu/Makefile.inc	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/csu/Makefile.inc	Fri Jan 31 19:40:40 2020	(r357350)
@@ -8,7 +8,7 @@ NO_WMISSING_VARIABLE_DECLARATIONS=
 
 .include <src.opts.mk>
 
-.if ${MK_BSD_CRTBEGIN} != "no" && !defined(BUILDING_TESTS)
+.if !defined(BUILDING_TESTS)
 
 OBJS+=	crtbegin.o crtbeginS.o crtbeginT.o
 OBJS+=	crtend.o crtendS.o

Modified: projects/clang1000-import/lib/libc/amd64/string/memcmp.S
==============================================================================
--- projects/clang1000-import/lib/libc/amd64/string/memcmp.S	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/amd64/string/memcmp.S	Fri Jan 31 19:40:40 2020	(r357350)
@@ -45,7 +45,7 @@ ENTRY(memcmp)
 	movq	(%rdi),%r8
 	movq	(%rsi),%r9
 	cmpq	%r8,%r9
-	jne	1f
+	jne	80f
 	movq	-8(%rdi,%rdx),%r8
 	movq	-8(%rsi,%rdx),%r9
 	cmpq	%r8,%r9
@@ -54,34 +54,33 @@ ENTRY(memcmp)
 100408:
 	cmpb	$4,%dl
 	jl	100204f
-	movl	(%rsi),%r8d
-	movl	(%rdi),%r9d
+	movl	(%rdi),%r8d
+	movl	(%rsi),%r9d
 	cmpl	%r8d,%r9d
-	jne	1f
-	movl	-4(%rsi,%rdx),%r8d
-	movl	-4(%rdi,%rdx),%r9d
+	jne	80f
+	movl	-4(%rdi,%rdx),%r8d
+	movl	-4(%rsi,%rdx),%r9d
 	cmpl	%r8d,%r9d
-	jne	1f
+	jne	10040804f
 	ret
 100204:
 	cmpb	$2,%dl
 	jl	100001f
-	movzwl	(%rsi),%r8d
-	movzwl	(%rdi),%r9d
+	movzwl	(%rdi),%r8d
+	movzwl	(%rsi),%r9d
 	cmpl	%r8d,%r9d
 	jne	1f
-	movzwl	-2(%rsi,%rdx),%r8d
-	movzwl	-2(%rdi,%rdx),%r9d
+	movzwl	-2(%rdi,%rdx),%r8d
+	movzwl	-2(%rsi,%rdx),%r9d
 	cmpl	%r8d,%r9d
 	jne	1f
 	ret
 100001:
 	cmpb	$1,%dl
 	jl	100000f
-	movzbl	(%rdi),%r8d
-	movzbl	(%rsi),%r9d
-	cmpb	%r8b,%r9b
-	jne	1f
+	movzbl	(%rdi),%eax
+	movzbl	(%rsi),%r8d
+	subl	%r8d,%eax
 100000:
 	ret
 ALIGN_TEXT
@@ -91,11 +90,11 @@ ALIGN_TEXT
 	movq	(%rdi),%r8
 	movq	(%rsi),%r9
 	cmpq	%r8,%r9
-	jne	1f
+	jne	80f
 	movq	8(%rdi),%r8
 	movq	8(%rsi),%r9
 	cmpq	%r8,%r9
-	jne	 10163208f
+	jne	10163208f
 	movq	-16(%rdi,%rdx),%r8
 	movq	-16(%rsi,%rdx),%r9
 	cmpq	%r8,%r9
@@ -111,14 +110,14 @@ ALIGN_TEXT
 	movq	8(%rdi),%r9
 	subq	(%rsi),%r8
 	subq	8(%rsi),%r9
-	or	%r8,%r9
+	orq	%r8,%r9
 	jnz	10320000f
 
 	movq    16(%rdi),%r8
 	movq    24(%rdi),%r9
 	subq    16(%rsi),%r8
 	subq    24(%rsi),%r9
-	or      %r8,%r9
+	orq	%r8,%r9
 	jnz     10320016f
 
 	leaq	32(%rdi),%rdi
@@ -130,40 +129,57 @@ ALIGN_TEXT
 	jne	10b
 	ret
 
+/*
+ * Mismatch was found.
+ *
+ * Before we compute it we narrow down the range (16 -> 8 -> 4 bytes).
+ */
+ALIGN_TEXT
 10320016:
 	leaq	16(%rdi),%rdi
 	leaq	16(%rsi),%rsi
 10320000:
-/*
- * Mismatch was found within a 16 bytes range. The part of the routine
- * which calculates it only operates on sizes up to 8 bytes. Find the
- * right part.
- */
 	movq	(%rdi),%r8
 	movq	(%rsi),%r9
 	cmpq	%r8,%r9
-	jne	1f
+	jne	80f
 	leaq	8(%rdi),%rdi
 	leaq	8(%rsi),%rsi
-	jmp	1f
+	jmp	80f
+ALIGN_TEXT
+10081608:
 10163224:
 	leaq	-8(%rdi,%rdx),%rdi
 	leaq	-8(%rsi,%rdx),%rsi
-	jmp	1f
+	jmp	80f
+ALIGN_TEXT
 10163216:
 	leaq	-16(%rdi,%rdx),%rdi
 	leaq	-16(%rsi,%rdx),%rsi
-	jmp	1f
+	jmp	80f
+ALIGN_TEXT
 10163208:
-10081608:
 	leaq	8(%rdi),%rdi
 	leaq	8(%rsi),%rsi
+	jmp	80f
+ALIGN_TEXT
+10040804:
+	leaq	-4(%rdi,%rdx),%rdi
+	leaq	-4(%rsi,%rdx),%rsi
 	jmp	1f
 
+ALIGN_TEXT
+80:
+	movl	(%rdi),%r8d
+	movl	(%rsi),%r9d
+	cmpl	%r8d,%r9d
+	jne	1f
+	leaq	4(%rdi),%rdi
+	leaq	4(%rsi),%rsi
+
 /*
- * Mismatch was found. We have no more than 8 bytes to inspect.
+ * We have up to 4 bytes to inspect.
  */
-ALIGN_TEXT
 1:
 	movzbl	(%rdi),%eax
 	movzbl	(%rsi),%r8d
@@ -182,31 +198,6 @@ ALIGN_TEXT
 
 	movzbl	3(%rdi),%eax
 	movzbl	3(%rsi),%r8d
-	cmpb	%r8b,%al
-	jne	2f
-
-	movzbl	4(%rdi),%eax
-	movzbl	4(%rsi),%r8d
-	cmpb	%r8b,%al
-	jne	2f
-
-	movzbl	5(%rdi),%eax
-	movzbl	5(%rsi),%r8d
-	cmpb	%r8b,%al
-	jne	2f
-
-	movzbl	6(%rdi),%eax
-	movzbl	6(%rsi),%r8d
-	cmpb	%r8b,%al
-	jne	2f
-
-	movzbl	7(%rdi),%eax
-	movzbl	7(%rsi),%r8d
-	cmpb	%r8b,%al
-	jne	2f
-
-	xorl	%eax,%eax
-	ret
 2:
 	subl	%r8d,%eax
 	ret

Modified: projects/clang1000-import/lib/libc/stdio/Makefile.inc
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/Makefile.inc	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/Makefile.inc	Fri Jan 31 19:40:40 2020	(r357350)
@@ -48,13 +48,17 @@ MLINKS+=ferror.3 ferror_unlocked.3 \
 	ferror.3 clearerr.3 ferror.3 clearerr_unlocked.3 \
 	ferror.3 feof.3 ferror.3 feof_unlocked.3 \
 	ferror.3 fileno.3 ferror.3 fileno_unlocked.3
-MLINKS+=fflush.3 fpurge.3
+MLINKS+=fflush.3 fflush_unlocked.3 \
+	fflush.3 fpurge.3
 MLINKS+=fgets.3 gets.3
 MLINKS+=fgets.3 gets_s.3
 MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3
 MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 fopen.3 fmemopen.3
-MLINKS+=fputs.3 puts.3
-MLINKS+=fread.3 fwrite.3
+MLINKS+=fputs.3 fputs_unlocked.3 \
+	fputs.3 puts.3
+MLINKS+=fread.3 fread_unlocked.3 \
+	fread.3 fwrite.3 \
+	fread.3 fwrite_unlocked.3
 MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \
 	fseek.3 ftello.3 fseek.3 rewind.3
 MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3

Modified: projects/clang1000-import/lib/libc/stdio/Symbol.map
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/Symbol.map	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/Symbol.map	Fri Jan 31 19:40:40 2020	(r357350)
@@ -172,6 +172,10 @@ FBSD_1.5 {
 };
 
 FBSD_1.6 {
+	fflush_unlocked;
+	fputs_unlocked;
+	fread_unlocked;
+	fwrite_unlocked;
 	mkostempsat;
 };
 

Modified: projects/clang1000-import/lib/libc/stdio/fflush.3
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/fflush.3	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/fflush.3	Fri Jan 31 19:40:40 2020	(r357350)
@@ -32,11 +32,12 @@
 .\"     @(#)fflush.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd December 25, 2017
+.Dd January 23, 2020
 .Dt FFLUSH 3
 .Os
 .Sh NAME
 .Nm fflush ,
+.Nm fflush_unlocked ,
 .Nm fpurge
 .Nd flush a stream
 .Sh LIBRARY
@@ -46,6 +47,8 @@
 .Ft int
 .Fn fflush "FILE *stream"
 .Ft int
+.Fn fflush_unlocked "FILE *stream"
+.Ft int
 .Fn fpurge "FILE *stream"
 .Sh DESCRIPTION
 The function
@@ -63,6 +66,16 @@ argument is
 flushes
 .Em all
 open output streams.
+.Pp
+The
+.Fn fflush_unlocked
+function is equivalent to
+.Fn fflush ,
+except that the caller is responsible for locking the stream with
+.Xr flockfile 3
+before calling it.
+This function may be used to avoid the overhead of locking the stream and to
+prevent races when multiple threads are operating on the same stream.
 .Pp
 The function
 .Fn fpurge

Modified: projects/clang1000-import/lib/libc/stdio/fflush.c
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/fflush.c	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/fflush.c	Fri Jan 31 19:40:40 2020	(r357350)
@@ -100,6 +100,8 @@ __fflush(FILE *fp)
 	return (retval);
 }
 
+__weak_reference(__fflush, fflush_unlocked);
+
 int
 __sflush(FILE *fp)
 {

Modified: projects/clang1000-import/lib/libc/stdio/fputc.c
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/fputc.c	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/fputc.c	Fri Jan 31 19:40:40 2020	(r357350)
@@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$");
 #include "local.h"
 #include "libc_private.h"
 
+#undef fputc_unlocked
+
 int
 fputc(int c, FILE *fp)
 {

Modified: projects/clang1000-import/lib/libc/stdio/fputs.3
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/fputs.3	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/fputs.3	Fri Jan 31 19:40:40 2020	(r357350)
@@ -32,11 +32,12 @@
 .\"     @(#)fputs.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd January 23, 2020
 .Dt FPUTS 3
 .Os
 .Sh NAME
 .Nm fputs ,
+.Nm fputs_unlocked ,
 .Nm puts
 .Nd output a line to a stream
 .Sh LIBRARY
@@ -46,6 +47,8 @@
 .Ft int
 .Fn fputs "const char *str" "FILE *stream"
 .Ft int
+.Fn fputs_unlocked "const char *str" "FILE *stream"
+.Ft int
 .Fn puts "const char *str"
 .Sh DESCRIPTION
 The function
@@ -57,6 +60,16 @@ to the stream pointed to by
 .\" The terminating
 .\" .Dv NUL
 .\" character is not written.
+.Pp
+The
+.Fn fputs_unlocked
+function is equivalent to
+.Fn fputs ,
+except that the caller is responsible for locking the stream with
+.Xr flockfile 3
+before calling it.
+This function may be used to avoid the overhead of locking the stream and to
+prevent races when multiple threads are operating on the same stream.
 .Pp
 The function
 .Fn puts

Modified: projects/clang1000-import/lib/libc/stdio/fputs.c
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/fputs.c	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/fputs.c	Fri Jan 31 19:40:40 2020	(r357350)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
  * Write the given string to the given file.
  */
 int
-fputs(const char * __restrict s, FILE * __restrict fp)
+fputs_unlocked(const char * __restrict s, FILE * __restrict fp)
 {
 	int retval;
 	struct __suio uio;
@@ -61,11 +61,20 @@ fputs(const char * __restrict s, FILE * __restrict fp)
 	uio.uio_resid = iov.iov_len = strlen(s);
 	uio.uio_iov = &iov;
 	uio.uio_iovcnt = 1;
-	FLOCKFILE_CANCELSAFE(fp);
 	ORIENT(fp, -1);
 	retval = __sfvwrite(fp, &uio);
-	FUNLOCKFILE_CANCELSAFE();
 	if (retval == 0)
 		return (iov.iov_len > INT_MAX ? INT_MAX : iov.iov_len);
+	return (retval);
+}
+
+int
+fputs(const char * __restrict s, FILE * __restrict fp)
+{
+	int retval;
+
+	FLOCKFILE_CANCELSAFE(fp);
+	retval = fputs_unlocked(s, fp);
+	FUNLOCKFILE_CANCELSAFE();
 	return (retval);
 }

Modified: projects/clang1000-import/lib/libc/stdio/fread.3
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/fread.3	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/fread.3	Fri Jan 31 19:40:40 2020	(r357350)
@@ -32,12 +32,14 @@
 .\"     @(#)fread.3	8.2 (Berkeley) 3/8/94
 .\" $FreeBSD$
 .\"
-.Dd March 8, 1994
+.Dd January 23, 2020
 .Dt FREAD 3
 .Os
 .Sh NAME
 .Nm fread ,
-.Nm fwrite
+.Nm fread_unlocked ,
+.Nm fwrite ,
+.Nm fwrite_unlocked
 .Nd binary stream input/output
 .Sh LIBRARY
 .Lb libc
@@ -46,7 +48,11 @@
 .Ft size_t
 .Fn fread "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream"
 .Ft size_t
+.Fn fread_unlocked "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream"
+.Ft size_t
 .Fn fwrite "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream"
+.Ft size_t
+.Fn fwrite_unlocked "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream"
 .Sh DESCRIPTION
 The function
 .Fn fread
@@ -69,6 +75,21 @@ bytes long, to the stream pointed to by
 .Fa stream ,
 obtaining them from the location given by
 .Fa ptr .
+.Pp
+The
+.Fn fread_unlocked
+and
+.Fn fwrite_unlocked
+functions are equivalent to
+.Fn fread
+and
+.Fn fwrite
+respectively, except that the caller is responsible for locking the stream
+with
+.Xr flockfile 3
+before calling them.
+These functions may be used to avoid the overhead of locking the stream
+and to prevent races when multiple threads are operating on the same stream.
 .Sh RETURN VALUES
 The functions
 .Fn fread

Modified: projects/clang1000-import/lib/libc/stdio/fread.c
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/fread.c	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/fread.c	Fri Jan 31 19:40:40 2020	(r357350)
@@ -115,3 +115,5 @@ __fread(void * __restrict buf, size_t size, size_t cou
 	fp->_p += resid;
 	return (count);
 }
+
+__weak_reference(__fread, fread_unlocked);

Modified: projects/clang1000-import/lib/libc/stdio/fwrite.c
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/fwrite.c	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/fwrite.c	Fri Jan 31 19:40:40 2020	(r357350)
@@ -52,7 +52,8 @@ __FBSDID("$FreeBSD$");
  * Return the number of whole objects written.
  */
 size_t
-fwrite(const void * __restrict buf, size_t size, size_t count, FILE * __restrict fp)
+fwrite_unlocked(const void * __restrict buf, size_t size, size_t count,
+    FILE * __restrict fp)
 {
 	size_t n;
 	struct __suio uio;
@@ -84,7 +85,6 @@ fwrite(const void * __restrict buf, size_t size, size_
 	uio.uio_iov = &iov;
 	uio.uio_iovcnt = 1;
 
-	FLOCKFILE_CANCELSAFE(fp);
 	ORIENT(fp, -1);
 	/*
 	 * The usual case is success (__sfvwrite returns 0);
@@ -93,6 +93,17 @@ fwrite(const void * __restrict buf, size_t size, size_
 	 */
 	if (__sfvwrite(fp, &uio) != 0)
 	    count = (n - uio.uio_resid) / size;
-	FUNLOCKFILE_CANCELSAFE();
 	return (count);
+}
+
+size_t
+fwrite(const void * __restrict buf, size_t size, size_t count,
+    FILE * __restrict fp)
+{
+	size_t n;
+
+	FLOCKFILE_CANCELSAFE(fp);
+	n = fwrite_unlocked(buf, size, count, fp);
+	FUNLOCKFILE_CANCELSAFE();
+	return (n);
 }

Modified: projects/clang1000-import/lib/libc/stdio/putc.3
==============================================================================
--- projects/clang1000-import/lib/libc/stdio/putc.3	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libc/stdio/putc.3	Fri Jan 31 19:40:40 2020	(r357350)
@@ -32,11 +32,12 @@
 .\"     @(#)putc.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd January 10, 2003
+.Dd January 23, 2020
 .Dt PUTC 3
 .Os
 .Sh NAME
 .Nm fputc ,
+.Nm fputc_unlocked ,
 .Nm putc ,
 .Nm putc_unlocked ,
 .Nm putchar ,
@@ -50,6 +51,8 @@
 .Ft int
 .Fn fputc "int c" "FILE *stream"
 .Ft int
+.Fn fputc_unlocked "int c" "FILE *stream"
+.Ft int
 .Fn putc "int c" "FILE *stream"
 .Ft int
 .Fn putc_unlocked "int c" "FILE *stream"
@@ -97,11 +100,13 @@ to the named output
 .Fa stream .
 .Pp
 The
-.Fn putc_unlocked
+.Fn fputc_unlocked ,
+.Fn putc_unlocked ,
 and
 .Fn putchar_unlocked
 functions are equivalent to
-.Fn putc
+.Fn fputc ,
+.Fn putc ,
 and
 .Fn putchar
 respectively,

Modified: projects/clang1000-import/lib/libusb/libusb10_hotplug.c
==============================================================================
--- projects/clang1000-import/lib/libusb/libusb10_hotplug.c	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/lib/libusb/libusb10_hotplug.c	Fri Jan 31 19:40:40 2020	(r357350)
@@ -123,8 +123,10 @@ libusb_hotplug_scan(void *arg)
 		TAILQ_INIT(&hotplug_devs);
 
 		if (ctx->hotplug_handler != NO_THREAD) {
-			if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0)
+			if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0) {
+				HOTPLUG_UNLOCK(ctx);
 				continue;
+			}
 		} else {
 			do_loop = 0;
 		}

Modified: projects/clang1000-import/release/arm64/RPI3.conf
==============================================================================
--- projects/clang1000-import/release/arm64/RPI3.conf	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/release/arm64/RPI3.conf	Fri Jan 31 19:40:40 2020	(r357350)
@@ -25,7 +25,9 @@ arm_install_uboot() {
 	UBOOT_FILES="README u-boot.bin"
 	DTB_FILES="armstub8.bin armstub8-gic.bin bootcode.bin fixup_cd.dat \
 		fixup_db.dat fixup_x.dat fixup.dat LICENCE.broadcom \
-		start_cd.elf start_db.elf start_x.elf start.elf ${DTB}"
+		start_cd.elf start_db.elf start_x.elf start.elf \
+		fixup4.dat fixup4cd.dat fixup4db.dat fixup4x.dat start4.elf \
+		start4cd.elf start4db.elf start4x.elf ${DTB}"
 	FATMOUNT="${DESTDIR%${KERNEL}}fat"
 	chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}"
 	chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}

Modified: projects/clang1000-import/release/packages/binutils.ucl
==============================================================================
--- projects/clang1000-import/release/packages/binutils.ucl	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/release/packages/binutils.ucl	Fri Jan 31 19:40:40 2020	(r357350)
@@ -15,10 +15,4 @@ licenses = [ GPLv2 ]
 desc = <<EOD
 %DESC%
 EOD
-deps: {
-    FreeBSD-%PKGDEPS%: {
-        origin: "base",
-        version: "%VERSION%"
-    }
-}
 

Modified: projects/clang1000-import/release/packages/caroot.ucl
==============================================================================
--- projects/clang1000-import/release/packages/caroot.ucl	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/release/packages/caroot.ucl	Fri Jan 31 19:40:40 2020	(r357350)
@@ -15,12 +15,6 @@ licenses = [ BSD2CLAUSE ]
 desc = <<EOD
 %DESC%
 EOD
-deps: {
-    FreeBSD-%PKGDEPS%: {
-        origin: "base",
-        version: "%VERSION%"
-    }
-}
 scripts: {
 	# XXX If pkg picks up a mechanism to detect in the post-install script
 	# files being added or removed, we should use it instead to gate the

Modified: projects/clang1000-import/release/packages/clang.ucl
==============================================================================
--- projects/clang1000-import/release/packages/clang.ucl	Fri Jan 31 19:36:14 2020	(r357349)
+++ projects/clang1000-import/release/packages/clang.ucl	Fri Jan 31 19:40:40 2020	(r357350)
@@ -15,10 +15,4 @@ licenses = [ NCSA ]

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list