Date: Thu, 19 Jun 2014 16:00:24 GMT From: op@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r269762 - in soc2014/op/freebsd-base: . cddl cddl/contrib/opensolaris cddl/contrib/opensolaris/cmd/zdb etc etc/etc.amd64 etc/etc.i386 lib/libc lib/libc/net lib/libc/stdtime lib/libc/... Message-ID: <201406191600.s5JG0OmP048428@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: op Date: Thu Jun 19 16:00:23 2014 New Revision: 269762 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269762 Log: MFH @201406191759 Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com> Added: soc2014/op/freebsd-base/share/vt/keymaps/pl.kbd - copied unchanged from r269760, mirror/FreeBSD/head/share/vt/keymaps/pl.kbd soc2014/op/freebsd-base/sys/dev/vt/hw/vga/vt_vga.c - copied unchanged from r269760, mirror/FreeBSD/head/sys/dev/vt/hw/vga/vt_vga.c soc2014/op/freebsd-base/sys/dev/vt/hw/vga/vt_vga_reg.h - copied unchanged from r269760, mirror/FreeBSD/head/sys/dev/vt/hw/vga/vt_vga_reg.h soc2014/op/freebsd-base/usr.bin/send-pr/ - copied from r269760, mirror/FreeBSD/head/usr.bin/send-pr/ Deleted: soc2014/op/freebsd-base/sys/dev/vt/hw/vga/vga.c soc2014/op/freebsd-base/sys/dev/vt/hw/vga/vga_reg.h Modified: soc2014/op/freebsd-base/ (props changed) soc2014/op/freebsd-base/Makefile.inc1 soc2014/op/freebsd-base/ObsoleteFiles.inc soc2014/op/freebsd-base/cddl/ (props changed) soc2014/op/freebsd-base/cddl/contrib/opensolaris/ (props changed) soc2014/op/freebsd-base/cddl/contrib/opensolaris/cmd/zdb/zdb.c soc2014/op/freebsd-base/etc/ (props changed) soc2014/op/freebsd-base/etc/etc.amd64/ttys soc2014/op/freebsd-base/etc/etc.i386/ttys soc2014/op/freebsd-base/etc/network.subr soc2014/op/freebsd-base/lib/libc/ (props changed) soc2014/op/freebsd-base/lib/libc/net/getaddrinfo.c soc2014/op/freebsd-base/lib/libc/stdtime/ (props changed) soc2014/op/freebsd-base/lib/libc/stdtime/strftime.3 soc2014/op/freebsd-base/lib/libc/stdtime/strftime.c soc2014/op/freebsd-base/lib/libc/stdtime/strptime.c soc2014/op/freebsd-base/lib/libc/stdtime/timelocal.c soc2014/op/freebsd-base/lib/libc/sys/mmap.2 soc2014/op/freebsd-base/lib/libc/sys/mmap.c soc2014/op/freebsd-base/release/doc/share/xml/sponsor.ent soc2014/op/freebsd-base/sbin/ (props changed) soc2014/op/freebsd-base/sbin/geom/class/eli/geli.8 soc2014/op/freebsd-base/share/ (props changed) soc2014/op/freebsd-base/share/examples/bhyve/vmrun.sh soc2014/op/freebsd-base/share/man/man3/Makefile soc2014/op/freebsd-base/share/man/man5/src.conf.5 soc2014/op/freebsd-base/share/man/man7/build.7 soc2014/op/freebsd-base/share/misc/committers-ports.dot soc2014/op/freebsd-base/share/vt/fonts/vgarom-8x14.hex soc2014/op/freebsd-base/share/vt/fonts/vgarom-8x16.hex soc2014/op/freebsd-base/share/vt/fonts/vgarom-8x8.hex soc2014/op/freebsd-base/share/vt/fonts/vgarom-thin-8x16.hex soc2014/op/freebsd-base/share/vt/keymaps/Makefile soc2014/op/freebsd-base/sys/ (props changed) soc2014/op/freebsd-base/sys/amd64/linux32/linux32_sysvec.c soc2014/op/freebsd-base/sys/amd64/vmm/ (props changed) soc2014/op/freebsd-base/sys/amd64/vmm/intel/vmx.c soc2014/op/freebsd-base/sys/arm/arm/cpufunc.c soc2014/op/freebsd-base/sys/arm/at91/if_ate.c soc2014/op/freebsd-base/sys/arm/include/cpu.h soc2014/op/freebsd-base/sys/cam/cam_periph.c soc2014/op/freebsd-base/sys/cam/ctl/ctl.c soc2014/op/freebsd-base/sys/cam/ctl/ctl.h soc2014/op/freebsd-base/sys/cam/ctl/ctl_backend_block.c soc2014/op/freebsd-base/sys/cam/ctl/ctl_frontend_iscsi.c soc2014/op/freebsd-base/sys/cam/ctl/ctl_frontend_iscsi.h soc2014/op/freebsd-base/sys/cam/ctl/ctl_private.h soc2014/op/freebsd-base/sys/conf/ (props changed) soc2014/op/freebsd-base/sys/conf/files soc2014/op/freebsd-base/sys/conf/files.i386 soc2014/op/freebsd-base/sys/contrib/ipfilter/ (props changed) soc2014/op/freebsd-base/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c (contents, props changed) soc2014/op/freebsd-base/sys/dev/ahci/ahci.c soc2014/op/freebsd-base/sys/dev/ata/ata-dma.c soc2014/op/freebsd-base/sys/dev/cadence/if_cgem.c soc2014/op/freebsd-base/sys/dev/cxgbe/adapter.h soc2014/op/freebsd-base/sys/dev/cxgbe/t4_sge.c soc2014/op/freebsd-base/sys/dev/de/if_de.c soc2014/op/freebsd-base/sys/dev/et/if_et.c soc2014/op/freebsd-base/sys/dev/iscsi/iscsi.c soc2014/op/freebsd-base/sys/dev/iscsi/iscsi_ioctl.h soc2014/op/freebsd-base/sys/dev/mvs/mvs.c soc2014/op/freebsd-base/sys/dev/nfe/if_nfe.c soc2014/op/freebsd-base/sys/dev/nxge/xge-osdep.h soc2014/op/freebsd-base/sys/dev/oce/oce_util.c soc2014/op/freebsd-base/sys/dev/sound/pci/atiixp.c soc2014/op/freebsd-base/sys/dev/sound/pci/emu10k1.c soc2014/op/freebsd-base/sys/dev/sound/pci/emu10kx.c soc2014/op/freebsd-base/sys/dev/sound/pci/envy24.c soc2014/op/freebsd-base/sys/dev/sound/pci/envy24ht.c soc2014/op/freebsd-base/sys/dev/sound/pci/hda/hdac.c soc2014/op/freebsd-base/sys/dev/sound/pci/hdspe.c soc2014/op/freebsd-base/sys/dev/sound/pci/maestro.c soc2014/op/freebsd-base/sys/dev/sound/pci/via8233.c soc2014/op/freebsd-base/sys/dev/sound/pci/via82c686.c soc2014/op/freebsd-base/sys/dev/sound/pcm/buffer.c soc2014/op/freebsd-base/sys/dev/syscons/syscons.c soc2014/op/freebsd-base/sys/dev/syscons/sysmouse.c soc2014/op/freebsd-base/sys/dev/ti/if_ti.c soc2014/op/freebsd-base/sys/dev/txp/if_txp.c soc2014/op/freebsd-base/sys/dev/vmware/vmxnet3/if_vmx.c soc2014/op/freebsd-base/sys/dev/vt/vt.h soc2014/op/freebsd-base/sys/dev/vt/vt_consolectl.c soc2014/op/freebsd-base/sys/dev/vt/vt_core.c soc2014/op/freebsd-base/sys/dev/vt/vt_sysmouse.c soc2014/op/freebsd-base/sys/dev/vxge/vxge-osdep.h soc2014/op/freebsd-base/sys/dev/wpi/if_wpi.c soc2014/op/freebsd-base/sys/fs/devfs/devfs_vnops.c soc2014/op/freebsd-base/sys/fs/msdosfs/msdosfs_vnops.c soc2014/op/freebsd-base/sys/fs/tmpfs/tmpfs.h soc2014/op/freebsd-base/sys/fs/tmpfs/tmpfs_subr.c soc2014/op/freebsd-base/sys/fs/tmpfs/tmpfs_vnops.c soc2014/op/freebsd-base/sys/i386/linux/linux_sysvec.c soc2014/op/freebsd-base/sys/kern/imgact_elf.c soc2014/op/freebsd-base/sys/kern/vfs_vnops.c soc2014/op/freebsd-base/sys/sys/imgact_elf.h soc2014/op/freebsd-base/sys/sys/mman.h soc2014/op/freebsd-base/sys/sys/sysctl.h soc2014/op/freebsd-base/sys/sys/vnode.h soc2014/op/freebsd-base/sys/ufs/ufs/ufs_vnops.c soc2014/op/freebsd-base/sys/vm/vm_map.c soc2014/op/freebsd-base/sys/vm/vm_map.h soc2014/op/freebsd-base/sys/vm/vm_mmap.c soc2014/op/freebsd-base/sys/x86/x86/local_apic.c soc2014/op/freebsd-base/sys/x86/xen/xen_apic.c soc2014/op/freebsd-base/tools/build/options/WITHOUT_VT_SUPPORT soc2014/op/freebsd-base/usr.bin/Makefile soc2014/op/freebsd-base/usr.bin/iscsictl/iscsictl.8 soc2014/op/freebsd-base/usr.bin/iscsictl/iscsictl.c soc2014/op/freebsd-base/usr.sbin/bhyve/ (props changed) soc2014/op/freebsd-base/usr.sbin/bhyve/atkbdc.c soc2014/op/freebsd-base/usr.sbin/ctld/discovery.c soc2014/op/freebsd-base/usr.sbin/iscsid/iscsid.c soc2014/op/freebsd-base/usr.sbin/iscsid/login.c soc2014/op/freebsd-base/usr.sbin/service/service.8 soc2014/op/freebsd-base/usr.sbin/zzz/zzz.8 Modified: soc2014/op/freebsd-base/Makefile.inc1 ============================================================================== --- soc2014/op/freebsd-base/Makefile.inc1 Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/Makefile.inc1 Thu Jun 19 16:00:23 2014 (r269762) @@ -17,6 +17,7 @@ # -DNO_DOCUPDATE do not update doc in ${MAKE} update # -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list +# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list # LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target # LOCAL_MTREE="list of mtree files" to process to allow local directories # to be created before files are installed @@ -756,7 +757,8 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ date echo egrep find grep id install ${_install-info} \ ln lockf make mkdir mtree mv pwd_mkdb \ - rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} + rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} \ + ${LOCAL_ITOOLS} # # distributeworld Modified: soc2014/op/freebsd-base/ObsoleteFiles.inc ============================================================================== --- soc2014/op/freebsd-base/ObsoleteFiles.inc Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/ObsoleteFiles.inc Thu Jun 19 16:00:23 2014 (r269762) @@ -39,7 +39,6 @@ # done # 20140614: send-pr removal -OLD_FILES+=usr/bin/send-pr OLD_FILES+=usr/share/man/man1/send-pr.1.gz OLD_FILES+=etc/gnats/freefall OLD_DIRS+=etc/gnats Modified: soc2014/op/freebsd-base/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- soc2014/op/freebsd-base/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Jun 19 16:00:23 2014 (r269762) @@ -2108,6 +2108,8 @@ uint64_t zb_lsize; uint64_t zb_psize; uint64_t zb_count; + uint64_t zb_gangs; + uint64_t zb_ditto_samevdev; uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE]; } zdb_blkstats_t; @@ -2155,6 +2157,7 @@ for (int i = 0; i < 4; i++) { int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL; int t = (i & 1) ? type : ZDB_OT_TOTAL; + int equal; zdb_blkstats_t *zb = &zcb->zcb_type[l][t]; zb->zb_asize += BP_GET_ASIZE(bp); @@ -2162,6 +2165,27 @@ zb->zb_psize += BP_GET_PSIZE(bp); zb->zb_count++; zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++; + + zb->zb_gangs += BP_COUNT_GANG(bp); + + switch (BP_GET_NDVAS(bp)) { + case 2: + if (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[1])) + zb->zb_ditto_samevdev++; + break; + case 3: + equal = (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[1])) + + (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[2])) + + (DVA_GET_VDEV(&bp->blk_dva[1]) == + DVA_GET_VDEV(&bp->blk_dva[2])); + if (equal != 0) + zb->zb_ditto_samevdev++; + break; + } + } if (dump_opt['L']) @@ -2552,6 +2576,8 @@ (void) printf("\n"); (void) printf("\tbp count: %10llu\n", (u_longlong_t)tzb->zb_count); + (void) printf("\tganged count: %10llu\n", + (longlong_t)tzb->zb_gangs); (void) printf("\tbp logical: %10llu avg: %6llu\n", (u_longlong_t)tzb->zb_lsize, (u_longlong_t)(tzb->zb_lsize / tzb->zb_count)); @@ -2573,6 +2599,11 @@ (void) printf("\tSPA allocated: %10llu used: %5.2f%%\n", (u_longlong_t)norm_alloc, 100.0 * norm_alloc / norm_space); + if (tzb->zb_ditto_samevdev != 0) { + (void) printf("\tDittoed blocks on same vdev: %llu\n", + (longlong_t)tzb->zb_ditto_samevdev); + } + if (dump_opt['b'] >= 2) { int l, t, level; (void) printf("\nBlocks\tLSIZE\tPSIZE\tASIZE" @@ -2580,7 +2611,7 @@ for (t = 0; t <= ZDB_OT_TOTAL; t++) { char csize[32], lsize[32], psize[32], asize[32]; - char avg[32]; + char avg[32], gang[32]; char *typename; if (t < DMU_OT_NUMTYPES) @@ -2621,6 +2652,7 @@ zdb_nicenum(zb->zb_psize, psize); zdb_nicenum(zb->zb_asize, asize); zdb_nicenum(zb->zb_asize / zb->zb_count, avg); + zdb_nicenum(zb->zb_gangs, gang); (void) printf("%6s\t%5s\t%5s\t%5s\t%5s" "\t%5.2f\t%6.2f\t", @@ -2634,6 +2666,11 @@ (void) printf(" L%d %s\n", level, typename); + if (dump_opt['b'] >= 3 && zb->zb_gangs > 0) { + (void) printf("\t number of ganged " + "blocks: %s\n", gang); + } + if (dump_opt['b'] >= 4) { (void) printf("psize " "(in 512-byte sectors): " Modified: soc2014/op/freebsd-base/etc/etc.amd64/ttys ============================================================================== --- soc2014/op/freebsd-base/etc/etc.amd64/ttys Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/etc/etc.amd64/ttys Thu Jun 19 16:00:23 2014 (r269762) @@ -41,7 +41,7 @@ ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty std.9600" vt100 onifconsole secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu1 "/usr/libexec/getty std.9600" dialup off secure ttyu2 "/usr/libexec/getty std.9600" dialup off secure ttyu3 "/usr/libexec/getty std.9600" dialup off secure Modified: soc2014/op/freebsd-base/etc/etc.i386/ttys ============================================================================== --- soc2014/op/freebsd-base/etc/etc.i386/ttys Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/etc/etc.i386/ttys Thu Jun 19 16:00:23 2014 (r269762) @@ -41,7 +41,7 @@ ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty std.9600" vt100 onifconsole secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu1 "/usr/libexec/getty std.9600" dialup off secure ttyu2 "/usr/libexec/getty std.9600" dialup off secure ttyu3 "/usr/libexec/getty std.9600" dialup off secure Modified: soc2014/op/freebsd-base/etc/network.subr ============================================================================== --- soc2014/op/freebsd-base/etc/network.subr Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/etc/network.subr Thu Jun 19 16:00:23 2014 (r269762) @@ -1058,7 +1058,7 @@ # Process the last component if any. if [ -n "$_tmpargs}" ]; then case $_tmpargs in - ${_af}\ *[0-9][a-f][A-F]-*) + ${_af}\ *[0-9a-fA-F]-*) ifalias_af_common_handler $_if $_af $_action \ `ifalias_expand_addr $_af $_action ${_tmpargs#${_af}\ }` ;; Modified: soc2014/op/freebsd-base/lib/libc/net/getaddrinfo.c ============================================================================== --- soc2014/op/freebsd-base/lib/libc/net/getaddrinfo.c Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/lib/libc/net/getaddrinfo.c Thu Jun 19 16:00:23 2014 (r269762) @@ -62,12 +62,15 @@ #include <sys/socket.h> #include <net/if.h> #include <netinet/in.h> +#include <net/if_types.h> +#include <ifaddrs.h> #include <sys/queue.h> #ifdef INET6 #include <net/if_var.h> #include <sys/sysctl.h> #include <sys/ioctl.h> -#include <netinet6/in6_var.h> /* XXX */ +#include <netinet6/in6_var.h> +#include <netinet6/nd6.h> #endif #include <arpa/inet.h> #include <arpa/nameser.h> @@ -245,6 +248,9 @@ static int get_port(struct addrinfo *, const char *, int); static const struct afd *find_afd(int); static int addrconfig(struct addrinfo *); +#ifdef INET6 +static int is_ifdisabled(char *); +#endif static void set_source(struct ai_order *, struct policyhead *); static int comp_dst(const void *, const void *); #ifdef INET6 @@ -1525,10 +1531,11 @@ } /* - * post-2553: AI_ADDRCONFIG check. if we use getipnodeby* as backend, backend - * will take care of it. - * the semantics of AI_ADDRCONFIG is not defined well. we are not sure - * if the code is right or not. + * post-2553: AI_ADDRCONFIG check. Determines which address families are + * configured on the local system and correlates with pai->ai_family value. + * If an address family is not configured on the system, it will not be + * queried for. For this purpose, loopback addresses are not considered + * configured addresses. * * XXX PF_UNSPEC -> PF_INET6 + PF_INET mapping needs to be in sync with * _dns_getaddrinfo. @@ -1536,38 +1543,64 @@ static int addrconfig(struct addrinfo *pai) { - int s, af; + struct ifaddrs *ifaddrs, *ifa; + int seen_inet = 0, seen_inet6 = 0; - /* - * TODO: - * Note that implementation dependent test for address - * configuration should be done everytime called - * (or apropriate interval), - * because addresses will be dynamically assigned or deleted. - */ - af = pai->ai_family; - if (af == AF_UNSPEC) { - if ((s = _socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) - af = AF_INET; - else { - _close(s); - if ((s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, - 0)) < 0) - af = AF_INET6; - else - _close(s); + if (getifaddrs(&ifaddrs) != 0) + return 0; + + for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) { + if (ifa->ifa_addr == NULL || (ifa->ifa_flags & IFF_UP) == 0) + continue; + if ((ifa->ifa_flags & IFT_LOOP) != 0) + continue; + switch (ifa->ifa_addr->sa_family) { + case AF_INET: + seen_inet = 1; + break; +#ifdef INET6 + case AF_INET6: + if (!seen_inet6 && !is_ifdisabled(ifa->ifa_name)) + seen_inet6 = 1; + break; +#endif } } - if (af != AF_UNSPEC) { - if ((s = _socket(af, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) - return 0; - _close(s); + freeifaddrs(ifaddrs); + + switch(pai->ai_family) { + case AF_INET6: + return seen_inet6; + case AF_INET: + return seen_inet; + case AF_UNSPEC: + if (seen_inet == seen_inet6) + return seen_inet; + pai->ai_family = seen_inet ? AF_INET : AF_INET6; + return 1; } - pai->ai_family = af; return 1; } #ifdef INET6 +static int +is_ifdisabled(char *name) +{ + struct in6_ndireq nd; + int fd; + + if ((fd = _socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) + return -1; + memset(&nd, 0, sizeof(nd)); + strlcpy(nd.ifname, name, sizeof(nd.ifname)); + if (_ioctl(fd, SIOCGIFINFO_IN6, &nd) < 0) { + _close(fd); + return -1; + } + _close(fd); + return ((nd.ndi.flags & ND6_IFF_IFDISABLED) != 0); +} + /* convert a string to a scope identifier. XXX: IPv6 specific */ static int ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid) Modified: soc2014/op/freebsd-base/lib/libc/stdtime/strftime.3 ============================================================================== --- soc2014/op/freebsd-base/lib/libc/stdtime/strftime.3 Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/lib/libc/stdtime/strftime.3 Thu Jun 19 16:00:23 2014 (r269762) @@ -248,7 +248,7 @@ conforms to .St -isoC with a lot of extensions including -.Ql %C , +.Ql \&%C , .Ql \&%D , .Ql %E* , .Ql %e , Modified: soc2014/op/freebsd-base/lib/libc/stdtime/strftime.c ============================================================================== --- soc2014/op/freebsd-base/lib/libc/stdtime/strftime.c Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/lib/libc/stdtime/strftime.c Thu Jun 19 16:00:23 2014 (r269762) @@ -24,9 +24,9 @@ #ifndef NOID static const char elsieid[] = "@(#)strftime.3 8.3"; /* -** Based on the UCB version with the ID appearing below. -** This is ANSIish only when "multibyte character == plain character". -*/ + * Based on the UCB version with the ID appearing below. + * This is ANSIish only when "multibyte character == plain character". + */ #endif /* !defined NOID */ #endif /* !defined lint */ @@ -57,32 +57,32 @@ #define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS" #endif /* !defined YEAR_2000_NAME */ -#define IN_NONE 0 -#define IN_SOME 1 -#define IN_THIS 2 -#define IN_ALL 3 - -#define PAD_DEFAULT 0 -#define PAD_LESS 1 -#define PAD_SPACE 2 -#define PAD_ZERO 3 +#define IN_NONE 0 +#define IN_SOME 1 +#define IN_THIS 2 +#define IN_ALL 3 + +#define PAD_DEFAULT 0 +#define PAD_LESS 1 +#define PAD_SPACE 2 +#define PAD_ZERO 3 static const char fmt_padding[][4][5] = { /* DEFAULT, LESS, SPACE, ZERO */ -#define PAD_FMT_MONTHDAY 0 -#define PAD_FMT_HMS 0 -#define PAD_FMT_CENTURY 0 -#define PAD_FMT_SHORTYEAR 0 -#define PAD_FMT_MONTH 0 -#define PAD_FMT_WEEKOFYEAR 0 -#define PAD_FMT_DAYOFMONTH 0 +#define PAD_FMT_MONTHDAY 0 +#define PAD_FMT_HMS 0 +#define PAD_FMT_CENTURY 0 +#define PAD_FMT_SHORTYEAR 0 +#define PAD_FMT_MONTH 0 +#define PAD_FMT_WEEKOFYEAR 0 +#define PAD_FMT_DAYOFMONTH 0 { "%02d", "%d", "%2d", "%02d" }, -#define PAD_FMT_SDAYOFMONTH 1 -#define PAD_FMT_SHMS 1 +#define PAD_FMT_SDAYOFMONTH 1 +#define PAD_FMT_SHMS 1 { "%2d", "%d", "%2d", "%02d" }, #define PAD_FMT_DAYOFYEAR 2 { "%03d", "%d", "%3d", "%03d" }, -#define PAD_FMT_YEAR 3 +#define PAD_FMT_YEAR 3 { "%04d", "%d", "%4d", "%04d" } }; @@ -114,7 +114,7 @@ } #endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */ if (p == s + maxsize) - return 0; + return (0); *p = '\0'; return p - s; } @@ -176,12 +176,12 @@ continue; case 'C': /* - ** %C used to do a... - ** _fmt("%a %b %e %X %Y", t); - ** ...whereas now POSIX 1003.2 calls for - ** something completely different. - ** (ado, 1993-05-24) - */ + * %C used to do a... + * _fmt("%a %b %e %X %Y", t); + * ...whereas now POSIX 1003.2 calls for + * something completely different. + * (ado, 1993-05-24) + */ pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0, pt, ptlim); continue; @@ -210,17 +210,17 @@ goto label; case 'O': /* - ** C99 locale modifiers. - ** The sequences - ** %Ec %EC %Ex %EX %Ey %EY - ** %Od %oe %OH %OI %Om %OM - ** %OS %Ou %OU %OV %Ow %OW %Oy - ** are supposed to provide alternate - ** representations. - ** - ** FreeBSD extension - ** %OB - */ + * C99 locale modifiers. + * The sequences + * %Ec %EC %Ex %EX %Ey %EY + * %Od %oe %OH %OI %Om %OM + * %OS %Ou %OU %OV %Ow %OW %Oy + * are supposed to provide alternate + * representations. + * + * FreeBSD extension + * %OB + */ if (Ealternative || Oalternative) break; Oalternative++; @@ -239,7 +239,8 @@ case 'I': pt = _conv((t->tm_hour % 12) ? (t->tm_hour % 12) : 12, - fmt_padding[PAD_FMT_HMS][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_HMS][PadIndex], + pt, ptlim); continue; case 'j': pt = _conv(t->tm_yday + 1, @@ -247,15 +248,15 @@ continue; case 'k': /* - ** This used to be... - ** _conv(t->tm_hour % 12 ? - ** t->tm_hour % 12 : 12, 2, ' '); - ** ...and has been changed to the below to - ** match SunOS 4.1.1 and Arnold Robbins' - ** strftime version 3.0. That is, "%k" and - ** "%l" have been swapped. - ** (ado, 1993-05-24) - */ + * This used to be... + * _conv(t->tm_hour % 12 ? + * t->tm_hour % 12 : 12, 2, ' '); + * ...and has been changed to the below to + * match SunOS 4.1.1 and Arnold Robbins' + * strftime version 3.0. That is, "%k" and + * "%l" have been swapped. + * (ado, 1993-05-24) + */ pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim); continue; @@ -269,17 +270,18 @@ #endif /* defined KITCHEN_SINK */ case 'l': /* - ** This used to be... - ** _conv(t->tm_hour, 2, ' '); - ** ...and has been changed to the below to - ** match SunOS 4.1.1 and Arnold Robbin's - ** strftime version 3.0. That is, "%k" and - ** "%l" have been swapped. - ** (ado, 1993-05-24) - */ + * This used to be... + * _conv(t->tm_hour, 2, ' '); + * ...and has been changed to the below to + * match SunOS 4.1.1 and Arnold Robbin's + * strftime version 3.0. That is, "%k" and + * "%l" have been swapped. + * (ado, 1993-05-24) + */ pt = _conv((t->tm_hour % 12) ? (t->tm_hour % 12) : 12, - fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_SHMS][PadIndex], + pt, ptlim); continue; case 'M': pt = _conv(t->tm_min, fmt_padding[PAD_FMT_HMS][PadIndex], @@ -287,15 +289,15 @@ continue; case 'm': pt = _conv(t->tm_mon + 1, - fmt_padding[PAD_FMT_MONTH][PadIndex], pt, ptlim); + fmt_padding[PAD_FMT_MONTH][PadIndex], + pt, ptlim); continue; case 'n': pt = _add("\n", pt, ptlim); continue; case 'p': pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ? - tptr->pm : - tptr->am, + tptr->pm : tptr->am, pt, ptlim); continue; case 'R': @@ -339,11 +341,11 @@ continue; case 'u': /* - ** From Arnold Robbins' strftime version 3.0: - ** "ISO 8601: Weekday as a decimal number - ** [1 (Monday) - 7]" - ** (ado, 1993-05-24) - */ + * From Arnold Robbins' strftime version 3.0: + * "ISO 8601: Weekday as a decimal number + * [1 (Monday) - 7]" + * (ado, 1993-05-24) + */ pt = _conv((t->tm_wday == 0) ? DAYSPERWEEK : t->tm_wday, "%d", pt, ptlim); @@ -352,23 +354,23 @@ case 'G': /* ISO 8601 year (four digits) */ case 'g': /* ISO 8601 year (two digits) */ /* -** From Arnold Robbins' strftime version 3.0: "the week number of the -** year (the first Monday as the first day of week 1) as a decimal number -** (01-53)." -** (ado, 1993-05-24) -** -** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn: -** "Week 01 of a year is per definition the first week which has the -** Thursday in this year, which is equivalent to the week which contains -** the fourth day of January. In other words, the first week of a new year -** is the week which has the majority of its days in the new year. Week 01 -** might also contain days from the previous year and the week before week -** 01 of a year is the last week (52 or 53) of the previous year even if -** it contains days from the new year. A week starts with Monday (day 1) -** and ends with Sunday (day 7). For example, the first week of the year -** 1997 lasts from 1996-12-30 to 1997-01-05..." -** (ado, 1996-01-02) -*/ + * From Arnold Robbins' strftime version 3.0: "the week number of the + * year (the first Monday as the first day of week 1) as a decimal number + * (01-53)." + * (ado, 1993-05-24) + * + * From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn: + * "Week 01 of a year is per definition the first week which has the + * Thursday in this year, which is equivalent to the week which contains + * the fourth day of January. In other words, the first week of a new year + * is the week which has the majority of its days in the new year. Week 01 + * might also contain days from the previous year and the week before week + * 01 of a year is the last week (52 or 53) of the previous year even if + * it contains days from the new year. A week starts with Monday (day 1) + * and ends with Sunday (day 7). For example, the first week of the year + * 1997 lasts from 1996-12-30 to 1997-01-05..." + * (ado, 1996-01-02) + */ { int year; int base; @@ -389,15 +391,15 @@ DAYSPERLYEAR : DAYSPERNYEAR; /* - ** What yday (-3 ... 3) does - ** the ISO year begin on? - */ + * What yday (-3 ... 3) does + * the ISO year begin on? + */ bot = ((yday + 11 - wday) % DAYSPERWEEK) - 3; /* - ** What yday does the NEXT - ** ISO year begin on? - */ + * What yday does the NEXT + * ISO year begin on? + */ top = bot - (len % DAYSPERWEEK); if (top < -3) @@ -438,10 +440,10 @@ continue; case 'v': /* - ** From Arnold Robbins' strftime version 3.0: - ** "date as dd-bbb-YYYY" - ** (ado, 1993-05-24) - */ + * From Arnold Robbins' strftime version 3.0: + * "date as dd-bbb-YYYY" + * (ado, 1993-05-24) + */ pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp, loc); continue; case 'W': @@ -487,10 +489,10 @@ pt = _add(tzname[t->tm_isdst != 0], pt, ptlim); /* - ** C99 says that %Z must be replaced by the - ** empty string if the time zone is not - ** determinable. - */ + * C99 says that %Z must be replaced by the + * empty string if the time zone is not + * determinable. + */ continue; case 'z': { @@ -503,24 +505,24 @@ diff = t->TM_GMTOFF; #else /* !defined TM_GMTOFF */ /* - ** C99 says that the UTC offset must - ** be computed by looking only at - ** tm_isdst. This requirement is - ** incorrect, since it means the code - ** must rely on magic (in this case - ** altzone and timezone), and the - ** magic might not have the correct - ** offset. Doing things correctly is - ** tricky and requires disobeying C99; - ** see GNU C strftime for details. - ** For now, punt and conform to the - ** standard, even though it's incorrect. - ** - ** C99 says that %z must be replaced by the - ** empty string if the time zone is not - ** determinable, so output nothing if the - ** appropriate variables are not available. - */ + * C99 says that the UTC offset must + * be computed by looking only at + * tm_isdst. This requirement is + * incorrect, since it means the code + * must rely on magic (in this case + * altzone and timezone), and the + * magic might not have the correct + * offset. Doing things correctly is + * tricky and requires disobeying C99; + * see GNU C strftime for details. + * For now, punt and conform to the + * standard, even though it's incorrect. + * + * C99 says that %z must be replaced by the + * empty string if the time zone is not + * determinable, so output nothing if the + * appropriate variables are not available. + */ if (t->tm_isdst == 0) #ifdef USG_COMPAT diff = -timezone; @@ -537,7 +539,8 @@ if (diff < 0) { sign = "-"; diff = -diff; - } else sign = "+"; + } else + sign = "+"; pt = _add(sign, pt, ptlim); diff /= SECSPERMIN; diff = (diff / MINSPERHOUR) * 100 + @@ -567,10 +570,10 @@ goto label; case '%': /* - ** X311J/88-090 (4.12.3.5): if conversion char is - ** undefined, behavior is undefined. Print out the - ** character itself as printf(3) also does. - */ + * X311J/88-090 (4.12.3.5): if conversion char is + * undefined, behavior is undefined. Print out the + * character itself as printf(3) also does. + */ default: break; } @@ -579,7 +582,7 @@ break; *pt++ = *format; } - return pt; + return (pt); } static char * @@ -603,16 +606,16 @@ { while (pt < ptlim && (*pt = *str++) != '\0') ++pt; - return pt; + return (pt); } /* -** POSIX and the C Standard are unclear or inconsistent about -** what %C and %y do if the year is negative or exceeds 9999. -** Use the convention that %C concatenated with %y yields the -** same output as %Y, and that %Y contains at least 4 bytes, -** with more only if necessary. -*/ + * POSIX and the C Standard are unclear or inconsistent about + * what %C and %y do if the year is negative or exceeds 9999. + * Use the convention that %C concatenated with %y yields the + * same output as %Y, and that %Y contains at least 4 bytes, + * with more only if necessary. + */ static char * _yconv(a, b, convert_top, convert_yy, pt, ptlim) @@ -626,7 +629,7 @@ register int lead; register int trail; -#define DIVISOR 100 +#define DIVISOR 100 trail = a % DIVISOR + b % DIVISOR; lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR; trail %= DIVISOR; @@ -644,5 +647,5 @@ } if (convert_yy) pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim); - return pt; + return (pt); } Modified: soc2014/op/freebsd-base/lib/libc/stdtime/strptime.c ============================================================================== --- soc2014/op/freebsd-base/lib/libc/stdtime/strptime.c Thu Jun 19 15:52:46 2014 (r269761) +++ soc2014/op/freebsd-base/lib/libc/stdtime/strptime.c Thu Jun 19 16:00:23 2014 (r269762) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2014 Gary Mills + * Copyright 2011, Nexenta Systems, Inc. All rights reserved. * Copyright (c) 1994 Powerdog Industries. All rights reserved. * * Copyright (c) 2011 The FreeBSD Foundation @@ -56,7 +58,7 @@ static char * _strptime(const char *, const char *, struct tm *, int *, locale_t); -#define asizeof(a) (sizeof (a) / sizeof ((a)[0])) +#define asizeof(a) (sizeof (a) / sizeof ((a)[0])) static char * _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp, @@ -64,8 +66,7 @@ { char c; const char *ptr; - int i, - len; + int i, len; int Ealternative, Oalternative; struct lc_time_T *tptr = __get_current_time_locale(locale); @@ -82,7 +83,7 @@ isspace_l((unsigned char)*buf, locale)) buf++; else if (c != *buf++) - return 0; + return (NULL); continue; } @@ -94,18 +95,18 @@ case 0: case '%': if (*buf++ != '%') - return 0; + return (NULL); break; case '+': buf = _strptime(buf, tptr->date_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'C': if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); /* XXX This will break for 3-digit centuries. */ len = 2; @@ -116,21 +117,21 @@ len--; } if (i < 19) - return 0; + return (NULL); tm->tm_year = i * 100 - 1900; break; case 'c': buf = _strptime(buf, tptr->c_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'D': buf = _strptime(buf, "%m/%d/%y", tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'E': @@ -147,43 +148,43 @@ case 'F': buf = _strptime(buf, "%Y-%m-%d", tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'R': buf = _strptime(buf, "%H:%M", tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'r': buf = _strptime(buf, tptr->ampm_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'T': buf = _strptime(buf, "%H:%M:%S", tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'X': buf = _strptime(buf, tptr->X_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'x': buf = _strptime(buf, tptr->x_fmt, tm, GMTp, locale); - if (buf == 0) - return 0; + if (buf == NULL) + return (NULL); break; case 'j': if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 3; for (i = 0; len && *buf != 0 && @@ -193,7 +194,7 @@ len--; } if (i < 1 || i > 366) - return 0; + return (NULL); tm->tm_yday = i - 1; break; @@ -205,7 +206,7 @@ break; if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 2; for (i = 0; len && *buf != 0 && @@ -217,19 +218,14 @@ if (c == 'M') { if (i > 59) - return 0; + return (NULL); tm->tm_min = i; } else { if (i > 60) - return 0; + return (NULL); tm->tm_sec = i; } - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'H': @@ -245,7 +241,7 @@ * digits if used incorrectly. */ if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 2; for (i = 0; len && *buf != 0 && @@ -256,17 +252,12 @@ } if (c == 'H' || c == 'k') { if (i > 23) - return 0; + return (NULL); } else if (i > 12) - return 0; + return (NULL); tm->tm_hour = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'p': @@ -277,7 +268,7 @@ len = strlen(tptr->am); if (strncasecmp_l(buf, tptr->am, len, locale) == 0) { if (tm->tm_hour > 12) - return 0; + return (NULL); if (tm->tm_hour == 12) tm->tm_hour = 0; buf += len; @@ -287,14 +278,14 @@ len = strlen(tptr->pm); if (strncasecmp_l(buf, tptr->pm, len, locale) == 0) { if (tm->tm_hour > 12) - return 0; + return (NULL); if (tm->tm_hour != 12) tm->tm_hour += 12; buf += len; break; } - return 0; + return (NULL); case 'A': case 'a': @@ -309,7 +300,7 @@ break; } if (i == asizeof(tptr->weekday)) - return 0; + return (NULL); tm->tm_wday = i; buf += len; @@ -324,7 +315,7 @@ * range for now. */ if (!isdigit_l((unsigned char)*buf, locale)) - return 0; + return (NULL); len = 2; for (i = 0; len && *buf != 0 && @@ -334,44 +325,43 @@ len--; } if (i > 53) - return 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406191600.s5JG0OmP048428>