Date: Mon, 29 May 2017 22:25:33 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r319165 - in projects/clang500-import: . contrib/binutils/ld contrib/ofed/libcxgb4/src etc/rc.d lib/libc/sys lib/libc/tests/nss lib/libgeom lib/libkvm/tests lib/libnv/tests lib/libprocs... Message-ID: <201705292225.v4TMPXlm031643@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Mon May 29 22:25:33 2017 New Revision: 319165 URL: https://svnweb.freebsd.org/changeset/base/319165 Log: Merge ^/head r318964 through r319164. Added: projects/clang500-import/lib/msun/man/sincos.3 - copied unchanged from r319164, head/lib/msun/man/sincos.3 projects/clang500-import/lib/msun/src/k_sincos.h - copied unchanged from r319164, head/lib/msun/src/k_sincos.h projects/clang500-import/lib/msun/src/k_sincosf.h - copied unchanged from r319164, head/lib/msun/src/k_sincosf.h projects/clang500-import/lib/msun/src/k_sincosl.h - copied unchanged from r319164, head/lib/msun/src/k_sincosl.h projects/clang500-import/lib/msun/src/s_sincos.c - copied unchanged from r319164, head/lib/msun/src/s_sincos.c projects/clang500-import/lib/msun/src/s_sincosf.c - copied unchanged from r319164, head/lib/msun/src/s_sincosf.c projects/clang500-import/lib/msun/src/s_sincosl.c - copied unchanged from r319164, head/lib/msun/src/s_sincosl.c projects/clang500-import/share/man/man4/rctl.4 - copied unchanged from r319164, head/share/man/man4/rctl.4 projects/clang500-import/share/man/man5/mount.conf.5 - copied unchanged from r319164, head/share/man/man5/mount.conf.5 projects/clang500-import/sys/fs/ext2fs/ext2_acl.c - copied unchanged from r319164, head/sys/fs/ext2fs/ext2_acl.c projects/clang500-import/sys/fs/ext2fs/ext2_acl.h - copied unchanged from r319164, head/sys/fs/ext2fs/ext2_acl.h projects/clang500-import/usr.sbin/pw/tests/pw_groupshow_test.sh - copied unchanged from r319164, head/usr.sbin/pw/tests/pw_groupshow_test.sh projects/clang500-import/usr.sbin/pw/tests/pw_usershow_test.sh - copied unchanged from r319164, head/usr.sbin/pw/tests/pw_usershow_test.sh Deleted: projects/clang500-import/sbin/mount/mount.conf.8 Modified: projects/clang500-import/ObsoleteFiles.inc projects/clang500-import/contrib/binutils/ld/configure.tgt projects/clang500-import/contrib/ofed/libcxgb4/src/qp.c projects/clang500-import/etc/rc.d/random projects/clang500-import/lib/libc/sys/getdirentries.2 projects/clang500-import/lib/libc/tests/nss/Makefile projects/clang500-import/lib/libc/tests/nss/getaddrinfo_test.c projects/clang500-import/lib/libc/tests/nss/getgr_test.c projects/clang500-import/lib/libc/tests/nss/gethostby_test.c projects/clang500-import/lib/libc/tests/nss/getproto_test.c projects/clang500-import/lib/libc/tests/nss/getpw_test.c projects/clang500-import/lib/libc/tests/nss/getrpc_test.c projects/clang500-import/lib/libc/tests/nss/getserv_test.c projects/clang500-import/lib/libc/tests/nss/getusershell_test.c projects/clang500-import/lib/libgeom/geom_stats.c projects/clang500-import/lib/libkvm/tests/kvm_geterr_test.c projects/clang500-import/lib/libnv/tests/dnv_tests.cc projects/clang500-import/lib/libnv/tests/nv_tests.cc projects/clang500-import/lib/libprocstat/Symbol.map projects/clang500-import/lib/libprocstat/libprocstat.c projects/clang500-import/lib/libprocstat/libprocstat.h projects/clang500-import/lib/libprocstat/libprocstat_compat.c projects/clang500-import/lib/libstand/bootp.c projects/clang500-import/lib/libstand/bootp.h projects/clang500-import/lib/libstand/net.h projects/clang500-import/lib/msun/Makefile projects/clang500-import/lib/msun/Symbol.map projects/clang500-import/lib/msun/src/math.h projects/clang500-import/lib/msun/src/math_private.h projects/clang500-import/lib/msun/tests/fma_test.c projects/clang500-import/lib/msun/tests/logarithm_test.c projects/clang500-import/libexec/rtld-elf/rtld.1 projects/clang500-import/sbin/mount/Makefile projects/clang500-import/sbin/reboot/boot_i386.8 projects/clang500-import/share/man/man4/Makefile projects/clang500-import/share/man/man4/cfiscsi.4 projects/clang500-import/share/man/man4/iscsi.4 projects/clang500-import/share/man/man5/Makefile projects/clang500-import/share/mk/bsd.init.mk projects/clang500-import/share/mk/bsd.own.mk projects/clang500-import/sys/amd64/linux/linux.h projects/clang500-import/sys/arm/conf/ARMADA38X projects/clang500-import/sys/boot/common/dev_net.c projects/clang500-import/sys/boot/i386/loader/Makefile projects/clang500-import/sys/boot/i386/pxeldr/pxeboot.8 projects/clang500-import/sys/cam/scsi/scsi_da.c projects/clang500-import/sys/cam/scsi/scsi_xpt.c projects/clang500-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c projects/clang500-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c projects/clang500-import/sys/compat/linux/linux_misc.c projects/clang500-import/sys/conf/config.mk projects/clang500-import/sys/conf/files projects/clang500-import/sys/contrib/ipfilter/netinet/ip_nat.c projects/clang500-import/sys/contrib/ipfilter/netinet/ip_sync.c projects/clang500-import/sys/dev/ath/ath_hal/ah.c projects/clang500-import/sys/dev/atkbdc/psm.c projects/clang500-import/sys/dev/bhnd/cores/chipc/chipcreg.h projects/clang500-import/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c projects/clang500-import/sys/dev/cxgbe/crypto/t4_crypto.c projects/clang500-import/sys/dev/etherswitch/rtl8366/rtl8366rb.c projects/clang500-import/sys/dev/etherswitch/rtl8366/rtl8366rbvar.h projects/clang500-import/sys/dev/rtwn/if_rtwn.c projects/clang500-import/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c projects/clang500-import/sys/dev/uart/uart_bus_pci.c projects/clang500-import/sys/fs/ext2fs/ext2_extattr.c projects/clang500-import/sys/fs/ext2fs/ext2_vnops.c projects/clang500-import/sys/fs/nfsclient/nfs_clport.c projects/clang500-import/sys/kern/sys_socket.c projects/clang500-import/sys/kern/vfs_vnops.c projects/clang500-import/sys/mips/atheros/ar71xxreg.h projects/clang500-import/sys/mips/broadcom/bcm_pmu.c projects/clang500-import/sys/mips/conf/AP93.hints projects/clang500-import/sys/mips/conf/AR724X_BASE projects/clang500-import/sys/modules/ext2fs/Makefile projects/clang500-import/sys/modules/linux/Makefile projects/clang500-import/sys/modules/linux64/Makefile projects/clang500-import/sys/net/if_lagg.c projects/clang500-import/sys/netipsec/ipsec.h projects/clang500-import/sys/netipsec/ipsec_input.c projects/clang500-import/sys/netipsec/ipsec_output.c projects/clang500-import/sys/netipsec/key_debug.h projects/clang500-import/sys/netipsec/xform_ah.c projects/clang500-import/sys/netipsec/xform_esp.c projects/clang500-import/sys/netipsec/xform_ipcomp.c projects/clang500-import/sys/sys/user.h projects/clang500-import/sys/sys/vnode.h projects/clang500-import/sys/vm/swap_pager.c projects/clang500-import/tests/sys/file/ftruncate_test.c projects/clang500-import/tests/sys/file/newfileops_on_fork_test.c projects/clang500-import/tests/sys/kern/unix_seqpacket_test.c projects/clang500-import/tests/sys/netinet/tcp_user_cookie.c projects/clang500-import/tools/regression/geom_gpt/gctl_test_helper.c projects/clang500-import/usr.bin/grep/grep.h projects/clang500-import/usr.bin/grep/tests/grep_freebsd_test.sh projects/clang500-import/usr.bin/grep/util.c projects/clang500-import/usr.bin/mkimg/gpt.c projects/clang500-import/usr.bin/netstat/ipsec.c projects/clang500-import/usr.bin/procstat/procstat.1 projects/clang500-import/usr.bin/procstat/procstat.c projects/clang500-import/usr.bin/procstat/procstat_files.c projects/clang500-import/usr.bin/rctl/rctl.8 projects/clang500-import/usr.sbin/ctld/ctld.8 projects/clang500-import/usr.sbin/iscsid/iscsid.8 projects/clang500-import/usr.sbin/pw/tests/Makefile Directory Properties: projects/clang500-import/ (props changed) projects/clang500-import/contrib/binutils/ (props changed) projects/clang500-import/sys/cddl/contrib/opensolaris/ (props changed) projects/clang500-import/sys/contrib/ipfilter/ (props changed) Modified: projects/clang500-import/ObsoleteFiles.inc ============================================================================== --- projects/clang500-import/ObsoleteFiles.inc Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/ObsoleteFiles.inc Mon May 29 22:25:33 2017 (r319165) @@ -150,6 +150,8 @@ OLD_FILES+=usr/lib/clang/4.0.0/lib/freeb OLD_DIRS+=usr/lib/clang/4.0.0/lib/freebsd OLD_DIRS+=usr/lib/clang/4.0.0/lib OLD_DIRS+=usr/lib/clang/4.0.0 +# 20170529: mount.conf(8) -> mount.conf(5) +OLD_FILES+=usr/share/man/man8/mount.conf.8.gz # 20170525: remove misleading template OLD_FILES+=usr/share/misc/man.template # 20170525: disconnect the roff docs from the build @@ -222,6 +224,10 @@ OLD_FILES+=usr/share/doc/usd/21.troff/pa OLD_FILES+=usr/share/doc/usd/22.trofftut/paper.ascii.gz OLD_FILES+=usr/share/doc/usd/Title.ascii.gz OLD_FILES+=usr/share/doc/usd/contents.ascii.gz +# 20170523: 64-bit inode support, library version bumps +OLD_LIBS+=lib/libzfs.so.2 +OLD_LIBS+=usr/lib/libarchive.so.6 +OLD_LIBS+=usr/lib/libmilter.so.5 # 20170427: NATM configuration support removed OLD_FILES+=etc/rc.d/atm1 OLD_FILES+=etc/rc.d/atm2 Modified: projects/clang500-import/contrib/binutils/ld/configure.tgt ============================================================================== --- projects/clang500-import/contrib/binutils/ld/configure.tgt Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/contrib/binutils/ld/configure.tgt Mon May 29 22:25:33 2017 (r319165) @@ -480,7 +480,7 @@ powerpc-*-lynxos*) targ_emul=ppclynx ;; rs6000-*-aix5*) targ_emul=aix5rs6 ;; rs6000-*-aix*) targ_emul=aixrs6 ;; -s390x-*-freebsd*) targ_emul=elf64_s390 +s390x-*-freebsd*) targ_emul=elf64_s390 targ_extra_emuls=elf_s390 targ_extra_libpath=$targ_extra_emuls tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;; @@ -490,7 +490,7 @@ s390x-*-linux*) targ_emul=elf64_ tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;; s390x-*-tpf*) targ_emul=elf64_s390 tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;; -s390-*-freebsd*) targ_emul=elf_s390 +s390-*-freebsd*) targ_emul=elf_s390 targ64_extra_emuls=elf64_s390 targ64_extra_libpath=elf64_s390 tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'` Modified: projects/clang500-import/contrib/ofed/libcxgb4/src/qp.c ============================================================================== --- projects/clang500-import/contrib/ofed/libcxgb4/src/qp.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/contrib/ofed/libcxgb4/src/qp.c Mon May 29 22:25:33 2017 (r319165) @@ -47,39 +47,49 @@ struct c4iw_stats c4iw_stats; static void copy_wr_to_sq(struct t4_wq *wq, union t4_wr *wqe, u8 len16) { - u64 *src, *dst; - - src = (u64 *)wqe; - dst = (u64 *)((u8 *)wq->sq.queue + wq->sq.wq_pidx * T4_EQ_ENTRY_SIZE); + void *src, *dst; + uintptr_t end; + int total, len; + + src = &wqe->flits[0]; + dst = &wq->sq.queue->flits[wq->sq.wq_pidx * + (T4_EQ_ENTRY_SIZE / sizeof(__be64))]; if (t4_sq_onchip(wq)) { len16 = align(len16, 4); wc_wmb(); } - while (len16) { - *dst++ = *src++; - if (dst == (u64 *)&wq->sq.queue[wq->sq.size]) - dst = (u64 *)wq->sq.queue; - *dst++ = *src++; - if (dst == (u64 *)&wq->sq.queue[wq->sq.size]) - dst = (u64 *)wq->sq.queue; - len16--; + + total = len16 * 16; + end = (uintptr_t)&wq->sq.queue[wq->sq.size]; + if (__predict_true((uintptr_t)dst + total <= end)) { + /* Won't wrap around. */ + memcpy(dst, src, total); + } else { + len = end - (uintptr_t)dst; + memcpy(dst, src, len); + memcpy(wq->sq.queue, src + len, total - len); } } static void copy_wr_to_rq(struct t4_wq *wq, union t4_recv_wr *wqe, u8 len16) { - u64 *src, *dst; - - src = (u64 *)wqe; - dst = (u64 *)((u8 *)wq->rq.queue + wq->rq.wq_pidx * T4_EQ_ENTRY_SIZE); - while (len16) { - *dst++ = *src++; - if (dst >= (u64 *)&wq->rq.queue[wq->rq.size]) - dst = (u64 *)wq->rq.queue; - *dst++ = *src++; - if (dst >= (u64 *)&wq->rq.queue[wq->rq.size]) - dst = (u64 *)wq->rq.queue; - len16--; + void *src, *dst; + uintptr_t end; + int total, len; + + src = &wqe->flits[0]; + dst = &wq->rq.queue->flits[wq->rq.wq_pidx * + (T4_EQ_ENTRY_SIZE / sizeof(__be64))]; + + total = len16 * 16; + end = (uintptr_t)&wq->rq.queue[wq->rq.size]; + if (__predict_true((uintptr_t)dst + total <= end)) { + /* Won't wrap around. */ + memcpy(dst, src, total); + } else { + len = end - (uintptr_t)dst; + memcpy(dst, src, len); + memcpy(wq->rq.queue, src + len, total - len); } } Modified: projects/clang500-import/etc/rc.d/random ============================================================================== --- projects/clang500-import/etc/rc.d/random Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/etc/rc.d/random Mon May 29 22:25:33 2017 (r319165) @@ -20,12 +20,14 @@ saveseed_cmd="${name}_stop" save_dev_random() { + oumask=`umask` + umask 077 for f ; do - if :>>"$f" ; then - debug "saving entropy to $f" - dd if=/dev/random of="$f" bs=4096 count=1 2>/dev/null - fi + debug "saving entropy to $f" + dd if=/dev/random of="$f" bs=4096 count=1 status=none && + chmod 600 "$f" done + umask ${oumask} } feed_dev_random() Modified: projects/clang500-import/lib/libc/sys/getdirentries.2 ============================================================================== --- projects/clang500-import/lib/libc/sys/getdirentries.2 Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/sys/getdirentries.2 Mon May 29 22:25:33 2017 (r319165) @@ -28,7 +28,7 @@ .\" @(#)getdirentries.2 8.2 (Berkeley) 5/3/95 .\" $FreeBSD$ .\" -.Dd May 3, 1995 +.Dd May 28, 2017 .Dt GETDIRENTRIES 2 .Os .Sh NAME @@ -71,10 +71,11 @@ The data in the buffer is a series of .Vt dirent structures each containing the following entries: .Bd -literal -offset indent -uint32_t d_fileno; -uint16_t d_reclen; -uint8_t d_type; -uint8_t d_namlen; +ino_t d_fileno; +off_t d_off; +uint16_t d_reclen; +uint8_t d_type; +uint16_t d_namlen; char d_name[MAXNAMLEN + 1]; /* see below */ .Ed .Pp @@ -124,7 +125,10 @@ or A value of zero is returned when the end of the directory has been reached. .Pp -The +If the +.Fa basep +pointer value is non-NULL , +the .Fn getdirentries system call writes the position of the block read into the location pointed to by .Fa basep . @@ -157,7 +161,7 @@ is not a valid file descriptor open for .It Bq Er EFAULT Either .Fa buf -or +or non-NULL .Fa basep point outside the allocated address space. .It Bq Er EINVAL Modified: projects/clang500-import/lib/libc/tests/nss/Makefile ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/Makefile Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/Makefile Mon May 29 22:25:33 2017 (r319165) @@ -1,18 +1,13 @@ # $FreeBSD$ +.PATH: ${.CURDIR:H}/resolv + PACKAGE= tests TESTSDIR= ${TESTSBASE}/lib/libc/nss BINDIR= ${TESTSDIR} -.PATH: ${.CURDIR:H}/resolv - -${PACKAGE}FILES+= mach - -WARNS?= 1 -CFLAGS+= -I${SRCTOP}/tests - ATF_TESTS_C+= getaddrinfo_test ATF_TESTS_C+= getgr_test ATF_TESTS_C+= gethostby_test @@ -23,4 +18,10 @@ ATF_TESTS_C+= getrpc_test ATF_TESTS_C+= getserv_test ATF_TESTS_C+= getusershell_test +${PACKAGE}FILES+= mach + +WARNS?= 3 + +CFLAGS+= -I${SRCTOP}/tests + .include <bsd.test.mk> Modified: projects/clang500-import/lib/libc/tests/nss/getaddrinfo_test.c ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/getaddrinfo_test.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/getaddrinfo_test.c Mon May 29 22:25:33 2017 (r319165) @@ -28,7 +28,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> +#include <sys/param.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> @@ -125,7 +125,8 @@ compare_addrinfo_(struct addrinfo *ai1, } static int -compare_addrinfo(struct addrinfo *ai1, struct addrinfo *ai2, void *mdata) +compare_addrinfo(struct addrinfo *ai1, struct addrinfo *ai2, + void *mdata __unused) { int rv; @@ -144,7 +145,7 @@ compare_addrinfo(struct addrinfo *ai1, s return (rv); } -void +static void free_addrinfo(struct addrinfo *ai) { if (ai == NULL) @@ -164,30 +165,30 @@ sdump_addrinfo(struct addrinfo *ai, char ai->ai_flags, ai->ai_family, ai->ai_socktype, ai->ai_protocol, ai->ai_addrlen); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; written = snprintf(buffer, buflen, "%s ", ai->ai_canonname == NULL ? "(null)" : ai->ai_canonname); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (ai->ai_addr == NULL) { written = snprintf(buffer, buflen, "(null)"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } else { - for (i = 0; i < ai->ai_addrlen; i++) { + for (i = 0; i < (int)ai->ai_addrlen; i++) { written = snprintf(buffer, buflen, - i + 1 != ai->ai_addrlen ? "%d." : "%d", + i + 1 != (int)ai->ai_addrlen ? "%d." : "%d", ((unsigned char *)ai->ai_addr)[i]); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -199,7 +200,7 @@ sdump_addrinfo(struct addrinfo *ai, char if (ai->ai_next != NULL) { written = snprintf(buffer, buflen, ":"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -309,12 +310,11 @@ addrinfo_read_snapshot_func(struct addri { struct addrinfo *ai2; char *s, *ps; - int i, rv; + int rv; printf("1 line read from snapshot:\n%s\n", line); rv = 0; - i = 0; ps = line; s = strsep(&ps, ":"); @@ -344,7 +344,7 @@ addrinfo_read_snapshot_func(struct addri } static int -addrinfo_test_correctness(struct addrinfo *ai, void *mdata) +addrinfo_test_correctness(struct addrinfo *ai, void *mdata __unused) { printf("testing correctness with the following data:\n"); @@ -409,12 +409,20 @@ addrinfo_read_hostlist_func(struct addri return (0); } -void -run_tests(char *hostlist_file, char *snapshot_file, int ai_family) +static void +run_tests(char *hostlist_file, const char *snapshot_file, int ai_family) { struct addrinfo_test_data td, td_snap; + char *snapshot_file_copy; int rv; + if (snapshot_file == NULL) + snapshot_file_copy = NULL; + else { + snapshot_file_copy = strdup(snapshot_file); + ATF_REQUIRE(snapshot_file_copy != NULL); + } + memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = ai_family; hints.ai_flags = AI_CANONNAME; @@ -477,24 +485,17 @@ fin: TEST_DATA_DESTROY(addrinfo, &td_snap); TEST_DATA_DESTROY(addrinfo, &td); - free(hostlist_file); - free(snapshot_file); + free(snapshot_file_copy); } #define HOSTLIST_FILE "mach" #define RUN_TESTS(tc, snapshot_file, ai_family) do { \ char *_hostlist_file; \ - char *_snapshot_file; \ ATF_REQUIRE(0 < asprintf(&_hostlist_file, "%s/%s", \ atf_tc_get_config_var(tc, "srcdir"), HOSTLIST_FILE)); \ - if (snapshot_file == NULL) \ - _snapshot_file = NULL; \ - else { \ - _snapshot_file = strdup(snapshot_file); \ - ATF_REQUIRE(_snapshot_file != NULL); \ - } \ - run_tests(_hostlist_file, _snapshot_file, ai_family); \ -} while(0) + run_tests(_hostlist_file, snapshot_file, ai_family); \ + free(_hostlist_file); \ +} while (0) ATF_TC_WITHOUT_HEAD(pf_unspec); ATF_TC_BODY(pf_unspec, tc) Modified: projects/clang500-import/lib/libc/tests/nss/getgr_test.c ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/getgr_test.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/getgr_test.c Mon May 29 22:25:33 2017 (r319165) @@ -49,8 +49,6 @@ enum test_methods { TEST_BUILD_SNAPSHOT = 16, }; -static enum test_methods method = TEST_BUILD_SNAPSHOT; - DECLARE_TEST_DATA(group) DECLARE_TEST_FILE_SNAPSHOT(group) DECLARE_1PASS_TEST(group) @@ -104,7 +102,7 @@ clone_group(struct group *dest, struct g for (cp = src->gr_mem; *cp; ++cp) ++members_num; - dest->gr_mem = calloc(1, (members_num + 1) * sizeof(char *)); + dest->gr_mem = calloc(members_num + 1, sizeof(char *)); ATF_REQUIRE(dest->gr_mem != NULL); for (cp = src->gr_mem; *cp; ++cp) { @@ -179,7 +177,7 @@ sdump_group(struct group *grp, char *buf written = snprintf(buffer, buflen, "%s:%s:%d:", grp->gr_name, grp->gr_passwd, grp->gr_gid); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -189,7 +187,7 @@ sdump_group(struct group *grp, char *buf written = snprintf(buffer, buflen, "%s%s", cp == grp->gr_mem ? "" : ",", *cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -309,7 +307,7 @@ group_fill_test_data(struct group_test_d } static int -group_test_correctness(struct group *grp, void *mdata) +group_test_correctness(struct group *grp, void *mdata __unused) { printf("testing correctness with the following data:\n"); dump_group(grp); @@ -387,7 +385,7 @@ group_test_getgrgid(struct group *grp_mo } static int -group_test_getgrent(struct group *grp, void *mdata) +group_test_getgrent(struct group *grp, void *mdata __unused) { /* Only correctness can be checked when doing 1-pass test for * getgrent(). */ Modified: projects/clang500-import/lib/libc/tests/nss/gethostby_test.c ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/gethostby_test.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/gethostby_test.c Mon May 29 22:25:33 2017 (r319165) @@ -87,8 +87,6 @@ static int hostent_test_gethostbyaddr(st static int hostent_test_getaddrinfo_eq(struct hostent *, void *); static int hostent_test_getnameinfo_eq(struct hostent *, void *); -static void usage(void) __attribute__((__noreturn__)); - IMPLEMENT_TEST_DATA(hostent) IMPLEMENT_TEST_FILE_SNAPSHOT(hostent) IMPLEMENT_1PASS_TEST(hostent) @@ -163,8 +161,7 @@ clone_hostent(struct hostent *dest, stru for (cp = src->h_aliases; *cp; ++cp) ++aliases_num; - dest->h_aliases = calloc(1, (aliases_num + 1) * - sizeof(char *)); + dest->h_aliases = calloc(aliases_num + 1, sizeof(char *)); ATF_REQUIRE(dest->h_aliases != NULL); for (cp = src->h_aliases; *cp; ++cp) { @@ -178,7 +175,7 @@ clone_hostent(struct hostent *dest, stru for (cp = src->h_addr_list; *cp; ++cp) ++addrs_num; - dest->h_addr_list = calloc(1, (addrs_num + 1) * sizeof(char *)); + dest->h_addr_list = calloc(addrs_num + 1, sizeof(char *)); ATF_REQUIRE(dest->h_addr_list != NULL); for (cp = src->h_addr_list; *cp; ++cp) { @@ -413,7 +410,7 @@ sdump_hostent(struct hostent *ht, char * written = snprintf(buffer, buflen, "%s %d %d", ht->h_name, ht->h_addrtype, ht->h_length); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -422,7 +419,7 @@ sdump_hostent(struct hostent *ht, char * for (cp = ht->h_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s",*cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -432,59 +429,61 @@ sdump_hostent(struct hostent *ht, char * } else { written = snprintf(buffer, buflen, " noaliases"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } } else { written = snprintf(buffer, buflen, " (null)"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } written = snprintf(buffer, buflen, " : "); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (ht->h_addr_list != NULL) { if (*(ht->h_addr_list) != NULL) { for (cp = ht->h_addr_list; *cp; ++cp) { - for (i = 0; i < ht->h_length; ++i ) { - written = snprintf(buffer, buflen, - i + 1 != ht->h_length ? "%d." : "%d", - (unsigned char)(*cp)[i]); - buffer += written; - if (written > buflen) - return; - buflen -= written; + for (i = 0; i < (size_t)ht->h_length; ++i) { + written = snprintf(buffer, buflen, + i + 1 != (size_t)ht->h_length ? + "%d." : "%d", + (unsigned char)(*cp)[i]); + buffer += written; + if (written > (int)buflen) + return; + buflen -= written; - if (buflen == 0) - return; - } + if (buflen == 0) + return; + } - if (*(cp + 1) ) { - written = snprintf(buffer, buflen, " "); - buffer += written; - if (written > buflen) - return; - buflen -= written; - } + if (*(cp + 1)) { + written = snprintf(buffer, buflen, + " "); + buffer += written; + if (written > (int)buflen) + return; + buflen -= written; + } } } else { written = snprintf(buffer, buflen, " noaddrs"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } } else { written = snprintf(buffer, buflen, " (null)"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } @@ -676,7 +675,7 @@ dump_hostent(struct hostent *result) } static int -hostent_test_correctness(struct hostent *ht, void *mdata) +hostent_test_correctness(struct hostent *ht, void *mdata __unused) { #ifdef DEBUG @@ -759,7 +758,7 @@ hostent_test_gethostbyaddr(struct hosten } static int -hostent_test_getaddrinfo_eq(struct hostent *he, void *mdata) +hostent_test_getaddrinfo_eq(struct hostent *he, void *mdata __unused) { struct addrinfo *ai, hints; int rv; @@ -777,28 +776,30 @@ hostent_test_getaddrinfo_eq(struct hoste rv = getaddrinfo(he->h_name, NULL, &hints, &ai); if (rv == 0) { printf("not ok - shouldn't have been resolved\n"); - return (-1); - } + rv = -1; + } else + rv = 0; } else { rv = getaddrinfo(he->h_name, NULL, &hints, &ai); if (rv != 0) { printf("not ok - should have been resolved\n"); - return (-1); + rv = -1; + goto done; } - rv = is_hostent_equal(he, ai); if (rv != 0) { printf("not ok - addrinfo and hostent are not equal\n"); - return (-1); + rv = -1; } - } - - return (0); +done: + if (ai != NULL) + freeaddrinfo(ai); + return (rv); } static int -hostent_test_getnameinfo_eq(struct hostent *he, void *mdata) +hostent_test_getnameinfo_eq(struct hostent *he, void *mdata __unused) { char **cp; char buffer[NI_MAXHOST]; @@ -885,7 +886,7 @@ hostent_test_getnameinfo_eq(struct hoste * An address might reverse resolve to hostname alias or the * official hostname, e.g. moon.vub.ac.be. */ - bool found_a_match; + bool found_a_match = false; if (strcmp(result->h_name, buffer) == 0) { found_a_match = true; @@ -921,15 +922,24 @@ hostent_test_getnameinfo_eq(struct hoste return (0); } -int -run_tests(const char *hostlist_file, const char *snapshot_file, int af_type, +static int +run_tests(const char *hostlist_file, const char *snapshot_file, int _af_type, enum test_methods method, bool use_ipv6_mapping) { + char *snapshot_file_copy; struct hostent_test_data td, td_addr, td_snap; res_state statp; int rv = -2; - switch (af_type) { + if (snapshot_file == NULL) + snapshot_file_copy = NULL; + else { + snapshot_file_copy = strdup(snapshot_file); + ATF_REQUIRE(snapshot_file_copy != NULL); + } + snapshot_file = snapshot_file_copy; + + switch (_af_type) { case AF_INET: ATF_REQUIRE_FEATURE("inet"); ATF_REQUIRE(!use_ipv6_mapping); @@ -938,7 +948,7 @@ run_tests(const char *hostlist_file, con ATF_REQUIRE_FEATURE("inet6"); break; default: - atf_tc_fail("unhandled address family: %d", af_type); + atf_tc_fail("unhandled address family: %d", _af_type); break; } @@ -947,8 +957,8 @@ run_tests(const char *hostlist_file, con if (statp == NULL || ((statp->options & RES_INIT) == 0 && res_ninit(statp) == -1)) { printf("error: can't init res_state\n"); - - return (-1); + rv = -1; + goto fin2; } if (use_ipv6_mapping) @@ -1052,6 +1062,9 @@ fin: TEST_DATA_DESTROY(hostent, &td_addr); TEST_DATA_DESTROY(hostent, &td); +fin2: + free(snapshot_file_copy); + return (rv); } @@ -1060,30 +1073,24 @@ fin: #define _RUN_TESTS(tc, snapshot_file, af_type, method, use_ipv6_mapping) \ do { \ char *_hostlist_file; \ - char *_snapshot_file; \ ATF_REQUIRE(0 < asprintf(&_hostlist_file, "%s/%s", \ atf_tc_get_config_var(tc, "srcdir"), HOSTLIST_FILE)); \ - if (snapshot_file == NULL) \ - _snapshot_file = NULL; \ - else { \ - _snapshot_file = strdup(snapshot_file); \ - ATF_REQUIRE(_snapshot_file != NULL); \ - } \ - ATF_REQUIRE(run_tests(_hostlist_file, _snapshot_file, af_type, \ + ATF_REQUIRE(run_tests(_hostlist_file, snapshot_file, af_type, \ method, use_ipv6_mapping) == 0); \ -} while(0) + free(_hostlist_file); \ +} while (0) #define RUN_HOST_TESTS(tc, snapshot_file, af_type, method, use_ipv6_mapping) \ do { \ use_ipnode_functions = false; \ _RUN_TESTS(tc, snapshot_file, af_type, method, use_ipv6_mapping); \ -} while(0) +} while (0) #define RUN_IPNODE_TESTS(tc, snapshot_file, af_type, method, use_ipv6_mapping) \ do { \ use_ipnode_functions = true; \ _RUN_TESTS(tc, snapshot_file, af_type, method, use_ipv6_mapping); \ -} while(0) +} while (0) ATF_TC_WITHOUT_HEAD(gethostbyaddr_ipv4); ATF_TC_BODY(gethostbyaddr_ipv4, tc) Modified: projects/clang500-import/lib/libc/tests/nss/getproto_test.c ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/getproto_test.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/getproto_test.c Mon May 29 22:25:33 2017 (r319165) @@ -99,7 +99,7 @@ clone_protoent(struct protoent *dest, st for (cp = src->p_aliases; *cp; ++cp) ++aliases_num; - dest->p_aliases = calloc(1, (aliases_num+1) * sizeof(char *)); + dest->p_aliases = calloc(aliases_num + 1, sizeof(char *)); assert(dest->p_aliases != NULL); for (cp = src->p_aliases; *cp; ++cp) { @@ -172,16 +172,16 @@ sdump_protoent(struct protoent *pe, char written = snprintf(buffer, buflen, "%s %d", pe->p_name, pe->p_proto); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (pe->p_aliases != NULL) { if (*(pe->p_aliases) != '\0') { for (cp = pe->p_aliases; *cp; ++cp) { - written = snprintf(buffer, buflen, " %s",*cp); + written = snprintf(buffer, buflen, " %s", *cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -288,7 +288,7 @@ protoent_fill_test_data(struct protoent_ } static int -protoent_test_correctness(struct protoent *pe, void *mdata) +protoent_test_correctness(struct protoent *pe, void *mdata __unused) { printf("testing correctness with the following data:\n"); dump_protoent(pe); @@ -388,14 +388,14 @@ protoent_test_getprotobynumber(struct pr } static int -protoent_test_getprotoent(struct protoent *pe, void *mdata) +protoent_test_getprotoent(struct protoent *pe, void *mdata __unused) { /* Only correctness can be checked when doing 1-pass test for * getprotoent(). */ return (protoent_test_correctness(pe, NULL)); } -int +static int run_tests(const char *snapshot_file, enum test_methods method) { struct protoent_test_data td, td_snap, td_2pass; Modified: projects/clang500-import/lib/libc/tests/nss/getpw_test.c ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/getpw_test.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/getpw_test.c Mon May 29 22:25:33 2017 (r319165) @@ -47,8 +47,6 @@ enum test_methods { TEST_BUILD_SNAPSHOT }; -static enum test_methods method = TEST_BUILD_SNAPSHOT; - DECLARE_TEST_DATA(passwd) DECLARE_TEST_FILE_SNAPSHOT(passwd) DECLARE_1PASS_TEST(passwd) @@ -59,7 +57,9 @@ static int compare_passwd(struct passwd static void free_passwd(struct passwd *); static void sdump_passwd(struct passwd *, char *, size_t); +#ifdef DEBUG static void dump_passwd(struct passwd *); +#endif static int passwd_read_snapshot_func(struct passwd *, char *); @@ -97,7 +97,7 @@ clone_passwd(struct passwd *dest, struct } static int -compare_passwd(struct passwd *pwd1, struct passwd *pwd2, void *mdata) +compare_passwd(struct passwd *pwd1, struct passwd *pwd2, void *mdata __unused) { ATF_REQUIRE(pwd1 != NULL); ATF_REQUIRE(pwd2 != NULL); @@ -142,6 +142,7 @@ sdump_passwd(struct passwd *pwd, char *b pwd->pw_fields); } +#ifdef DEBUG static void dump_passwd(struct passwd *pwd) { @@ -152,6 +153,7 @@ dump_passwd(struct passwd *pwd) } else printf("(null)\n"); } +#endif static int passwd_read_snapshot_func(struct passwd *pwd, char *line) @@ -251,7 +253,7 @@ passwd_fill_test_data(struct passwd_test } static int -passwd_test_correctness(struct passwd *pwd, void *mdata) +passwd_test_correctness(struct passwd *pwd, void *mdata __unused) { #ifdef DEBUG @@ -363,7 +365,7 @@ passwd_test_getpwuid(struct passwd *pwd_ } static int -passwd_test_getpwent(struct passwd *pwd, void *mdata) +passwd_test_getpwent(struct passwd *pwd, void *mdata __unused) { /* Only correctness can be checked when doing 1-pass test for * getpwent(). */ Modified: projects/clang500-import/lib/libc/tests/nss/getrpc_test.c ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/getrpc_test.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/getrpc_test.c Mon May 29 22:25:33 2017 (r319165) @@ -70,8 +70,6 @@ static int rpcent_test_getrpcbyname(stru static int rpcent_test_getrpcbynumber(struct rpcent *, void *); static int rpcent_test_getrpcent(struct rpcent *, void *); -static void usage(void) __attribute__((__noreturn__)); - IMPLEMENT_TEST_DATA(rpcent) IMPLEMENT_TEST_FILE_SNAPSHOT(rpcent) IMPLEMENT_1PASS_TEST(rpcent) @@ -100,7 +98,7 @@ clone_rpcent(struct rpcent *dest, struct for (cp = src->r_aliases; *cp; ++cp) ++aliases_num; - dest->r_aliases = calloc(1, (aliases_num + 1) * sizeof(char *)); + dest->r_aliases = calloc(aliases_num + 1, sizeof(char *)); ATF_REQUIRE(dest->r_aliases != NULL); for (cp = src->r_aliases; *cp; ++cp) { @@ -173,16 +171,16 @@ sdump_rpcent(struct rpcent *rpc, char *b written = snprintf(buffer, buflen, "%s %d", rpc->r_name, rpc->r_number); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (rpc->r_aliases != NULL) { if (*(rpc->r_aliases) != '\0') { for (cp = rpc->r_aliases; *cp; ++cp) { - written = snprintf(buffer, buflen, " %s",*cp); + written = snprintf(buffer, buflen, " %s", *cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -289,7 +287,7 @@ rpcent_fill_test_data(struct rpcent_test } static int -rpcent_test_correctness(struct rpcent *rpc, void *mdata) +rpcent_test_correctness(struct rpcent *rpc, void *mdata __unused) { printf("testing correctness with the following data:\n"); @@ -390,7 +388,7 @@ rpcent_test_getrpcbynumber(struct rpcent } static int -rpcent_test_getrpcent(struct rpcent *rpc, void *mdata) +rpcent_test_getrpcent(struct rpcent *rpc, void *mdata __unused) { /* @@ -400,7 +398,7 @@ rpcent_test_getrpcent(struct rpcent *rpc return (rpcent_test_correctness(rpc, NULL)); } -int +static int run_tests(const char *snapshot_file, enum test_methods method) { struct rpcent_test_data td, td_snap, td_2pass; Modified: projects/clang500-import/lib/libc/tests/nss/getserv_test.c ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/getserv_test.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/getserv_test.c Mon May 29 22:25:33 2017 (r319165) @@ -102,7 +102,7 @@ clone_servent(struct servent *dest, stru for (cp = src->s_aliases; *cp; ++cp) ++aliases_num; - dest->s_aliases = calloc(1, (aliases_num + 1) * sizeof(char *)); + dest->s_aliases = calloc(aliases_num + 1, sizeof(char *)); ATF_REQUIRE(dest->s_aliases != NULL); for (cp = src->s_aliases; *cp; ++cp) { @@ -177,16 +177,16 @@ sdump_servent(struct servent *serv, char written = snprintf(buffer, buflen, "%s %d %s", serv->s_name, ntohs(serv->s_port), serv->s_proto); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (serv->s_aliases != NULL) { if (*(serv->s_aliases) != '\0') { for (cp = serv->s_aliases; *cp; ++cp) { - written = snprintf(buffer, buflen, " %s",*cp); + written = snprintf(buffer, buflen, " %s", *cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -300,7 +300,7 @@ servent_fill_test_data(struct servent_te } static int -servent_test_correctness(struct servent *serv, void *mdata) +servent_test_correctness(struct servent *serv, void *mdata __unused) { printf("testing correctness with the following data:\n"); dump_servent(serv); @@ -403,14 +403,14 @@ servent_test_getservbyport(struct serven } static int -servent_test_getservent(struct servent *serv, void *mdata) +servent_test_getservent(struct servent *serv, void *mdata __unused) { /* Only correctness can be checked when doing 1-pass test for * getservent(). */ return (servent_test_correctness(serv, NULL)); } -int +static int run_tests(const char *snapshot_file, enum test_methods method) { struct servent_test_data td, td_snap, td_2pass; Modified: projects/clang500-import/lib/libc/tests/nss/getusershell_test.c ============================================================================== --- projects/clang500-import/lib/libc/tests/nss/getusershell_test.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libc/tests/nss/getusershell_test.c Mon May 29 22:25:33 2017 (r319165) @@ -48,8 +48,6 @@ struct usershell { char *path; }; -static enum test_methods method = TEST_GETUSERSHELL; - DECLARE_TEST_DATA(usershell) DECLARE_TEST_FILE_SNAPSHOT(usershell) DECLARE_2PASS_TEST(usershell) @@ -78,7 +76,8 @@ clone_usershell(struct usershell *dest, } static int -compare_usershell(struct usershell *us1, struct usershell *us2, void *mdata) +compare_usershell(struct usershell *us1, struct usershell *us2, + void *mdata __unused) { int rv; @@ -134,7 +133,7 @@ usershell_read_snapshot_func(struct user return (0); } -int +static int run_tests(const char *snapshot_file, enum test_methods method) { struct usershell_test_data td, td_snap; Modified: projects/clang500-import/lib/libgeom/geom_stats.c ============================================================================== --- projects/clang500-import/lib/libgeom/geom_stats.c Mon May 29 22:09:23 2017 (r319164) +++ projects/clang500-import/lib/libgeom/geom_stats.c Mon May 29 22:25:33 2017 (r319165) @@ -87,8 +87,6 @@ geom_stats_open(void) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705292225.v4TMPXlm031643>