Date: Wed, 4 Jan 2017 20:41:43 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r311306 - in projects/clang400-import: . contrib/bsnmp/lib contrib/bsnmp/snmp_mibII contrib/bsnmp/snmpd contrib/netbsd-tests/fs/tmpfs contrib/netbsd-tests/lib/libc/c063 contrib/netbsd-t... Message-ID: <201701042041.v04KfhdJ081882@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Wed Jan 4 20:41:43 2017 New Revision: 311306 URL: https://svnweb.freebsd.org/changeset/base/311306 Log: Merge ^/head r311132 through r311305. Added: - copied from r311305, head/contrib/zlib/ projects/clang400-import/sys/arm/allwinner/a33/ - copied from r311305, head/sys/arm/allwinner/a33/ projects/clang400-import/sys/dev/cxgbe/firmware/t4fw-1.16.26.0.bin.uu - copied unchanged from r311305, head/sys/dev/cxgbe/firmware/t4fw-1.16.26.0.bin.uu projects/clang400-import/sys/dev/cxgbe/firmware/t5fw-1.16.26.0.bin.uu - copied unchanged from r311305, head/sys/dev/cxgbe/firmware/t5fw-1.16.26.0.bin.uu projects/clang400-import/sys/dev/cxgbe/firmware/t6fw-1.16.26.0.bin.uu - copied unchanged from r311305, head/sys/dev/cxgbe/firmware/t6fw-1.16.26.0.bin.uu projects/clang400-import/tools/build/options/WITHOUT_EFI - copied unchanged from r311305, head/tools/build/options/WITHOUT_EFI projects/clang400-import/tools/build/options/WITH_EFI - copied unchanged from r311305, head/tools/build/options/WITH_EFI projects/clang400-import/tools/build/options/WITH_SSP - copied unchanged from r311305, head/tools/build/options/WITH_SSP Directory Properties: projects/clang400-import/contrib/zlib/ (props changed) Deleted: projects/clang400-import/lib/libz/ChangeLog projects/clang400-import/lib/libz/FAQ projects/clang400-import/lib/libz/README projects/clang400-import/lib/libz/adler32.c projects/clang400-import/lib/libz/compress.c projects/clang400-import/lib/libz/contrib/ projects/clang400-import/lib/libz/crc32.c projects/clang400-import/lib/libz/crc32.h projects/clang400-import/lib/libz/deflate.c projects/clang400-import/lib/libz/deflate.h projects/clang400-import/lib/libz/doc/ projects/clang400-import/lib/libz/gzclose.c projects/clang400-import/lib/libz/gzguts.h projects/clang400-import/lib/libz/gzlib.c projects/clang400-import/lib/libz/gzread.c projects/clang400-import/lib/libz/gzwrite.c projects/clang400-import/lib/libz/infback.c projects/clang400-import/lib/libz/inffast.c projects/clang400-import/lib/libz/inffast.h projects/clang400-import/lib/libz/inffixed.h projects/clang400-import/lib/libz/inflate.c projects/clang400-import/lib/libz/inflate.h projects/clang400-import/lib/libz/inftrees.c projects/clang400-import/lib/libz/inftrees.h projects/clang400-import/lib/libz/test/ projects/clang400-import/lib/libz/trees.c projects/clang400-import/lib/libz/trees.h projects/clang400-import/lib/libz/uncompr.c projects/clang400-import/lib/libz/zconf.h projects/clang400-import/lib/libz/zlib.3 projects/clang400-import/lib/libz/zlib.h projects/clang400-import/lib/libz/zutil.c projects/clang400-import/lib/libz/zutil.h projects/clang400-import/sys/boot/fdt/dts/arm/ubmc.dtsi projects/clang400-import/sys/dev/cxgbe/firmware/t4fw-1.16.22.0.bin.uu projects/clang400-import/sys/dev/cxgbe/firmware/t5fw-1.16.22.0.bin.uu projects/clang400-import/sys/dev/cxgbe/firmware/t6fw-1.16.22.0.bin.uu Modified: projects/clang400-import/Makefile.inc1 projects/clang400-import/ObsoleteFiles.inc projects/clang400-import/contrib/bsnmp/lib/snmpclient.c projects/clang400-import/contrib/bsnmp/snmp_mibII/snmp_mibII.3 projects/clang400-import/contrib/bsnmp/snmpd/trans_udp.c projects/clang400-import/contrib/netbsd-tests/fs/tmpfs/h_tools.c projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_dir.c projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_ftok.c projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c projects/clang400-import/contrib/netbsd-tests/lib/libc/string/t_strchr.c projects/clang400-import/contrib/netbsd-tests/lib/libc/string/t_strlen.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_kevent.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_listen.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_mincore.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_mmap.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_pipe.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_revoke.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_select.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_stat.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_umask.c projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_unlink.c projects/clang400-import/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_condwait.c projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_fpu.c projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c projects/clang400-import/lib/libc/x86/sys/__vdso_gettc.c projects/clang400-import/lib/libstand/Makefile projects/clang400-import/lib/libsysdecode/Makefile projects/clang400-import/lib/libsysdecode/flags.c projects/clang400-import/lib/libsysdecode/mktables projects/clang400-import/lib/libsysdecode/sysdecode.h projects/clang400-import/lib/libsysdecode/sysdecode_enum.3 projects/clang400-import/lib/libsysdecode/sysdecode_mask.3 projects/clang400-import/lib/libz/FREEBSD-upgrade projects/clang400-import/lib/libz/Makefile projects/clang400-import/lib/libz/Symbol.map projects/clang400-import/lib/libz/Versions.def projects/clang400-import/lib/libz/zlib.pc projects/clang400-import/sbin/dhclient/dispatch.c projects/clang400-import/secure/lib/libssh/Makefile projects/clang400-import/secure/usr.bin/ssh/Makefile projects/clang400-import/secure/usr.sbin/sshd/Makefile projects/clang400-import/share/man/man5/src.conf.5 projects/clang400-import/share/man/man9/atomic.9 projects/clang400-import/share/mk/src.opts.mk projects/clang400-import/sys/amd64/include/atomic.h projects/clang400-import/sys/arm/allwinner/a10_gpio.c projects/clang400-import/sys/arm/allwinner/aw_ccu.c projects/clang400-import/sys/arm/allwinner/aw_machdep.c projects/clang400-import/sys/arm/allwinner/aw_machdep.h projects/clang400-import/sys/arm/allwinner/clk/aw_axiclk.c projects/clang400-import/sys/arm/allwinner/clk/aw_gate.c projects/clang400-import/sys/arm/conf/GENERIC projects/clang400-import/sys/arm/include/atomic.h projects/clang400-import/sys/boot/fdt/dts/arm/ufw.dts projects/clang400-import/sys/cam/cam_xpt.c projects/clang400-import/sys/cam/ctl/ctl_frontend_cam_sim.c projects/clang400-import/sys/cam/ctl/ctl_frontend_iscsi.c projects/clang400-import/sys/cam/scsi/scsi_low.c projects/clang400-import/sys/cddl/compat/opensolaris/sys/atomic.h projects/clang400-import/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h projects/clang400-import/sys/conf/files projects/clang400-import/sys/conf/options.arm projects/clang400-import/sys/dev/aac/aac_cam.c projects/clang400-import/sys/dev/aacraid/aacraid_cam.c projects/clang400-import/sys/dev/advansys/advansys.c projects/clang400-import/sys/dev/advansys/adwcam.c projects/clang400-import/sys/dev/aha/aha.c projects/clang400-import/sys/dev/ahb/ahb.c projects/clang400-import/sys/dev/ahci/ahci.c projects/clang400-import/sys/dev/ahci/ahciem.c projects/clang400-import/sys/dev/aic/aic.c projects/clang400-import/sys/dev/aic7xxx/aic79xx_osm.c projects/clang400-import/sys/dev/aic7xxx/aic7xxx_osm.c projects/clang400-import/sys/dev/amr/amr_cam.c projects/clang400-import/sys/dev/arcmsr/arcmsr.c projects/clang400-import/sys/dev/ata/ata-all.c projects/clang400-import/sys/dev/buslogic/bt.c projects/clang400-import/sys/dev/ciss/ciss.c projects/clang400-import/sys/dev/cxgbe/firmware/t4fw_interface.h projects/clang400-import/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt projects/clang400-import/sys/dev/cxgbe/firmware/t6fw_cfg.txt projects/clang400-import/sys/dev/cxgbe/firmware/t6fw_cfg_uwire.txt projects/clang400-import/sys/dev/dpt/dpt_scsi.c projects/clang400-import/sys/dev/esp/ncr53c9x.c projects/clang400-import/sys/dev/firewire/sbp.c projects/clang400-import/sys/dev/firewire/sbp_targ.c projects/clang400-import/sys/dev/hpt27xx/hpt27xx_osm_bsd.c projects/clang400-import/sys/dev/hptiop/hptiop.c projects/clang400-import/sys/dev/hptmv/entry.c projects/clang400-import/sys/dev/hptnr/hptnr_osm_bsd.c projects/clang400-import/sys/dev/hptrr/hptrr_osm_bsd.c projects/clang400-import/sys/dev/hwpmc/hwpmc_core.c projects/clang400-import/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c projects/clang400-import/sys/dev/iir/iir.c projects/clang400-import/sys/dev/isci/isci_controller.c projects/clang400-import/sys/dev/iscsi_initiator/isc_cam.c projects/clang400-import/sys/dev/isp/isp_freebsd.c projects/clang400-import/sys/dev/ixl/ixl_pf_main.c projects/clang400-import/sys/dev/mfi/mfi_cam.c projects/clang400-import/sys/dev/mly/mly.c projects/clang400-import/sys/dev/mpr/mpr_sas.c projects/clang400-import/sys/dev/mpr/mpr_sas_lsi.c projects/clang400-import/sys/dev/mps/mps_sas.c projects/clang400-import/sys/dev/mpt/mpt_cam.c projects/clang400-import/sys/dev/mrsas/mrsas_cam.c projects/clang400-import/sys/dev/mvs/mvs.c projects/clang400-import/sys/dev/ncr/ncr.c projects/clang400-import/sys/dev/nvme/nvme_sim.c projects/clang400-import/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c projects/clang400-import/sys/dev/ppbus/vpo.c projects/clang400-import/sys/dev/rtwn/if_rtwnvar.h projects/clang400-import/sys/dev/siis/siis.c projects/clang400-import/sys/dev/sym/sym_hipd.c projects/clang400-import/sys/dev/trm/trm.c projects/clang400-import/sys/dev/twa/tw_osl_cam.c projects/clang400-import/sys/dev/tws/tws_cam.c projects/clang400-import/sys/dev/virtio/scsi/virtio_scsi.c projects/clang400-import/sys/dev/xen/netfront/netfront.c projects/clang400-import/sys/kern/kern_mutex.c projects/clang400-import/sys/kern/vfs_lookup.c projects/clang400-import/sys/kern/vfs_syscalls.c projects/clang400-import/sys/mips/conf/JZ4780 projects/clang400-import/sys/modules/cxgbe/t4_firmware/Makefile projects/clang400-import/sys/modules/cxgbe/t5_firmware/Makefile projects/clang400-import/sys/modules/cxgbe/t6_firmware/Makefile projects/clang400-import/sys/net80211/_ieee80211.h projects/clang400-import/sys/netinet/tcp_input.c projects/clang400-import/sys/netinet/tcp_output.c projects/clang400-import/sys/netinet/tcp_stacks/fastpath.c projects/clang400-import/sys/netinet/tcp_subr.c projects/clang400-import/sys/powerpc/ps3/ps3cdrom.c projects/clang400-import/sys/powerpc/pseries/phyp_vscsi.c projects/clang400-import/sys/sys/eventhandler.h projects/clang400-import/sys/sys/mutex.h projects/clang400-import/sys/vm/swap_pager.c projects/clang400-import/sys/vm/swap_pager.h projects/clang400-import/sys/vm/vm_page.c projects/clang400-import/sys/vm/vm_page.h projects/clang400-import/sys/vm/vm_pageout.c projects/clang400-import/usr.bin/chat/chat.c projects/clang400-import/usr.bin/indent/args.c projects/clang400-import/usr.bin/indent/indent.1 projects/clang400-import/usr.bin/indent/indent.c projects/clang400-import/usr.bin/indent/indent.h projects/clang400-import/usr.bin/kdump/kdump.c projects/clang400-import/usr.bin/minigzip/Makefile projects/clang400-import/usr.bin/rpcgen/rpc_parse.c projects/clang400-import/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c projects/clang400-import/usr.sbin/bsnmpd/tools/Makefile projects/clang400-import/usr.sbin/bsnmpd/tools/bsnmptools/Makefile projects/clang400-import/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c projects/clang400-import/usr.sbin/bsnmpd/tools/libbsnmptools/Makefile projects/clang400-import/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c projects/clang400-import/usr.sbin/diskinfo/diskinfo.c Directory Properties: projects/clang400-import/ (props changed) projects/clang400-import/contrib/netbsd-tests/ (props changed) projects/clang400-import/sys/cddl/contrib/opensolaris/ (props changed) Modified: projects/clang400-import/Makefile.inc1 ============================================================================== --- projects/clang400-import/Makefile.inc1 Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/Makefile.inc1 Wed Jan 4 20:41:43 2017 (r311306) @@ -2156,7 +2156,7 @@ secure/lib/libssh__L: lib/libz__L secure .if ${MK_LDNS} != "no" secure/lib/libssh__L: lib/libldns__L .endif -.if ${MK_KERBEROS_SUPPORT} != "no" +.if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no" secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ lib/libmd__L kerberos5/lib/libroken__L Modified: projects/clang400-import/ObsoleteFiles.inc ============================================================================== --- projects/clang400-import/ObsoleteFiles.inc Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/ObsoleteFiles.inc Wed Jan 4 20:41:43 2017 (r311306) @@ -38,6 +38,13 @@ # xargs -n1 | sort | uniq -d; # done +# 20170103: libbsnmptools.so made into an INTERNALLIB +OLD_FILES+=usr/lib/libbsnmptools.a +OLD_FILES+=usr/lib/libbsnmptools_p.a +OLD_LIBS+=usr/lib/libbsnmptools.so.0 +OLD_LIBS+=usr/lib/libbsnmptools.so +# 20170102: sysdecode_getfsstat_flags() renamed to sysdecode_getfsstat_mode() +OLD_FILES+=usr/share/man/man3/sysdecode_getfsstat_flags.3.gz # 20161230: libarchive ACL pax test renamed to test_acl_pax_posix1e.tar.uu OLD_FILES+=usr/tests/lib/libarchive/test_acl_pax.tar.uu # 20161229: Three files from gnop tests consolidated into one Modified: projects/clang400-import/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- projects/clang400-import/contrib/bsnmp/lib/snmpclient.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/bsnmp/lib/snmpclient.c Wed Jan 4 20:41:43 2017 (r311306) @@ -1231,7 +1231,7 @@ snmp_send_packet(struct snmp_pdu * pdu) struct asn_buf b; ssize_t ret; - if ((buf = malloc(snmp_client.txbuflen)) == NULL) { + if ((buf = calloc(1, snmp_client.txbuflen)) == NULL) { seterr(&snmp_client, "%s", strerror(errno)); return (-1); } @@ -1256,7 +1256,7 @@ snmp_send_packet(struct snmp_pdu * pdu) } free(buf); - return pdu->request_id; + return (pdu->request_id); } /* @@ -1352,7 +1352,7 @@ snmp_receive_packet(struct snmp_pdu *pdu socklen_t optlen; #endif - if ((buf = malloc(snmp_client.rxbuflen)) == NULL) { + if ((buf = calloc(1, snmp_client.rxbuflen)) == NULL) { seterr(&snmp_client, "%s", strerror(errno)); return (-1); } Modified: projects/clang400-import/contrib/bsnmp/snmp_mibII/snmp_mibII.3 ============================================================================== --- projects/clang400-import/contrib/bsnmp/snmp_mibII/snmp_mibII.3 Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/bsnmp/snmp_mibII/snmp_mibII.3 Wed Jan 4 20:41:43 2017 (r311306) @@ -31,7 +31,7 @@ .\" .\" $Begemot: bsnmp/snmp_mibII/snmp_mibII.3,v 1.10 2005/10/04 08:46:52 brandt_h Exp $ .\" -.Dd October 4, 2005 +.Dd January 4, 2017 .Dt SNMP_MIBII 3 .Os .Sh NAME @@ -63,6 +63,8 @@ .Sh LIBRARY .Pq begemotSnmpdModulePath."mibII" = "@MODPATH@snmp_mibII.so" .Sh SYNOPSIS +.In net/if.h +.In net/if_mib.h .In bsnmp/snmpmod.h .In bsnmp/snmp_mibII.h .Ft typedef void Modified: projects/clang400-import/contrib/bsnmp/snmpd/trans_udp.c ============================================================================== --- projects/clang400-import/contrib/bsnmp/snmpd/trans_udp.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/bsnmp/snmpd/trans_udp.c Wed Jan 4 20:41:43 2017 (r311306) @@ -226,6 +226,7 @@ udp_send(struct tport *tp, const u_char iov.iov_base = __DECONST(void*, buf); iov.iov_len = len; + msg.msg_flags = 0; msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_name = __DECONST(void *, addr); Modified: projects/clang400-import/contrib/netbsd-tests/fs/tmpfs/h_tools.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/fs/tmpfs/h_tools.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/fs/tmpfs/h_tools.c Wed Jan 4 20:41:43 2017 (r311306) @@ -243,12 +243,19 @@ sockets_main(int argc, char **argv) return EXIT_FAILURE; } +#ifdef __FreeBSD__ + addr.sun_len = sizeof(addr.sun_path); + (void)strlcpy(addr.sun_path, argv[1], addr.sun_len); +#else (void)strlcpy(addr.sun_path, argv[1], sizeof(addr.sun_path)); +#endif addr.sun_family = PF_UNIX; - error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); if (error == -1) { warn("connect"); +#ifdef __FreeBSD__ + (void)close(fd); +#endif return EXIT_FAILURE; } Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c Wed Jan 4 20:41:43 2017 (r311306) @@ -70,6 +70,9 @@ ATF_TC_BODY(fexecve, tc) error = 76; else error = EXIT_FAILURE; +#ifdef __FreeBSD__ + (void)close(fd); +#endif err(error, "fexecve"); } } Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c Wed Jan 4 20:41:43 2017 (r311306) @@ -63,6 +63,9 @@ ATF_TC_BODY(mkfifoat_fd, tc) ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1); ATF_REQUIRE(close(fd) == 0); ATF_REQUIRE(access(FIFO, F_OK) == 0); +#ifdef __FreeBSD__ + (void)close(dfd); +#endif } ATF_TC(mkfifoat_fdcwd); Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c Wed Jan 4 20:41:43 2017 (r311306) @@ -80,6 +80,9 @@ ATF_TC_BODY(mknodat_fd, tc) ATF_REQUIRE((fd = mknodat(dfd, BASEFILE, mode, dev)) != -1); ATF_REQUIRE(close(fd) == 0); ATF_REQUIRE(access(FILE, F_OK) == 0); +#ifdef __FreeBSD__ + (void)close(dfd); +#endif } ATF_TC(mknodat_fdcwd); Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_dir.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_dir.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_dir.c Wed Jan 4 20:41:43 2017 (r311306) @@ -39,6 +39,10 @@ #include <sys/stat.h> +#ifdef __FreeBSD__ +#include <errno.h> +#endif + ATF_TC(seekdir_basic); ATF_TC_HEAD(seekdir_basic, tc) { @@ -54,10 +58,26 @@ ATF_TC_BODY(seekdir_basic, tc) struct dirent *entry; long here; +#ifdef __FreeBSD__ +#define CREAT(x, m) do { \ + int _creat_fd; \ + ATF_REQUIRE_MSG((_creat_fd = creat((x), (m))), \ + "creat(%s, %x) failed: %s", (x), (m), \ + strerror(errno)); \ + (void)close(_creat_fd); \ + } while(0); + + ATF_REQUIRE_MSG(mkdir("t", 0755) == 0, + "mkdir failed: %s", strerror(errno)); + CREAT("t/a", 0600); + CREAT("t/b", 0600); + CREAT("t/c", 0600); +#else mkdir("t", 0755); creat("t/a", 0600); creat("t/b", 0600); creat("t/c", 0600); +#endif dp = opendir("t"); if ( dp == NULL) @@ -70,9 +90,17 @@ ATF_TC_BODY(seekdir_basic, tc) /* get first entry */ entry = readdir(dp); here = telldir(dp); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(here != -1, + "telldir failed: %s", strerror(errno)); +#endif /* get second entry */ entry = readdir(dp); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(entry != NULL, + "readdir failed: %s", strerror(errno)); +#endif wasname = strdup(entry->d_name); if (wasname == NULL) atf_tc_fail("cannot allocate memory"); @@ -109,6 +137,9 @@ ATF_TC_BODY(seekdir_basic, tc) atf_tc_fail("3rd seekdir found wrong name"); closedir(dp); +#ifdef __FreeBSD__ + free(wasname); +#endif } /* There is no sbrk on AArch64 and RISC-V */ Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_ftok.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_ftok.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_ftok.c Wed Jan 4 20:41:43 2017 (r311306) @@ -68,6 +68,9 @@ ATF_TC_BODY(ftok_link, tc) fd = open(path, O_RDONLY | O_CREAT); ATF_REQUIRE(fd >= 0); +#ifdef __FreeBSD__ + (void)close(fd); +#endif ATF_REQUIRE(link(path, hlnk) == 0); ATF_REQUIRE(symlink(path, slnk) == 0); Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c Wed Jan 4 20:41:43 2017 (r311306) @@ -247,6 +247,9 @@ ATF_TC_BODY(humanize_number_basic, tc) newline(); atf_tc_fail_nonfatal("Failed for table entry %d", i); } +#ifdef __FreeBSD__ + free(buf); +#endif } ATF_TC(humanize_number_big); Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Wed Jan 4 20:41:43 2017 (r311306) @@ -78,6 +78,9 @@ ATF_TC_BODY(ttyname_err, tc) ATF_REQUIRE(ttyname(fd) == NULL); ATF_REQUIRE(errno == ENOTTY); +#ifdef __FreeBSD__ + (void)close(fd); +#endif } } Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/string/t_strchr.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/string/t_strchr.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/string/t_strchr.c Wed Jan 4 20:41:43 2017 (r311306) @@ -58,6 +58,9 @@ ATF_TC_HEAD(strchr_basic, tc) ATF_TC_BODY(strchr_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif unsigned int t, a; char *off; char buf[32]; @@ -245,8 +248,12 @@ ATF_TC_BODY(strchr_basic, tc) "abcdefgh/abcdefgh/", }; - +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strchr_fn = dlsym(dl_handle, "test_strlen"); +#else strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr"); +#endif if (!strchr_fn) strchr_fn = strchr; @@ -281,6 +288,9 @@ ATF_TC_BODY(strchr_basic, tc) verify_strchr(buf + a, 0xff, t, a); } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TP_ADD_TCS(tp) Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/string/t_strlen.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/string/t_strlen.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/string/t_strlen.c Wed Jan 4 20:41:43 2017 (r311306) @@ -40,6 +40,9 @@ ATF_TC_HEAD(strlen_basic, tc) ATF_TC_BODY(strlen_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif /* try to trick the compiler */ size_t (*strlen_fn)(const char *); @@ -107,7 +110,12 @@ ATF_TC_BODY(strlen_basic, tc) * During testing it is useful have the rest of the program * use a known good version! */ +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strlen_fn = dlsym(dl_handle, "test_strlen"); +#else strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen"); +#endif if (!strlen_fn) strlen_fn = strlen; @@ -134,6 +142,9 @@ ATF_TC_BODY(strlen_basic, tc) } } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TC(strlen_huge); Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_kevent.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Wed Jan 4 20:41:43 2017 (r311306) @@ -101,6 +101,9 @@ ATF_TC_BODY(kqueue_desc_passing, tc) m.msg_namelen = 0; m.msg_control = msg; m.msg_controllen = CMSG_SPACE(sizeof(int)); +#ifdef __FreeBSD__ + m.msg_flags = 0; +#endif child = fork(); if (child == 0) { Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_listen.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_listen.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_listen.c Wed Jan 4 20:41:43 2017 (r311306) @@ -110,6 +110,9 @@ ATF_TC_BODY(listen_low_port, tc) int sd, val; sd = socket(AF_INET, SOCK_STREAM, 0); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno)); +#endif val = IP_PORTRANGE_LOW; if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val, Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_mincore.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Wed Jan 4 20:41:43 2017 (r311306) @@ -279,6 +279,9 @@ ATF_TC_BODY(mincore_resid, tc) (void)munmap(addr2, npgs * page); (void)munmap(addr3, npgs * page); (void)unlink(path); +#ifdef __FreeBSD__ + free(buf); +#endif } ATF_TC_CLEANUP(mincore_resid, tc) Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_mmap.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_mmap.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_mmap.c Wed Jan 4 20:41:43 2017 (r311306) @@ -381,9 +381,13 @@ ATF_TC_BODY(mmap_prot_3, tc) * the access should generate SIGSEGV. */ fd = open(path, O_RDWR | O_CREAT, 0700); - if (fd < 0) +#ifdef __FreeBSD__ + atf_tc_skip("opening %s failed; skipping testcase: %s", + path, strerror(errno)); +#else return; +#endif ATF_REQUIRE(write(fd, "XXX", 3) == 3); ATF_REQUIRE(close(fd) == 0); @@ -409,6 +413,9 @@ ATF_TC_BODY(mmap_prot_3, tc) ATF_REQUIRE(WIFEXITED(sta) != 0); ATF_REQUIRE(WEXITSTATUS(sta) == SIGSEGV); ATF_REQUIRE(munmap(map, 3) == 0); +#ifdef __FreeBSD__ + (void)close(fd); +#endif } ATF_TC_CLEANUP(mmap_prot_3, tc) @@ -453,6 +460,9 @@ ATF_TC_BODY(mmap_truncate, tc) ATF_REQUIRE(ftruncate(fd, page / 12) == 0); ATF_REQUIRE(ftruncate(fd, page / 64) == 0); +#ifdef __FreeBSD__ + (void)munmap(map, page); +#endif ATF_REQUIRE(close(fd) == 0); } @@ -509,6 +519,10 @@ ATF_TC_BODY(mmap_truncate_signal, tc) prevent the access to be optimized out */ ATF_REQUIRE(i == 0); ATF_REQUIRE(sta == 0); +#ifdef __FreeBSD__ + (void)munmap(map, page); + (void)close(fd); +#endif return; } Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_pipe.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_pipe.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_pipe.c Wed Jan 4 20:41:43 2017 (r311306) @@ -153,6 +153,9 @@ ATF_TC_BODY(pipe_restart, tc) ATF_REQUIRE_EQ(WEXITSTATUS(st), 0); } +#ifdef __FreeBSD__ + free(f); +#endif } ATF_TP_ADD_TCS(tp) Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_revoke.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Wed Jan 4 20:41:43 2017 (r311306) @@ -176,6 +176,9 @@ ATF_TC_BODY(revoke_perm, tc) if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS) atf_tc_fail("revoke(2) did not obey permissions"); +#ifdef __FreeBSD__ + (void)close(fd); +#endif ATF_REQUIRE(unlink(path) == 0); } Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_select.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_select.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_select.c Wed Jan 4 20:41:43 2017 (r311306) @@ -135,6 +135,9 @@ child(const struct timespec *ts) "after timeout %s != %s", prmask(&nset, nbuf, sizeof(nbuf)), prmask(&oset, obuf, sizeof(obuf))); +#ifdef __FreeBSD__ + _exit(0); +#endif } ATF_TC(pselect_sigmask); @@ -154,6 +157,9 @@ ATF_TC_BODY(pselect_sigmask, tc) switch (pid = fork()) { case 0: child(NULL); +#ifdef __FreeBSD__ + break; +#endif case -1: err(1, "fork"); default: Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Wed Jan 4 20:41:43 2017 (r311306) @@ -129,6 +129,9 @@ out: if (lim != 0) atf_tc_fail("failed to set limit (%d)", lim); +#ifdef __FreeBSD__ + free(buf); +#endif } ATF_TC(setrlimit_current); Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_stat.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_stat.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_stat.c Wed Jan 4 20:41:43 2017 (r311306) @@ -398,6 +398,9 @@ ATF_TC_BODY(stat_symlink, tc) ATF_REQUIRE(unlink(path) == 0); ATF_REQUIRE(unlink(pathlink) == 0); +#ifdef __FreeBSD__ + (void)close(fd); +#endif } ATF_TC_CLEANUP(stat_symlink, tc) Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_umask.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_umask.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_umask.c Wed Jan 4 20:41:43 2017 (r311306) @@ -129,6 +129,9 @@ ATF_TC_BODY(umask_open, tc) if (fd < 0) continue; +#ifdef __FreeBSD__ + (void)close(fd); +#endif (void)memset(&st, 0, sizeof(struct stat)); if (stat(path, &st) != 0) { Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_unlink.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_unlink.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/sys/t_unlink.c Wed Jan 4 20:41:43 2017 (r311306) @@ -63,7 +63,12 @@ ATF_TC_BODY(unlink_basic, tc) ATF_REQUIRE(unlink(path) == 0); errno = 0; +#ifdef __FreeBSD__ + ATF_REQUIRE_ERRNO(ENOENT, (fd = open(path, O_RDONLY)) == -1); + (void)close(fd); +#else ATF_REQUIRE_ERRNO(ENOENT, open(path, O_RDONLY) == -1); +#endif } } @@ -111,12 +116,24 @@ ATF_TC_HEAD(unlink_fifo, tc) ATF_TC_BODY(unlink_fifo, tc) { +#ifdef __FreeBSD__ + int fd; + ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0, + "mkfifo failed: %s", strerror(errno)); + (void)close(fd); +#else ATF_REQUIRE(mkfifo(path, 0666) == 0); +#endif ATF_REQUIRE(unlink(path) == 0); errno = 0; +#ifdef __FreeBSD__ + ATF_REQUIRE_ERRNO(ENOENT, (fd = open(path, O_RDONLY)) == -1); + (void)close(fd); +#else ATF_REQUIRE_ERRNO(ENOENT, open(path, O_RDONLY) == -1); +#endif } ATF_TC_CLEANUP(unlink_fifo, tc) Modified: projects/clang400-import/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c Wed Jan 4 20:41:43 2017 (r311306) @@ -152,6 +152,9 @@ ATF_TC_BODY(ioctl, tc) REQUIRE_ERRNO(sigaction(SIGCHLD, &sa, NULL), -1); (void) wait(NULL); +#ifdef __FreeBSD__ + (void)close(s); +#endif ATF_REQUIRE_EQ(rc, 0); } Modified: projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_condwait.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_condwait.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_condwait.c Wed Jan 4 20:41:43 2017 (r311306) @@ -42,6 +42,8 @@ __RCSID("$NetBSD: t_condwait.c,v 1.4 201 #ifdef __FreeBSD__ #include <sys/time.h> + +#include "h_common.h" #endif #define WAITTIME 2 /* Timeout wait secound */ @@ -60,8 +62,13 @@ run(void *param) clck = *(clockid_t *)param; +#ifdef __FreeBSD__ + PTHREAD_REQUIRE(pthread_condattr_init(&attr)); + PTHREAD_REQUIRE(pthread_condattr_setclock(&attr, clck)); +#else pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, clck); /* MONOTONIC or MONOTONIC */ +#endif pthread_cond_init(&cond, &attr); ATF_REQUIRE_EQ((ret = pthread_mutex_lock(&m)), 0); Modified: projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_fpu.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_fpu.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_fpu.c Wed Jan 4 20:41:43 2017 (r311306) @@ -58,6 +58,11 @@ __RCSID("$NetBSD: t_fpu.c,v 1.2 2013/01/ #include <atf-c.h> +#ifdef __FreeBSD__ +#include <errno.h> +#include <string.h> +#endif + #include "h_common.h" #define N_RECURSE 10 @@ -77,14 +82,24 @@ stir(void *p) for (;;) { x = sin ((y = cos (x + y + .4)) - (z = cos (x + z + .6))); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(sched_yield() == 0, + "sched_yield failed: %s", strerror(errno)); +#else PTHREAD_REQUIRE(sched_yield()); +#endif } } static double mul3(double x, double y, double z) { +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(sched_yield() == 0, + "sched_yield failed: %s", strerror(errno)); +#else PTHREAD_REQUIRE(sched_yield()); +#endif return x * y * z; } @@ -114,7 +129,11 @@ bar(void *p) static void recurse(void) { pthread_t s2; +#ifdef __FreeBSD__ + PTHREAD_REQUIRE(pthread_create(&s2, 0, bar, 0)); +#else pthread_create(&s2, 0, bar, 0); +#endif sleep(20); /* XXX must be long enough for our slowest machine */ } @@ -134,7 +153,11 @@ ATF_TC_BODY(fpu, tc) PTHREAD_REQUIRE(pthread_mutex_init(&recursion_depth_lock, 0)); +#ifdef __FreeBSD__ + PTHREAD_REQUIRE(pthread_create(&s5, 0, stir, stirseed)); +#else pthread_create(&s5, 0, stir, stirseed); +#endif recurse(); atf_tc_fail("exiting from main"); Modified: projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c ============================================================================== --- projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Wed Jan 4 20:41:43 2017 (r311306) @@ -30,6 +30,8 @@ __RCSID("$NetBSD"); #ifdef __FreeBSD__ #include <sys/types.h> +#include <errno.h> +#include <string.h> #endif #include <pthread.h> #include <ucontext.h> @@ -80,7 +82,12 @@ threadfunc(void *arg) oself = (void *)pthread_self(); printf("before swapcontext self = %p\n", oself); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(swapcontext(&octx, &nctx) != -1, "swapcontext failed: %s", + strerror(errno)); +#else PTHREAD_REQUIRE(swapcontext(&octx, &nctx)); +#endif /* NOTREACHED */ return NULL; @@ -111,7 +118,12 @@ ATF_TC_BODY(swapcontext1, tc) printf("Testing if swapcontext() alters pthread_self()\n"); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(getcontext(&nctx) != -1, "getcontext failed: %s", + strerror(errno)); +#else PTHREAD_REQUIRE(getcontext(&nctx)); +#endif PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL)); PTHREAD_REQUIRE(pthread_join(thread, NULL)); } Modified: projects/clang400-import/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- projects/clang400-import/lib/libc/x86/sys/__vdso_gettc.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libc/x86/sys/__vdso_gettc.c Wed Jan 4 20:41:43 2017 (r311306) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org> - * Copyright (c) 2016 The FreeBSD Foundation + * Copyright (c) 2016, 2017 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by Konstantin Belousov @@ -42,11 +42,11 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> #include "un-namespace.h" +#include <machine/atomic.h> #include <machine/cpufunc.h> #include <machine/specialreg.h> #include <dev/acpica/acpi_hpet.h> #ifdef __amd64__ -#include <machine/atomic.h> #include <dev/hyperv/hyperv.h> #endif #include "libc_private.h" @@ -115,37 +115,47 @@ __vdso_rdtsc32(void) return (rdtsc32()); } -static char *hpet_dev_map = NULL; -static uint32_t hpet_idx = 0xffffffff; +#define HPET_DEV_MAP_MAX 10 +static volatile char *hpet_dev_map[HPET_DEV_MAP_MAX]; static void __vdso_init_hpet(uint32_t u) { static const char devprefix[] = "/dev/hpet"; char devname[64], *c, *c1, t; + volatile char *new_map, *old_map; + uint32_t u1; int fd; c1 = c = stpcpy(devname, devprefix); - u = hpet_idx; + u1 = u; do { - *c++ = u % 10 + '0'; - u /= 10; - } while (u != 0); + *c++ = u1 % 10 + '0'; + u1 /= 10; + } while (u1 != 0); *c = '\0'; for (c--; c1 != c; c1++, c--) { t = *c1; *c1 = *c; *c = t; } + + old_map = hpet_dev_map[u]; + if (old_map != NULL) + return; + fd = _open(devname, O_RDONLY); if (fd == -1) { - hpet_dev_map = MAP_FAILED; + atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], + (uintptr_t)old_map, (uintptr_t)MAP_FAILED); return; } - if (hpet_dev_map != NULL && hpet_dev_map != MAP_FAILED) - munmap(hpet_dev_map, PAGE_SIZE); - hpet_dev_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0); + new_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0); _close(fd); + if (atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], + (uintptr_t)old_map, (uintptr_t)new_map) == 0 && + new_map != MAP_FAILED) + munmap((void *)new_map, PAGE_SIZE); } #ifdef __amd64__ @@ -213,7 +223,8 @@ __vdso_hyperv_tsc(struct hyperv_reftsc * int __vdso_gettc(const struct vdso_timehands *th, u_int *tc) { - uint32_t tmp; + volatile char *map; + uint32_t idx; switch (th->th_algo) { case VDSO_TH_ALGO_X86_TSC: @@ -221,14 +232,19 @@ __vdso_gettc(const struct vdso_timehands __vdso_rdtsc32(); return (0); case VDSO_TH_ALGO_X86_HPET: - tmp = th->th_x86_hpet_idx; - if (hpet_dev_map == NULL || tmp != hpet_idx) { - hpet_idx = tmp; - __vdso_init_hpet(hpet_idx); + idx = th->th_x86_hpet_idx; + if (idx >= HPET_DEV_MAP_MAX) + return (ENOSYS); + map = (volatile char *)atomic_load_acq_ptr( + (volatile uintptr_t *)&hpet_dev_map[idx]); + if (map == NULL) { + __vdso_init_hpet(idx); + map = (volatile char *)atomic_load_acq_ptr( + (volatile uintptr_t *)&hpet_dev_map[idx]); } - if (hpet_dev_map == MAP_FAILED) + if (map == MAP_FAILED) return (ENOSYS); - *tc = *(volatile uint32_t *)(hpet_dev_map + HPET_MAIN_COUNTER); + *tc = *(volatile uint32_t *)(map + HPET_MAIN_COUNTER); return (0); #ifdef __amd64__ case VDSO_TH_ALGO_X86_HVTSC: Modified: projects/clang400-import/lib/libstand/Makefile ============================================================================== --- projects/clang400-import/lib/libstand/Makefile Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libstand/Makefile Wed Jan 4 20:41:43 2017 (r311306) @@ -109,9 +109,9 @@ libstand_bzlib_private.h: bzlib_private. sed -e 's|<stdlib.h>|"stand.h"|' \ ${.ALLSRC} > ${.TARGET} -# decompression functionality from libz -.PATH: ${LIBSTAND_SRC}/../libz -CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz +# decompression functionality from zlib +.PATH: ${LIBSTAND_SRC}/../../contrib/zlib +CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../../contrib/zlib SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h .for file in infback.c inffast.c inflate.c inftrees.c zutil.c Modified: projects/clang400-import/lib/libsysdecode/Makefile ============================================================================== --- projects/clang400-import/lib/libsysdecode/Makefile Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libsysdecode/Makefile Wed Jan 4 20:41:43 2017 (r311306) @@ -30,6 +30,7 @@ MLINKS+=sysdecode_enum.3 sysdecode_aclty sysdecode_enum.3 sysdecode_extattrnamespace.3 \ sysdecode_enum.3 sysdecode_fadvice.3 \ sysdecode_enum.3 sysdecode_fcntl_cmd.3 \ + sysdecode_enum.3 sysdecode_getfsstat_mode.3 \ sysdecode_enum.3 sysdecode_idtype.3 \ sysdecode_enum.3 sysdecode_ipproto.3 \ sysdecode_enum.3 sysdecode_kldsym_cmd.3 \ @@ -70,7 +71,6 @@ MLINKS+=sysdecode_mask.3 sysdecode_acces sysdecode_mask.3 sysdecode_fileflags.3 \ sysdecode_mask.3 sysdecode_filemode.3 \ sysdecode_mask.3 sysdecode_flock_operation.3 \ - sysdecode_mask.3 sysdecode_getfsstat_flags.3 \ sysdecode_mask.3 sysdecode_mlockall_flags.3 \ sysdecode_mask.3 sysdecode_mmap_flags.3 \ sysdecode_mask.3 sysdecode_mmap_prot.3 \ Modified: projects/clang400-import/lib/libsysdecode/flags.c ============================================================================== --- projects/clang400-import/lib/libsysdecode/flags.c Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libsysdecode/flags.c Wed Jan 4 20:41:43 2017 (r311306) @@ -472,11 +472,15 @@ sysdecode_flock_operation(FILE *fp, int return (print_mask_int(fp, flockops, operation, rem)); } -bool -sysdecode_getfsstat_flags(FILE *fp, int flags, int *rem) +static struct name_table getfsstatmode[] = { + X(MNT_WAIT) X(MNT_NOWAIT) XEND +}; + +const char * +sysdecode_getfsstat_mode(int mode) { - return (print_mask_int(fp, getfsstatflags, flags, rem)); + return (lookup_value(getfsstatmode, mode)); } const char * Modified: projects/clang400-import/lib/libsysdecode/mktables ============================================================================== --- projects/clang400-import/lib/libsysdecode/mktables Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libsysdecode/mktables Wed Jan 4 20:41:43 2017 (r311306) @@ -94,7 +94,6 @@ gen_table "extattrns" "EXTATTR_NAM gen_table "fadvisebehav" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h" gen_table "openflags" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h" "O_RDONLY|O_RDWR|O_WRONLY" gen_table "flockops" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h" -gen_table "getfsstatflags" "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*" "sys/mount.h" gen_table "kldsymcmd" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" gen_table "kldunloadfflags" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" gen_table "lio_listiomodes" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h" Modified: projects/clang400-import/lib/libsysdecode/sysdecode.h ============================================================================== --- projects/clang400-import/lib/libsysdecode/sysdecode.h Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libsysdecode/sysdecode.h Wed Jan 4 20:41:43 2017 (r311306) @@ -54,7 +54,7 @@ bool sysdecode_fileflags(FILE *_fp, ffla bool sysdecode_filemode(FILE *_fp, int _mode, int *_rem); bool sysdecode_flock_operation(FILE *_fp, int _operation, int *_rem); int sysdecode_freebsd_to_abi_errno(enum sysdecode_abi _abi, int _error); -bool sysdecode_getfsstat_flags(FILE *_fp, int _flags, int *_rem); +const char *sysdecode_getfsstat_mode(int _mode); const char *sysdecode_idtype(int _idtype); const char *sysdecode_ioctlname(unsigned long _val); const char *sysdecode_ipproto(int _protocol); Modified: projects/clang400-import/lib/libsysdecode/sysdecode_enum.3 ============================================================================== --- projects/clang400-import/lib/libsysdecode/sysdecode_enum.3 Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libsysdecode/sysdecode_enum.3 Wed Jan 4 20:41:43 2017 (r311306) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd January 2, 2017 .Dt sysdecode_enum 3 .Os .Sh NAME @@ -35,6 +35,7 @@ .Nm sysdecode_extattrnamespace , .Nm sysdecode_fadvice , .Nm sysdecode_fcntl_cmd , +.Nm sysdecode_getfsstat_mode , .Nm sysdecode_idtype , .Nm sysdecode_ipproto , .Nm sysdecode_kldsym_cmd , @@ -86,6 +87,8 @@ .Ft const char * .Fn sysdecode_fcntl_cmd "int cmd" .Ft const char * +.Fn sysdecode_getfsstat_mode "int mode" +.Ft const char * .Fn sysdecode_idtype "int idtype" .Ft const char * .Fn sysdecode_ipproto "int protocol" @@ -168,6 +171,7 @@ Most of these functions decode an argume .It Fn sysdecode_extattrnamespace Ta Xr extattr_get_fd 2 Ta Fa attrnamespace .It Fn sysdecode_fadvice Ta Xr posix_fadvise 2 Ta Fa advice .It Fn sysdecode_fcntl_cmd Ta Xr fcntl 2 Ta Fa cmd +.It Fn sysdecode_getfsstat_mode Ta Xr getfsstat 2 Ta Fa mode .It Fn sysdecode_idtype Ta .Xr procctl 2 , .Xr waitid 2 Modified: projects/clang400-import/lib/libsysdecode/sysdecode_mask.3 ============================================================================== --- projects/clang400-import/lib/libsysdecode/sysdecode_mask.3 Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libsysdecode/sysdecode_mask.3 Wed Jan 4 20:41:43 2017 (r311306) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd January 2, 2017 .Dt sysdecode_mask 3 .Os .Sh NAME @@ -36,7 +36,6 @@ .Nm sysdecode_fileflags , .Nm sysdecode_filemode , .Nm sysdecode_flock_operation , -.Nm sysdecode_getfsstat_flags , .Nm sysdecode_mlockall_flags , .Nm sysdecode_mmap_flags , .Nm sysdecode_mmap_prot , @@ -153,7 +152,6 @@ Most of these functions decode an argume .It Fn sysdecode_fileflags Ta Xr chflags 2 Ta Fa flags .It Fn sysdecode_filemode Ta Xr chmod 2 , Xr open 2 Ta mode .It Fn sysdecode_flock_operation Ta Xr flock 2 Ta Fa operation -.It Fn sysdecode_getfsstat_flags Ta Xr getfsstatflags 2 Ta Fa flags .It Fn sysdecode_mlockall_flags Ta Xr mlockall 2 Ta Fa flags .It Fn sysdecode_mmap_flags Ta Xr mmap 2 Ta Fa flags .It Fn sysdecode_mmap_prot Ta Xr mmap 2 Ta Fa prot Modified: projects/clang400-import/lib/libz/FREEBSD-upgrade ============================================================================== --- projects/clang400-import/lib/libz/FREEBSD-upgrade Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libz/FREEBSD-upgrade Wed Jan 4 20:41:43 2017 (r311306) @@ -1,44 +1,16 @@ $FreeBSD$ -ZLib 1.2.2 - -Original distribution from http://www.gzip.org/zlib/ - -Vendor files removed from distribution before import: - INDEX configure qnx/ - Makefile contrib/ win32/ - Makefile.in msdos/ zconf.in.h - amiga/ old/ - as400/ projects/ - -Vendor files imported: - ChangeLog example.c minigzip.c - FAQ gzio.c trees.c - README infback.c trees.h - adler32.c inffast.c uncompr.c - algorithm.txt inffast.h zconf.h - compress.c inffixed.h zlib.3 - crc32.c inflate.c zlib.h - crc32.h inflate.h zutil.c - deflate.c inftrees.c zutil.h - deflate.h inftrees.h - -As of April, 2005, only the following three vendor files -had non-trivial local changes: - gzio.c minigzip.c zconf.h - -Added files (not from vendor): - Makefile zopen.c FREEBSD-upgrade +Original distribution from http://zlib.net/. Currently, only trivial +changes were made to support build of libstand and to suppress certain +compiler warnings, we upstream our local changes whenever they would +benefit other consumers. To Update: 1) Unpack vendor sources into a clean directory. - 2) Delete unnecessary files. - 3) Import onto the vendor branch. The 1.2.2 import was done like this: - cvs -d <CVSROOT> import -ko -m "ZLib 1.2.2" src/lib/libz ZLIB v1_2_2 - 4) In a clean directory, check out a fresh copy of HEAD, - merging in vendor changes since the last import. - cvs -d <CVSROOT> co -jZLIB:yesterday -jZLIB src/lib/libz - 5) Resolve any conflicts and commit them. - 6) Update this file with any changes to the file list or update procedure. + 2) Import onto the vendor area. + 3) Merge the vendor tree to contrib/zlib, which contains a stripped down + version of upstream source, resolve any conflicts. + 4) Double check zconf.h, zlib.pc, and Symbol.map to make sure that we + have the required changes. Test universe and commit them. -kientzle@FreeBSD.org +delphij@FreeBSD.org Modified: projects/clang400-import/lib/libz/Makefile ============================================================================== --- projects/clang400-import/lib/libz/Makefile Wed Jan 4 20:26:42 2017 (r311305) +++ projects/clang400-import/lib/libz/Makefile Wed Jan 4 20:41:43 2017 (r311306) @@ -8,6 +8,10 @@ SHLIBDIR?= /lib SHLIB_MAJOR= 6 MAN= zlib.3 zopen.3 +ZLIBSRC= ${SRCTOP}/contrib/zlib + +.PATH: ${ZLIBSRC} + #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 #CFLAGS=-g -DDEBUG #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ @@ -37,14 +41,14 @@ SRCS+= zopen.c SRCS+= zutil.c #.if ${MACHINE_ARCH} == "i386" && ${MACHINE_CPU:M*i686*} -#.PATH: ${.CURDIR}/contrib/asm686 +#.PATH: ${ZLIBSRC}/contrib/asm686 #SRCS+= match.S #CFLAGS+= -DASMV -DNO_UNDERLINE #ACFLAGS+= -Wa,--noexecstack #.endif #.if ${MACHINE_ARCH} == "amd64" *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701042041.v04KfhdJ081882>