svn commit: r326656 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64
Author: bde Date: Thu Dec 7 07:55:38 2017 New Revision: 326656 URL: https://svnweb.freebsd.org/changeset/base/326656 Log: Move instantiation of msgbufp from 9 MD files to subr_prf.c. This variable should be pure MI except possibly for reading it in MD dump routines. Its initialization was pure MD in 4.4BSD, but FreeBSD changed this in r36441 in 1998. There were many imperfections in r36441. This commit fixes only a small one, to simplify fixing the others 1 arch at a time. (r47678 added support for special/early/multiple message buffer initialization which I want in a more general form, but this was too fragile to use because hacking on the msgbufp global corrupted it, and was only used for 5 hours in -current...) Modified: head/sys/amd64/amd64/machdep.c head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/i386/i386/pmap.c head/sys/kern/subr_prf.c head/sys/mips/mips/machdep.c head/sys/powerpc/powerpc/pmap_dispatch.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c Modified: head/sys/amd64/amd64/machdep.c == --- head/sys/amd64/amd64/machdep.c Thu Dec 7 05:55:18 2017 (r326655) +++ head/sys/amd64/amd64/machdep.c Thu Dec 7 07:55:38 2017 (r326656) @@ -184,8 +184,6 @@ struct init_ops init_ops = { */ extern char kernphys[]; -struct msgbuf *msgbufp; - /* * Physical address of the EFI System Table. Stashed from the metadata hints * passed into the kernel and used by the EFI code to call runtime services. Modified: head/sys/arm/arm/pmap-v4.c == --- head/sys/arm/arm/pmap-v4.c Thu Dec 7 05:55:18 2017(r326655) +++ head/sys/arm/arm/pmap-v4.c Thu Dec 7 07:55:38 2017(r326656) @@ -265,8 +265,6 @@ void(*pmap_copy_page_offs_func)(vm_paddr_t a_phys, int cnt); void (*pmap_zero_page_func)(vm_paddr_t, int, int); -struct msgbuf *msgbufp = NULL; - /* * Crashdump maps. */ Modified: head/sys/arm/arm/pmap-v6.c == --- head/sys/arm/arm/pmap-v6.c Thu Dec 7 05:55:18 2017(r326655) +++ head/sys/arm/arm/pmap-v6.c Thu Dec 7 07:55:38 2017(r326656) @@ -294,8 +294,6 @@ vm_paddr_t first_managed_pa; */ caddr_t _tmppt = 0; -struct msgbuf *msgbufp = NULL; /* XXX move it to machdep.c */ - /* * Crashdump maps. */ Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Thu Dec 7 05:55:18 2017(r326655) +++ head/sys/arm64/arm64/pmap.c Thu Dec 7 07:55:38 2017(r326656) @@ -221,8 +221,6 @@ vm_offset_t virtual_avail; /* VA of first avail page ( vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ vm_offset_t kernel_vm_end = 0; -struct msgbuf *msgbufp = NULL; - /* * Data for the pv entry allocation mechanism. * Updates to pv_invl_gen are protected by the pv_list_locks[] Modified: head/sys/i386/i386/pmap.c == --- head/sys/i386/i386/pmap.c Thu Dec 7 05:55:18 2017(r326655) +++ head/sys/i386/i386/pmap.c Thu Dec 7 07:55:38 2017(r326656) @@ -255,7 +255,6 @@ pt_entry_t *CMAP3; static pd_entry_t *KPTD; caddr_t ptvmmap = 0; caddr_t CADDR3; -struct msgbuf *msgbufp = NULL; /* * Crashdump maps. Modified: head/sys/kern/subr_prf.c == --- head/sys/kern/subr_prf.cThu Dec 7 05:55:18 2017(r326655) +++ head/sys/kern/subr_prf.cThu Dec 7 07:55:38 2017(r326656) @@ -122,6 +122,7 @@ static void snprintf_func(int ch, void *arg); static int msgbufmapped; /* Set when safe to use msgbuf */ int msgbuftrigger; +struct msgbuf *msgbufp; static int log_console_output = 1; SYSCTL_INT(_kern, OID_AUTO, log_console_output, CTLFLAG_RWTUN, Modified: head/sys/mips/mips/machdep.c == --- head/sys/mips/mips/machdep.cThu Dec 7 05:55:18 2017 (r326655) +++ head/sys/mips/mips/machdep.cThu Dec 7 07:55:38 2017 (r326656) @@ -318,8 +318,6 @@ cpu_initclocks(void) cpu_initclocks_bsp(); } -struct msgbuf *msgbufp = NULL; - /* * Initialize the hardware exception vectors, and the jump table used to * call locore cache and TLB management functions, based on the kind Modified: head/sys/powerpc/powerpc/pmap_dispatch.c == --- head/sys/powerpc/powerpc/pmap_dispatch.cThu Dec 7 05:55:18 2017 (r326655) +++ head/sys/powerpc/powerpc/pmap_dispatch.cThu Dec 7 07:55:38 20
svn commit: r326655 - head/sys/geom/raid
Author: eugen Date: Thu Dec 7 05:55:18 2017 New Revision: 326655 URL: https://svnweb.freebsd.org/changeset/base/326655 Log: Fix use-after-free that sometimes results in a garbage returned instead of right error code after requests to SINGLE/CONCAT volumes, f.e: # dd if=/dev/raid/r0 bs=512 of=/dev/null dd: /dev/raid/r0: Unknown error: -559038242 Reviewed by: avg (mentor), mav (mentor) MFC after:3 days Modified: head/sys/geom/raid/tr_concat.c Modified: head/sys/geom/raid/tr_concat.c == --- head/sys/geom/raid/tr_concat.c Thu Dec 7 04:55:31 2017 (r326654) +++ head/sys/geom/raid/tr_concat.c Thu Dec 7 05:55:18 2017 (r326655) @@ -341,7 +341,7 @@ g_raid_tr_iodone_concat(struct g_raid_tr_object *tr, pbp->bio_inbed++; if (pbp->bio_children == pbp->bio_inbed) { pbp->bio_completed = pbp->bio_length; - g_raid_iodone(pbp, bp->bio_error); + g_raid_iodone(pbp, pbp->bio_error); } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326654 - head/sbin/ifconfig
Author: bryanv Date: Thu Dec 7 04:55:31 2017 New Revision: 326654 URL: https://svnweb.freebsd.org/changeset/base/326654 Log: Use consistent name for the vxlan VNI parameter name and provide shorthand Submitted by: hrs MFC after:1 month Differential Revision:https://reviews.freebsd.org/D2868 Modified: head/sbin/ifconfig/ifvxlan.c Modified: head/sbin/ifconfig/ifvxlan.c == --- head/sbin/ifconfig/ifvxlan.cThu Dec 7 03:57:11 2017 (r326653) +++ head/sbin/ifconfig/ifvxlan.cThu Dec 7 04:55:31 2017 (r326654) @@ -594,6 +594,7 @@ setvxlan_flush(const char *val, int d, int s, const st static struct cmd vxlan_cmds[] = { + DEF_CLONE_CMD_ARG("vni",setvxlan_vni), DEF_CLONE_CMD_ARG("vxlanid",setvxlan_vni), DEF_CLONE_CMD_ARG("vxlanlocal", setvxlan_local), DEF_CLONE_CMD_ARG("vxlanremote",setvxlan_remote), @@ -608,7 +609,8 @@ static struct cmd vxlan_cmds[] = { DEF_CLONE_CMD("vxlanlearn", 1, setvxlan_learn), DEF_CLONE_CMD("-vxlanlearn", 0, setvxlan_learn), - DEF_CMD_ARG("vxlanvni", setvxlan_vni), + DEF_CMD_ARG("vni", setvxlan_vni), + DEF_CMD_ARG("vxlanid", setvxlan_vni), DEF_CMD_ARG("vxlanlocal", setvxlan_local), DEF_CMD_ARG("vxlanremote", setvxlan_remote), DEF_CMD_ARG("vxlangroup", setvxlan_group), ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326626 - head/lib/libproc
On Wed, 6 Dec 2017, Mark Johnston wrote: Log: Use a global extern declaration to appease gcc. Why not do this to fix the bug which is reported by gcc as requested by using -Wnested-externs (given by WARNS?=6 in ../Makefile.inc). clang doesn't suuport this option except in a broken way by ignoring it. -Wnested-includes is turned off for CXX in sys.mk, but that doesn't apply here. Modified: head/lib/libproc/proc_create.c == --- head/lib/libproc/proc_create.c Wed Dec 6 17:50:10 2017 (r326625) +++ head/lib/libproc/proc_create.c Wed Dec 6 17:52:01 2017 (r326626) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include "_libproc.h" +extern char * const *environ; + static int getelfclass(int); static int proc_init(pid_t, int, int, struct proc_handle **); @@ -179,7 +181,6 @@ int proc_create(const char *file, char * const *argv, char * const *envp, proc_child_func *pcf, void *child_arg, struct proc_handle **pphdl) { - extern char * const *environ; struct proc_handle *phdl; int error, status; pid_t pid; This is still broken. 'environ' is hard to use since it is not declared in any standard header, but it has a whole man page environ(7) whose synoposis declares it as char **. The type mismatch is not detected because no header files that declares 'environ' is included (because none exists). 'environ' is also documented in exec(3) and posix_spawn(3). 'environ' is correctly declared in all 9 other source files and 3 man pages in /usr/src/lib/ that declare it. Declaring it as extern in file scope is worse in some ways that declaring it in block scope, since it breaks this warning so that the bug of misdeclaring it is harder to notice. WARNS=6 also enables -Wredundant-decls to detect this bug when it is only a style bug. Normally variables are declared in headers, so redeclaring them in .c files is a type mismatch if the declarations are compatible (not necessarily the same) and a style bug if they are compatible. gcc up to least 4.2.1] has some bugs involving it not understanding redundancy. clang silently ignores this option too. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326651 - in head/bin: cat date kenv setfacl sh
[ Charset UTF-8 unsupported, converting... ] > Author: bjk (doc committer) > Date: Thu Dec 7 01:57:27 2017 > New Revision: 326651 > URL: https://svnweb.freebsd.org/changeset/base/326651 > > Log: > Fix mandoc -Tlint warnings in bin/ > > Many style-level issues are still reported. It helps to clarify that .Dd was not needing a bumped if you add an additional line in the commit log that says something like "No (meaningful) content changed" or "Markup change only". Thanks, > Submitted by: Yuri Pankov > Reviewed by:jilles (previous revision) > Differential Revision: https://reviews.freebsd.org/D13334 > > Modified: > head/bin/cat/cat.1 > head/bin/date/date.1 > head/bin/kenv/kenv.1 > head/bin/setfacl/setfacl.1 > head/bin/sh/sh.1 > > Modified: head/bin/cat/cat.1 ... -- Rod Grimes rgri...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326652 - in head/usr.bin/dc: . tests
Author: asomers Date: Thu Dec 7 02:08:55 2017 New Revision: 326652 URL: https://svnweb.freebsd.org/changeset/base/326652 Log: dc(1): fix modulo operations with fractional inputs Our dc(1) has never correctly calculated remainders with fractional inputs. Both bmod and bdivmod seem to have copy/pasted code from bdiv, which results in the remainder having the wrong output scale. PR: 162495 Reported by: anonymous Reviewed by: pfg Differential Revision:https://reviews.freebsd.org/D13390 Added: head/usr.bin/dc/tests/bcode.sh (contents, props changed) Modified: head/usr.bin/dc/bcode.c head/usr.bin/dc/dc.1 head/usr.bin/dc/tests/Makefile head/usr.bin/dc/tests/inout.sh Modified: head/usr.bin/dc/bcode.c == --- head/usr.bin/dc/bcode.c Thu Dec 7 01:57:27 2017(r326651) +++ head/usr.bin/dc/bcode.c Thu Dec 7 02:08:55 2017(r326652) @@ -1096,13 +1096,13 @@ bmod(void) r = new_number(); scale = max(a->scale, b->scale); - r->scale = max(b->scale, a->scale + bmachine.scale); + r->scale = scale; if (BN_is_zero(a->number)) warnx("remainder by zero"); else { normalize(a, scale); - normalize(b, scale + bmachine.scale); + normalize(b, scale); ctx = BN_CTX_new(); bn_checkp(ctx); @@ -1117,7 +1117,7 @@ bmod(void) static void bdivmod(void) { - struct number *a, *b, *rdiv, *rmod; + struct number *a, *b, *frac, *quotient, *rdiv, *remainder; BN_CTX *ctx; u_int scale; @@ -1131,25 +1131,44 @@ bdivmod(void) } rdiv = new_number(); - rmod = new_number(); - rdiv->scale = bmachine.scale; - rmod->scale = max(b->scale, a->scale + bmachine.scale); + quotient = new_number(); + remainder = new_number(); scale = max(a->scale, b->scale); + rdiv->scale = 0; + remainder->scale = scale; + quotient->scale = bmachine.scale; + scale = max(a->scale, b->scale); if (BN_is_zero(a->number)) warnx("divide by zero"); else { normalize(a, scale); - normalize(b, scale + bmachine.scale); + normalize(b, scale); ctx = BN_CTX_new(); bn_checkp(ctx); - bn_check(BN_div(rdiv->number, rmod->number, + /* +* Unlike other languages' divmod operations, dc is specified +* to return the remainder and the full quotient, rather than +* the remainder and the floored quotient. bn(3) has no +* function to calculate both. So we'll use BN_div to get the +* remainder and floored quotient, then calculate the full +* quotient from those. +* +* quotient = rdiv + remainder / divisor +*/ + bn_check(BN_div(rdiv->number, remainder->number, b->number, a->number, ctx)); + frac = div_number(remainder, a, bmachine.scale); + normalize(rdiv, bmachine.scale); + normalize(remainder, scale); + bn_check(BN_add(quotient->number, rdiv->number, frac->number)); + free_number(frac); BN_CTX_free(ctx); } - push_number(rdiv); - push_number(rmod); + push_number(quotient); + push_number(remainder); + free_number(rdiv); free_number(a); free_number(b); } Modified: head/usr.bin/dc/dc.1 == --- head/usr.bin/dc/dc.1Thu Dec 7 01:57:27 2017(r326651) +++ head/usr.bin/dc/dc.1Thu Dec 7 02:08:55 2017(r326652) @@ -35,7 +35,7 @@ .\" .\"@(#)dc.18.1 (Berkeley) 6/6/93 .\" -.Dd February 27, 2017 +.Dd December 5, 2017 .Dt DC 1 .Os .Sh NAME @@ -139,8 +139,8 @@ The two entries are popped off the stack; the result is pushed on the stack in their place. Any fractional part of an exponent is ignored. .Pp -For addition and subtraction, the scale of the result is the maximum -of scales of the operands. +For addition, subtraction, and remainder, the scale of the result is the +maximum of scales of the operands. For division the scale of the result is defined by the scale set by the .Ic k Modified: head/usr.bin/dc/tests/Makefile == --- head/usr.bin/dc/tests/Makefile Thu Dec 7 01:57:27 2017 (r326651) +++ head/usr.bin/dc/tests/Makefile Thu Dec 7 02:08:55 2017 (r326652) @@ -3,5 +3,6 @@ PACKAGE= tests ATF_TESTS_SH= inout +ATF_TESTS_SH+= bcode .include Added: head/usr.bin/dc/tests/bcode.sh ===
svn commit: r326651 - in head/bin: cat date kenv setfacl sh
Author: bjk (doc committer) Date: Thu Dec 7 01:57:27 2017 New Revision: 326651 URL: https://svnweb.freebsd.org/changeset/base/326651 Log: Fix mandoc -Tlint warnings in bin/ Many style-level issues are still reported. Submitted by: Yuri Pankov Reviewed by: jilles (previous revision) Differential Revision:https://reviews.freebsd.org/D13334 Modified: head/bin/cat/cat.1 head/bin/date/date.1 head/bin/kenv/kenv.1 head/bin/setfacl/setfacl.1 head/bin/sh/sh.1 Modified: head/bin/cat/cat.1 == --- head/bin/cat/cat.1 Thu Dec 7 01:50:17 2017(r326650) +++ head/bin/cat/cat.1 Thu Dec 7 01:57:27 2017(r326651) @@ -195,8 +195,8 @@ utility appeared in .At v1 . .An Dennis Ritchie designed and wrote the first man page. -It appears to have been -.Xr cat 1 . +It appears to have been for +.Nm . .Sh BUGS Because of the shell language mechanism used to perform output redirection, the command Modified: head/bin/date/date.1 == --- head/bin/date/date.1Thu Dec 7 01:50:17 2017(r326650) +++ head/bin/date/date.1Thu Dec 7 01:57:27 2017(r326651) @@ -131,7 +131,8 @@ The option suppresses this behavior and causes the time to be set only on the current machine. .It Fl R -Use RFC 2822 date and time output format. This is equivalent to use +Use RFC 2822 date and time output format. +This is equivalent to using .Dq Li %a, %d %b %Y \&%T %z as .Ar output_fmt Modified: head/bin/kenv/kenv.1 == --- head/bin/kenv/kenv.1Thu Dec 7 01:50:17 2017(r326650) +++ head/bin/kenv/kenv.1Thu Dec 7 01:57:27 2017(r326651) @@ -91,11 +91,17 @@ The file can contain lines of the form .Pp .Dl name = "value" # this is a comment .Pp -where whitespace around name and '=', and -everything after a '#' character, are ignored. Almost any printable -character except '=' is acceptable as part of a name. Quotes -are optional and necessary only if the value contains -whitespace. +where whitespace around +.Sq name +and +.Sq = , +and everything after a +.Sq # +character, are ignored. +Almost any printable character except +.Sq = +is acceptable as part of a name. +Quotes are optional and necessary only if the value contains whitespace. .Sh SEE ALSO .Xr kenv 2 , .Xr config 5 , Modified: head/bin/setfacl/setfacl.1 == --- head/bin/setfacl/setfacl.1 Thu Dec 7 01:50:17 2017(r326650) +++ head/bin/setfacl/setfacl.1 Thu Dec 7 01:57:27 2017(r326651) @@ -114,7 +114,8 @@ is the input is taken from stdin. .It Fl n Do not recalculate the permissions associated with the ACL -mask entry. This option is not applicable to NFSv4 ACLs. +mask entry. +This option is not applicable to NFSv4 ACLs. .It Fl x Ar entries | position If .Ar entries @@ -291,7 +292,8 @@ specifying the access granted to the owner of the file .Dq Li group@ specifying the access granted to the file owning group; .Dq Li everyone@ -specifying everyone. Note that +specifying everyone. +Note that .Dq Li everyone@ is not the same as traditional Unix .Dq Li other @@ -301,8 +303,8 @@ literally, everyone, including file owner and owning g The ACL qualifier field describes the user or group associated with the ACL entry. It may consist of one of the following: uid or -user name, or gid or group name. In entries whose tag type is -one of +user name, or gid or group name. +In entries whose tag type is one of .Dq Li owner@ , .Dq Li group@ , or Modified: head/bin/sh/sh.1 == --- head/bin/sh/sh.1Thu Dec 7 01:50:17 2017(r326650) +++ head/bin/sh/sh.1Thu Dec 7 01:57:27 2017(r326651) @@ -1033,7 +1033,7 @@ The syntax of the command is: .Bd -unfilled -offset indent -compact .Ic case Ar word Ic in -.Ar pattern Ns ) Ar list Li ;; +.Ar pattern ) Ar list Li ;; .Ar ... .Ic esac .Ed ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326650 - head/lib/libc/sys
Author: bjk (doc committer) Date: Thu Dec 7 01:50:17 2017 New Revision: 326650 URL: https://svnweb.freebsd.org/changeset/base/326650 Log: Note that old sys/event.h required manual sys/types.h inclusion ed fixed this in r313704 but older versions are still affected. Modified: head/lib/libc/sys/kqueue.2 Modified: head/lib/libc/sys/kqueue.2 == --- head/lib/libc/sys/kqueue.2 Thu Dec 7 01:49:35 2017(r326649) +++ head/lib/libc/sys/kqueue.2 Thu Dec 7 01:50:17 2017(r326650) @@ -782,8 +782,9 @@ The value is limited to 24 hours; longer timeouts will be silently reinterpreted as 24 hours. .Pp -Previous versions of +In versions older than +.Fx 12.0 , .In sys/event.h -fail to parse without including +failed to parse without including .In sys/types.h manually. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326649 - in head/targets/pseudo/userland: . lib
Author: bdrewery Date: Thu Dec 7 01:49:35 2017 New Revision: 326649 URL: https://svnweb.freebsd.org/changeset/base/326649 Log: Disconnect OFED after r326169 broke all DIRDEPS support for it. Modified: head/targets/pseudo/userland/Makefile.depend head/targets/pseudo/userland/lib/Makefile.depend Modified: head/targets/pseudo/userland/Makefile.depend == --- head/targets/pseudo/userland/Makefile.dependThu Dec 7 00:31:28 2017(r326648) +++ head/targets/pseudo/userland/Makefile.dependThu Dec 7 01:49:35 2017(r326649) @@ -894,27 +894,6 @@ DIRDEPS+= usr.sbin/cxgbetool DIRDEPS+= usr.bin/dtc .endif -.if ${MK_OFED} != "no" -DIRDEPS+= \ - contrib/ofed/usr.bin/ibaddr \ - contrib/ofed/usr.bin/ibnetdiscover \ - contrib/ofed/usr.bin/ibping \ - contrib/ofed/usr.bin/ibportstate \ - contrib/ofed/usr.bin/ibroute \ - contrib/ofed/usr.bin/ibsendtrap \ - contrib/ofed/usr.bin/ibstat \ - contrib/ofed/usr.bin/ibsysstat \ - contrib/ofed/usr.bin/ibtracert \ - contrib/ofed/usr.bin/opensm \ - contrib/ofed/usr.bin/osmtest \ - contrib/ofed/usr.bin/perfquery \ - contrib/ofed/usr.bin/saquery \ - contrib/ofed/usr.bin/sminfo \ - contrib/ofed/usr.bin/smpdump \ - contrib/ofed/usr.bin/smpquery \ - contrib/ofed/usr.bin/vendstat -.endif - DIRDEPS+= ${DIRDEPS.${MACHINE}:U} Modified: head/targets/pseudo/userland/lib/Makefile.depend == --- head/targets/pseudo/userland/lib/Makefile.dependThu Dec 7 00:31:28 2017(r326648) +++ head/targets/pseudo/userland/lib/Makefile.dependThu Dec 7 01:49:35 2017(r326649) @@ -242,22 +242,6 @@ DIRDEPS+= \ lib/libpmcstat .endif -.if ${MK_OFED} != "no" -DIRDEPS+= \ - contrib/ofed/usr.lib/libcxgb4 \ - contrib/ofed/usr.lib/libibcm \ - contrib/ofed/usr.lib/libibcommon \ - contrib/ofed/usr.lib/libibmad \ - contrib/ofed/usr.lib/libibumad \ - contrib/ofed/usr.lib/libibverbs \ - contrib/ofed/usr.lib/libmlx4 \ - contrib/ofed/usr.lib/libopensm \ - contrib/ofed/usr.lib/libosmcomp \ - contrib/ofed/usr.lib/libosmvendor \ - contrib/ofed/usr.lib/librdmacm \ - contrib/ofed/usr.lib/libsdp -.endif - .if ${MK_BLACKLIST_SUPPORT} != "no" DIRDEPS+= lib/libblacklist .endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 12/6/2017 4:53 PM, Hans Petter Selasky wrote: > On 12/07/17 01:38, Bryan Drewery wrote: >> 1. SUBDIR=../../somewhere else is inherently wrong. >> 2. Building a library from a directory named '2' is wrong. >> 3. Not just using proper SUBDIR_DEPEND and making all these subdirs is >> not needed and complicates things MORE by splitting them all up. >> 4. Building a library from a directory where its real bsd.lib.mk is not >> at is wrong. >> 5. Depending on an include directory in the Makefile.inc1 library >> dependencies is simply not needed - I told you that. > > Try building the COMPAT 32-bit libraries with OFED and you'll see that > this is needed! > >> 6. Using these /0 /1 /2 /3 directories actually hurts the 'make >> libraries' parallelism/dependency graph. It ends up building /1 rather >> than building libibcm and libibumad directly in its graph. It creates >> an indirection which adds more unneeded submake recursion. > > I think this is no argument over having to maintain and update > Makefile.inc1 with all the dependencies every time there is a change or > new driver library added to OFED. Here's the proper change to contrib/ofed/usr.lib/Makefile, it is trivial. > diff --git contrib/ofed/usr.lib/Makefile contrib/ofed/usr.lib/Makefile > index 47b97591f5b7..9c22b889fa19 100644 > --- contrib/ofed/usr.lib/Makefile > +++ contrib/ofed/usr.lib/Makefile > @@ -1,13 +1,24 @@ > -SUBDIR=libibcommon libibmad libibumad libibverbs libmlx4 libmthca \ > - libopensm libosmcomp libosmvendor libibcm librdmacm libsdp libcxgb4 > +SUBDIR= \ > + libibverbs \ > + libibcm \ > + libibumad \ > + librdmacm \ > + libibmad \ > + libosmcomp \ > + libosmvendor \ > + libcxgb4 \ > + libmlx4 \ > + libmlx5 \ > + libibnetdisc \ > + libopensm > > SUBDIR_DEPEND_libcxgb4=libibverbs > SUBDIR_DEPEND_libibcm= libibverbs > -SUBDIR_DEPEND_libibmad= libibcommon libibumad > -SUBDIR_DEPEND_libibumad= libibcommon > +SUBDIR_DEPEND_libibmad=libibumad > +SUBDIR_DEPEND_libibnetdisc=libosmcomp libibmad libibumad > SUBDIR_DEPEND_libmlx4= libibverbs > -SUBDIR_DEPEND_libmthca=libibverbs > -SUBDIR_DEPEND_libosmvendor=libibumad libopensm libosmcomp > +SUBDIR_DEPEND_libmlx5= libibverbs > +SUBDIR_DEPEND_libosmvendor=libibumad > SUBDIR_DEPEND_librdmacm= libibverbs > SUBDIR_PARALLEL= > And Makefile.inc1 which is even more simple. > @@ -2365,14 +2414,12 @@ _lib_libradius= lib/libradius > .if ${MK_OFED} != "no" > _ofed_lib= contrib/ofed/usr.lib > _prebuild_libs+= contrib/ofed/usr.lib/libosmcomp > -_prebuild_libs+= contrib/ofed/usr.lib/libopensm > -_prebuild_libs+= contrib/ofed/usr.lib/libibcommon > _prebuild_libs+= contrib/ofed/usr.lib/libibverbs > +_prebuild_libs+= contrib/ofed/usr.lib/libibmad > _prebuild_libs+= contrib/ofed/usr.lib/libibumad > > -contrib/ofed/usr.lib/libopensm__L: lib/libthr__L > contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L > -contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L > +contrib/ofed/usr.lib/libibmad__L: contrib/ofed/usr.lib/libibumad__L > .endif -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 12/6/2017 4:53 PM, Hans Petter Selasky wrote: > It would be nice if these utilities can be built standalone, outside the > buildworld target aswell. I've suggested adding an "all-install" variant > to make. Having to kick a buildworld to test-build contrib/ofed is quite > overkill, and that is some of reasoning behind the current Makefile layout. This is what buildworld+SUBDIR_OVERRIDE is for. The following patch also mitigates the need to install libraries for build testing which I'll commit tomorrow: > commit 7cce144e821cbf2f4e70711928a8945137700b35 (HEAD -> master) > Author: Bryan Drewery > Date: Wed Dec 6 17:29:57 2017 -0800 > > Look for libraries in OBJDIR when building outside of buildworld. > > This allows build testing more easily without establishing a sysroot > or installing the files. > > Sponsored by: Dell EMC > > diff --git share/mk/src.libnames.mk share/mk/src.libnames.mk > index 2d172197ac53..fdd1a4866620 100644 > --- share/mk/src.libnames.mk > +++ share/mk/src.libnames.mk > @@ -359,7 +359,7 @@ LIB${_l:tu}?= > ${LIBDESTDIR}${LIBDIR_BASE}/libprivate${_l}.a > .endfor > > .for _l in ${_LIBRARIES} > -.if ${_INTERNALLIBS:M${_l}} > +.if ${_INTERNALLIBS:M${_l}} || !defined(SYSROOT) > LDADD_${_l}_L+=-L${LIB${_l:tu}DIR} > .endif > DPADD_${_l}?= ${LIB${_l:tu}} -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 12/6/2017 4:53 PM, Hans Petter Selasky wrote: > On 12/07/17 01:38, Bryan Drewery wrote: >> 1. SUBDIR=../../somewhere else is inherently wrong. >> 2. Building a library from a directory named '2' is wrong. >> 3. Not just using proper SUBDIR_DEPEND and making all these subdirs is >> not needed and complicates things MORE by splitting them all up. >> 4. Building a library from a directory where its real bsd.lib.mk is not >> at is wrong. >> 5. Depending on an include directory in the Makefile.inc1 library >> dependencies is simply not needed - I told you that. > > Try building the COMPAT 32-bit libraries with OFED and you'll see that > this is needed! > No. The proper fix is to add contrib/ofed/include to the _LC_INCDIRS.${MK_OFED:tl} list in Makefile.libcompat. Just looking at the lib32 build you can see 'includes' is only called on a subset of directories via _LC_INCDIRS. >> 6. Using these /0 /1 /2 /3 directories actually hurts the 'make >> libraries' parallelism/dependency graph. It ends up building /1 rather >> than building libibcm and libibumad directly in its graph. It creates >> an indirection which adds more unneeded submake recursion. > > I think this is no argument over having to maintain and update > Makefile.inc1 with all the dependencies every time there is a change or > new driver library added to OFED. The argument is that it's how things are done. If you come up with a brilliant solution to make Makefile.inc1 library dependencies simpler, GREAT! But the one you have put in here is totally bogus. > >> >> The whole thing needlessly obfuscates these libraries. >> >> It's fine, I'm going to rewrite it all now. > > It would be nice if these utilities can be built standalone, outside the > buildworld target aswell. I've suggested adding an "all-install" variant They mostly can, but building things directly with the current build system simply won't create a SYSROOT or do cross-directory dependencies properly. That's what DIRDEPS_BUILD does. Again, if you had invented some great solution to make this simpler that would be good, but that's not what you have here. You have simply made changes to simply build ordering in contrib/ofed when not in buildworld, but that's not even needed if you use the proper SUBDIR and SUBDIR_DEPEND. > to make. Having to kick a buildworld to test-build contrib/ofed is quite > overkill, and that is some of reasoning behind the current Makefile layout. > > 6: When a set of libraries should be built in order, it is more clean to > have 4 dependencies, than a bunch of them in my opinion. Creating rats nest dependency lists is not proper or easier to maintain or cleaner at all. It's wrong. > > You can use the updated "tools/make_libdeps.sh" to figure this out. > > The old approach with > _prebuild_libs+= > > won't work :-( > I told you before how to make it work. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 12/07/17 01:38, Bryan Drewery wrote: 1. SUBDIR=../../somewhere else is inherently wrong. 2. Building a library from a directory named '2' is wrong. 3. Not just using proper SUBDIR_DEPEND and making all these subdirs is not needed and complicates things MORE by splitting them all up. 4. Building a library from a directory where its real bsd.lib.mk is not at is wrong. 5. Depending on an include directory in the Makefile.inc1 library dependencies is simply not needed - I told you that. Try building the COMPAT 32-bit libraries with OFED and you'll see that this is needed! 6. Using these /0 /1 /2 /3 directories actually hurts the 'make libraries' parallelism/dependency graph. It ends up building /1 rather than building libibcm and libibumad directly in its graph. It creates an indirection which adds more unneeded submake recursion. I think this is no argument over having to maintain and update Makefile.inc1 with all the dependencies every time there is a change or new driver library added to OFED. The whole thing needlessly obfuscates these libraries. It's fine, I'm going to rewrite it all now. It would be nice if these utilities can be built standalone, outside the buildworld target aswell. I've suggested adding an "all-install" variant to make. Having to kick a buildworld to test-build contrib/ofed is quite overkill, and that is some of reasoning behind the current Makefile layout. 6: When a set of libraries should be built in order, it is more clean to have 4 dependencies, than a bunch of them in my opinion. You can use the updated "tools/make_libdeps.sh" to figure this out. The old approach with _prebuild_libs+= won't work :-( --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 12/6/2017 4:48 PM, Bryan Drewery wrote: > On 12/6/2017 4:38 PM, Bryan Drewery wrote: >> On 12/6/2017 4:28 PM, Hans Petter Selasky wrote: >>> On 12/07/17 01:10, Bryan Drewery wrote: I'm a bit speechless. Why?? The old version was 90% fine and I sent you advice on how to make it work with the new layout. >>> >>> Hi, >>> >>> I tried to listen to your advice, splitting up the Makefiles, not >>> listing every dependency. Further how the OFED libraries are linked has >>> changed. Two iterations for building the OFED libraries is not enough, >>> like before. We really need four iterations. >>> >>> I don't see how the current approach is "wrong". Can you explain a bit >>> more? >> >> 1. SUBDIR=../../somewhere else is inherently wrong. >> 2. Building a library from a directory named '2' is wrong. >> 3. Not just using proper SUBDIR_DEPEND and making all these subdirs is >> not needed and complicates things MORE by splitting them all up. >> 4. Building a library from a directory where its real bsd.lib.mk is not >> at is wrong. >> 5. Depending on an include directory in the Makefile.inc1 library >> dependencies is simply not needed - I told you that. >> 6. Using these /0 /1 /2 /3 directories actually hurts the 'make >> libraries' parallelism/dependency graph. It ends up building /1 rather >> than building libibcm and libibumad directly in its graph. It creates >> an indirection which adds more unneeded submake recursion. >> >> The whole thing needlessly obfuscates these libraries. >> >> It's fine, I'm going to rewrite it all now. >> > > 7. We don't put FreeBSD Makefiles in the same directory as contributed > files. It's against the pattern. So moving contrib/ofed/usr.lib/* to > contrib/ofed/*/ is wrong. It complicates future merges of contrib code. > Really none of these Makefiles should be in contrib/ofed - the proper > thing would be to move them out, not to inline them with the contributed > code. > 8. And you blew away my Makefile.depend files, which I do normally say I'll deal with, but a far simpler directory structure movement would have easily kept them and I could have updated them. But now there's not even something to start from since they were deleted for no reason. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 12/6/2017 4:38 PM, Bryan Drewery wrote: > On 12/6/2017 4:28 PM, Hans Petter Selasky wrote: >> On 12/07/17 01:10, Bryan Drewery wrote: >>> I'm a bit speechless. Why?? The old version was 90% fine and I sent >>> you advice on how to make it work with the new layout. >> >> Hi, >> >> I tried to listen to your advice, splitting up the Makefiles, not >> listing every dependency. Further how the OFED libraries are linked has >> changed. Two iterations for building the OFED libraries is not enough, >> like before. We really need four iterations. >> >> I don't see how the current approach is "wrong". Can you explain a bit >> more? > > 1. SUBDIR=../../somewhere else is inherently wrong. > 2. Building a library from a directory named '2' is wrong. > 3. Not just using proper SUBDIR_DEPEND and making all these subdirs is > not needed and complicates things MORE by splitting them all up. > 4. Building a library from a directory where its real bsd.lib.mk is not > at is wrong. > 5. Depending on an include directory in the Makefile.inc1 library > dependencies is simply not needed - I told you that. > 6. Using these /0 /1 /2 /3 directories actually hurts the 'make > libraries' parallelism/dependency graph. It ends up building /1 rather > than building libibcm and libibumad directly in its graph. It creates > an indirection which adds more unneeded submake recursion. > > The whole thing needlessly obfuscates these libraries. > > It's fine, I'm going to rewrite it all now. > 7. We don't put FreeBSD Makefiles in the same directory as contributed files. It's against the pattern. So moving contrib/ofed/usr.lib/* to contrib/ofed/*/ is wrong. It complicates future merges of contrib code. Really none of these Makefiles should be in contrib/ofed - the proper thing would be to move them out, not to inline them with the contributed code. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 12/6/2017 4:28 PM, Hans Petter Selasky wrote: > On 12/07/17 01:10, Bryan Drewery wrote: >> I'm a bit speechless. Why?? The old version was 90% fine and I sent >> you advice on how to make it work with the new layout. > > Hi, > > I tried to listen to your advice, splitting up the Makefiles, not > listing every dependency. Further how the OFED libraries are linked has > changed. Two iterations for building the OFED libraries is not enough, > like before. We really need four iterations. > > I don't see how the current approach is "wrong". Can you explain a bit > more? 1. SUBDIR=../../somewhere else is inherently wrong. 2. Building a library from a directory named '2' is wrong. 3. Not just using proper SUBDIR_DEPEND and making all these subdirs is not needed and complicates things MORE by splitting them all up. 4. Building a library from a directory where its real bsd.lib.mk is not at is wrong. 5. Depending on an include directory in the Makefile.inc1 library dependencies is simply not needed - I told you that. 6. Using these /0 /1 /2 /3 directories actually hurts the 'make libraries' parallelism/dependency graph. It ends up building /1 rather than building libibcm and libibumad directly in its graph. It creates an indirection which adds more unneeded submake recursion. The whole thing needlessly obfuscates these libraries. It's fine, I'm going to rewrite it all now. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
svn commit: r326647 - head
Author: bdrewery Date: Thu Dec 7 00:31:10 2017 New Revision: 326647 URL: https://svnweb.freebsd.org/changeset/base/326647 Log: Revert r325529: No longer needed after r325699. Sponsored by: Dell EMC Modified: head/Makefile Modified: head/Makefile == --- head/Makefile Wed Dec 6 23:24:11 2017(r326646) +++ head/Makefile Thu Dec 7 00:31:10 2017(r326647) @@ -577,7 +577,7 @@ universe_${target}_kernels: universe_${target}_prologu "check _.${target}.makeLINT for details"| ${MAKEFAIL})) .endif @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \ - universe_kernels MK_AUTO_OBJ=no + universe_kernels .endif # !MAKE_JUST_WORLDS # Tell the user the worlds and kernels have completed ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 12/07/17 01:10, Bryan Drewery wrote: I'm a bit speechless. Why?? The old version was 90% fine and I sent you advice on how to make it work with the new layout. Hi, I tried to listen to your advice, splitting up the Makefiles, not listing every dependency. Further how the OFED libraries are linked has changed. Two iterations for building the OFED libraries is not enough, like before. We really need four iterations. I don't see how the current approach is "wrong". Can you explain a bit more? --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326648 - head
Author: bdrewery Date: Thu Dec 7 00:31:28 2017 New Revision: 326648 URL: https://svnweb.freebsd.org/changeset/base/326648 Log: tinderbox/universe: Don't execute KERNCONFS lookup if not needed. Sponsored by: Dell EMC Modified: head/Makefile Modified: head/Makefile == --- head/Makefile Thu Dec 7 00:31:10 2017(r326647) +++ head/Makefile Thu Dec 7 00:31:28 2017(r326648) @@ -585,6 +585,7 @@ universe_${target}: universe_${target}_done universe_${target}_done: @echo ">> ${target} completed on `LC_ALL=C date`" .endfor +.if make(universe_kernconfs) || make(universe_kernels) universe_kernels: universe_kernconfs .PHONY .if !defined(TARGET) TARGET!= uname -m @@ -621,6 +622,7 @@ universe_kernconf_${TARGET}_${kernel}: .MAKE (echo "${TARGET} ${kernel} kernel failed," \ "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL})) .endfor +.endif # make(universe_kernels) universe: universe_epilogue universe_epilogue: .PHONY @echo "--" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326169 - in head: . contrib/ofed lib/libc/locale share/mk sys/amd64/amd64 sys/amd64/conf sys/conf sys/contrib/rdma/krping sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys
On 11/24/2017 6:50 AM, Hans Petter Selasky wrote: > Modified: head/Makefile.inc1 > == > --- head/Makefile.inc1Fri Nov 24 14:29:32 2017(r326168) > +++ head/Makefile.inc1Fri Nov 24 14:50:28 2017(r326169) > @@ -2410,16 +2410,24 @@ _lib_libradius= lib/libradius > .endif > > .if ${MK_OFED} != "no" > -_ofed_lib= contrib/ofed/usr.lib > -_prebuild_libs+= contrib/ofed/usr.lib/libosmcomp > -_prebuild_libs+= contrib/ofed/usr.lib/libopensm > -_prebuild_libs+= contrib/ofed/usr.lib/libibcommon > -_prebuild_libs+= contrib/ofed/usr.lib/libibverbs > -_prebuild_libs+= contrib/ofed/usr.lib/libibumad > +# > +# The OFED libraries are built in four steps > +# as reflected below, due to interdependencies. > +# > +# NOTE: Depending on contrib/ofed/include is only needed for > +# the lib32 compat build. > +# > +_ofed_lib= \ > +contrib/ofed/include \ > +contrib/ofed/usr.lib/0 \ > +contrib/ofed/usr.lib/1 \ > +contrib/ofed/usr.lib/2 \ > +contrib/ofed/usr.lib/3 > > -contrib/ofed/usr.lib/libopensm__L: lib/libthr__L > -contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L > -contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L > +contrib/ofed/usr.lib/0__L: contrib/ofed/include__L lib/libthr__L > +contrib/ofed/usr.lib/1__L: contrib/ofed/usr.lib/0__L > +contrib/ofed/usr.lib/2__L: contrib/ofed/usr.lib/1__L > +contrib/ofed/usr.lib/3__L: contrib/ofed/usr.lib/2__L > .endif ... > ~/git/freebsd # cat contrib/ofed/usr.lib/0/Makefile > # $FreeBSD$ > > SUBDIR= \ > ../../libibverbs > > SUBDIR_PARALLEL= > > .include I'm a bit speechless. Why?? The old version was 90% fine and I sent you advice on how to make it work with the new layout. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
svn commit: r326646 - head/lib/libcam
Author: asomers Date: Wed Dec 6 23:24:11 2017 New Revision: 326646 URL: https://svnweb.freebsd.org/changeset/base/326646 Log: Fix a null-pointer dereference and a tautological check in cam_get_device Reported by: Coverity CID: 1017964 MFC after:3 weeks Sponsored by: Spectra Logic Corp Differential Revision:https://reviews.freebsd.org/D13184 Modified: head/lib/libcam/camlib.c Modified: head/lib/libcam/camlib.c == --- head/lib/libcam/camlib.cWed Dec 6 23:05:22 2017(r326645) +++ head/lib/libcam/camlib.cWed Dec 6 23:24:11 2017(r326646) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -132,6 +133,9 @@ cam_get_device(const char *path, char *dev_name, int d * it so we don't hose the user's string. */ newpath = (char *)strdup(path); + if (newpath == NULL) + return (-1); + tmpstr = newpath; /* @@ -140,8 +144,9 @@ cam_get_device(const char *path, char *dev_name, int d if (*tmpstr == '/') { tmpstr2 = tmpstr; tmpstr = strrchr(tmpstr2, '/'); - if ((tmpstr != NULL) && (*tmpstr != '\0')) - tmpstr++; + /* We know that tmpstr2 contains a '/', so strrchr can't fail */ + assert(tmpstr != NULL && *tmpstr != '\0'); + tmpstr++; } if (*tmpstr == '\0') { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326645 - in head/sys: cam cam/ata cam/mmc cam/nvme cam/scsi dev/hyperv/storvsc
Author: imp Date: Wed Dec 6 23:05:22 2017 New Revision: 326645 URL: https://svnweb.freebsd.org/changeset/base/326645 Log: Define xpt_path_inq. This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and calling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13387 Modified: head/sys/cam/ata/ata_da.c head/sys/cam/ata/ata_xpt.c head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt.h head/sys/cam/mmc/mmc_da.c head/sys/cam/mmc/mmc_xpt.c head/sys/cam/nvme/nvme_da.c head/sys/cam/nvme/nvme_xpt.c head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_ch.c head/sys/cam/scsi/scsi_da.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_pt.c head/sys/cam/scsi/scsi_sa.c head/sys/cam/scsi/scsi_sg.c head/sys/cam/scsi/scsi_target.c head/sys/cam/scsi/scsi_xpt.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Wed Dec 6 23:05:15 2017(r326644) +++ head/sys/cam/ata/ata_da.c Wed Dec 6 23:05:22 2017(r326645) @@ -1726,10 +1726,7 @@ adaregister(struct cam_periph *periph, void *arg) else softc->quirks = ADA_Q_NONE; - bzero(&cpi, sizeof(cpi)); - xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE); - cpi.ccb_h.func_code = XPT_PATH_INQ; - xpt_action((union ccb *)&cpi); + xpt_path_inq(&cpi, periph->path); TASK_INIT(&softc->sysctl_task, 0, adasysctlinit, periph); Modified: head/sys/cam/ata/ata_xpt.c == --- head/sys/cam/ata/ata_xpt.c Wed Dec 6 23:05:15 2017(r326644) +++ head/sys/cam/ata/ata_xpt.c Wed Dec 6 23:05:22 2017(r326645) @@ -1006,10 +1006,7 @@ noerror: if (path->device->mintags != 0 && path->bus->sim->max_tagged_dev_openings != 0) { /* Check if the SIM does not want queued commands. */ - bzero(&cpi, sizeof(cpi)); - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); - cpi.ccb_h.func_code = XPT_PATH_INQ; - xpt_action((union ccb *)&cpi); + xpt_path_inq(&cpi, path); if (cpi.ccb_h.status == CAM_REQ_CMP && (cpi.hba_inquiry & PI_TAG_ABLE)) { /* Report SIM which tags are allowed. */ @@ -1412,10 +1409,7 @@ ata_scan_bus(struct cam_periph *periph, union ccb *req xpt_done(request_ccb); return; } - xpt_setup_ccb(&work_ccb->ccb_h, request_ccb->ccb_h.path, - request_ccb->ccb_h.pinfo.priority); - work_ccb->ccb_h.func_code = XPT_PATH_INQ; - xpt_action(work_ccb); + xpt_path_inq(&work_ccb->cpi, request_ccb->ccb_h.path); if (work_ccb->ccb_h.status != CAM_REQ_CMP) { request_ccb->ccb_h.status = work_ccb->ccb_h.status; xpt_free_ccb(work_ccb); @@ -1570,10 +1564,7 @@ ata_scan_lun(struct cam_periph *periph, struct cam_pat CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_scan_lun\n")); - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); - cpi.ccb_h.func_code = XPT_PATH_INQ; - xpt_action((union ccb *)&cpi); - + xpt_path_inq(&cpi, path); if (cpi.ccb_h.status != CAM_REQ_CMP) { if (request_ccb != NULL) { request_ccb->ccb_h.status = cpi.ccb_h.status; @@ -1682,9 +1673,7 @@ ata_device_transport(struct cam_path *path) struct ata_params *ident_buf = NULL; /* Get transport information from the SIM */ - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); - cpi.ccb_h.func_code = XPT_PATH_INQ; - xpt_action((union ccb *)&cpi); + xpt_path_inq(&cpi, path); path->device->transport = cpi.transport; if ((path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0) @@ -1979,9 +1968,7 @@ ata_set_transfer_settings(struct ccb_trans_settings *c scsi = &cts->proto_specific.scsi; else scsi = NULL; - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); - cpi.ccb_h.func_code = XPT_PATH_INQ; - xpt_action((union ccb *)&cpi); + xpt_path_inq(&cpi, path); /* Sanity checking */ if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 @@ -2110,9 +2097,7 @@ _ata_announce_periph(struct cam_periph *periph, struct if ((cts->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) return; /* Ask the SIM for its base transfer speed */ - xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); - cpi.ccb_h.func_code = XPT_PATH_INQ; - xpt_action((union ccb *)&cpi); +
svn commit: r326644 - in head/sys/cam: ata nvme scsi
Author: imp Date: Wed Dec 6 23:05:15 2017 New Revision: 326644 URL: https://svnweb.freebsd.org/changeset/base/326644 Log: Now that cam_periph_runccb() can be called from situations where the kernel scheduler is stopped, replace the by hand calling of xpt_polled_action() with it. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13388 Modified: head/sys/cam/ata/ata_da.c head/sys/cam/nvme/nvme_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Wed Dec 6 23:05:07 2017(r326643) +++ head/sys/cam/ata/ata_da.c Wed Dec 6 23:05:15 2017(r326644) @@ -1088,13 +1088,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical ata_28bit_cmd(&ccb.ataio, ATA_WRITE_DMA, 0, lba, count); } - xpt_polled_action(&ccb); - - error = adaerror(&ccb, - 0, SF_NO_RECOVERY | SF_NO_RETRY); - if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + error = cam_periph_runccb(&ccb, adaerror, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) printf("Aborting dump due to I/O error.\n"); @@ -1124,13 +1119,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE48, 0, 0, 0); else ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); - xpt_polled_action(&ccb); - - error = adaerror(&ccb, - 0, SF_NO_RECOVERY | SF_NO_RETRY); - if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, - /*reduction*/0, /*timeout*/0, /*getcount_only*/0); + error = cam_periph_runccb(&ccb, adaerror, + 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); } @@ -3510,32 +3500,9 @@ adaspindown(uint8_t cmd, int flags) 0, ada_default_timeout*1000); ata_28bit_cmd(&local_ccb, cmd, 0, 0, 0); - - if (!SCHEDULER_STOPPED()) { - /* -* Not panicing, can just do the normal runccb -* XXX should make cam_periph_runccb work while -* XXX panicing... later -*/ - error = cam_periph_runccb((union ccb *)&local_ccb, adaerror, - /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, - softc->disk->d_devstat); - } else { - /* -* Panicing, so we have to do this by hand: do -* xpt_polled_action to run the request through the SIM, -* extract the error, and if the queue was frozen, -* unfreeze it. cam_periph_runccb takes care of these -* details, but xpt_polled_action doesn't. -*/ - xpt_polled_action((union ccb *)&local_ccb); - error = adaerror((union ccb *)&local_ccb, 0, - SF_NO_RECOVERY | SF_NO_RETRY); - if ((local_ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(local_ccb.ccb_h.path, - /*relsim_flags*/0, /*reduction*/0, - /*timeout*/0, /*getcount_only*/0); - } + error = cam_periph_runccb((union ccb *)&local_ccb, adaerror, + /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, + softc->disk->d_devstat); if (error != 0) xpt_print(periph->path, "Spin-down disk failed\n"); cam_periph_unlock(periph); Modified: head/sys/cam/nvme/nvme_da.c == --- head/sys/cam/nvme/nvme_da.c Wed Dec 6 23:05:07 2017(r326643) +++ head/sys/cam/nvme/nvme_da.c Wed Dec 6 23:05:15 2017(r326644) @@ -404,17 +404,12 @@ ndadump(void *arg, void *virtual, vm_offset_t physical xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; nda_nvme_write(softc, &nvmeio, virtual, lba, length, count); - xpt_polled_actio
svn commit: r326643 - head/sys/cam
Author: imp Date: Wed Dec 6 23:05:07 2017 New Revision: 326643 URL: https://svnweb.freebsd.org/changeset/base/326643 Log: Make cam_periph_runccb be safe to call when we can only do polling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13388 Modified: head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt.h Modified: head/sys/cam/cam_periph.c == --- head/sys/cam/cam_periph.c Wed Dec 6 23:03:34 2017(r326642) +++ head/sys/cam/cam_periph.c Wed Dec 6 23:05:07 2017(r326643) @@ -1160,7 +1160,11 @@ cam_periph_runccb(union ccb *ccb, struct bintime *starttime; struct bintime ltime; int error; - + bool sched_stopped; + struct mtx *periph_mtx; + struct cam_periph *periph; + uint32_t timeout = 1; + starttime = NULL; xpt_path_assert(ccb->ccb_h.path, MA_OWNED); KASSERT((ccb->ccb_h.flags & CAM_UNLOCKED) == 0, @@ -1180,21 +1184,47 @@ cam_periph_runccb(union ccb *ccb, devstat_start_transaction(ds, starttime); } + sched_stopped = SCHEDULER_STOPPED(); ccb->ccb_h.cbfcnp = cam_periph_done; - xpt_action(ccb); - - do { - cam_periph_ccbwait(ccb); - if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) - error = 0; - else if (error_routine != NULL) { - ccb->ccb_h.cbfcnp = cam_periph_done; - error = (*error_routine)(ccb, camflags, sense_flags); - } else - error = 0; + periph = xpt_path_periph(ccb->ccb_h.path); + periph_mtx = cam_periph_mtx(periph); - } while (error == ERESTART); - + /* +* If we're polling, then we need to ensure that we have ample resources +* in the periph. We also need to drop the periph lock while we're polling. +* cam_periph_error can reschedule the ccb by calling xpt_action and returning +* ERESTART, so we have to effect the polling in the do loop below. +*/ + if (sched_stopped) { + mtx_unlock(periph_mtx); + timeout = xpt_poll_setup(ccb); + } + + if (timeout == 0) { + ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + error = EBUSY; + } else { + xpt_action(ccb); + do { + if (!sched_stopped) + cam_periph_ccbwait(ccb); + else { + xpt_pollwait(ccb, timeout); + timeout = ccb->ccb_h.timeout * 10; + } + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) + error = 0; + else if (error_routine != NULL) { + ccb->ccb_h.cbfcnp = cam_periph_done; + error = (*error_routine)(ccb, camflags, sense_flags); + } else + error = 0; + } while (error == ERESTART); + } + + if (sched_stopped) + mtx_lock(periph_mtx); + if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { cam_release_devq(ccb->ccb_h.path, /* relsim_flags */0, Modified: head/sys/cam/cam_xpt.c == --- head/sys/cam/cam_xpt.c Wed Dec 6 23:03:34 2017(r326642) +++ head/sys/cam/cam_xpt.c Wed Dec 6 23:05:07 2017(r326643) @@ -3204,8 +3204,8 @@ call_sim: start_ccb->ccb_h.status)); } -void -xpt_polled_action(union ccb *start_ccb) +uint32_t +xpt_poll_setup(union ccb *start_ccb) { u_int32_t timeout; structcam_sim *sim; @@ -3219,8 +3219,6 @@ xpt_polled_action(union ccb *start_ccb) mtx = sim->mtx; dev = start_ccb->ccb_h.path->device; - mtx_unlock(&dev->device_mtx); - /* * Steal an opening so that no other queued requests * can get it before us while we simulate interrupts. @@ -3242,29 +3240,57 @@ xpt_polled_action(union ccb *start_ccb) dev->ccbq.dev_openings++; mtx_unlock(&devq->send_mtx); - if (timeout != 0) { + return (timeout); +} + +void +xpt_pollwait(union ccb *start_ccb, uint32_t timeout) +{ + struct cam_sim *sim; + struct mtx *mtx; + + sim = start_ccb->ccb_h.path->bus->sim; + mtx = sim->mtx; + + while (--timeout > 0) { + if (mtx) + mtx_lock(mtx); + (*(sim->sim_poll))(sim); + if (mtx) + mtx_unlock(mtx); + camisr_runqueue(); + if ((start_ccb->ccb_h.status & CAM_STATUS_MASK) +
svn commit: r326642 - in head: share/man/man9 sys/dev/firewire sys/dev/lmc sys/dev/smc sys/net
Author: glebius Date: Wed Dec 6 23:03:34 2017 New Revision: 326642 URL: https://svnweb.freebsd.org/changeset/base/326642 Log: Garbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since very beginning of polling(4). The module always ignored return value from driver polling handler. Modified: head/share/man/man9/ifnet.9 head/sys/dev/firewire/if_fwe.c head/sys/dev/firewire/if_fwip.c head/sys/dev/lmc/if_lmc.c head/sys/dev/smc/if_smc.c head/sys/net/if.h Modified: head/share/man/man9/ifnet.9 == --- head/share/man/man9/ifnet.9 Wed Dec 6 22:08:35 2017(r326641) +++ head/share/man/man9/ifnet.9 Wed Dec 6 23:03:34 2017(r326642) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd December 6, 2017 .Dt IFNET 9 .Os .Sh NAME @@ -677,7 +677,7 @@ Userland code shall use .Xr ioctl 2 . .Pp The following capabilities are currently supported by the system: -.Bl -tag -width ".Dv IFCAP_POLLING_NOCOUNT" -offset indent +.Bl -tag -width ".Dv IFCAP_VLAN_HWTAGGING" -offset indent .It Dv IFCAP_RXCSUM This interface can do checksum validation on receiving data. Some interfaces do not have sufficient buffer storage to store frames @@ -752,9 +752,6 @@ A shorthand for This interface supports frame filtering in hardware on .Xr vlan 4 interfaces. -.It Dv IFCAP_POLLING_NOCOUNT -The return value for the number of processed packets should be -skipped for this interface. .It Dv IFCAP_VLAN_HWTSO This interface supports TCP Segmentation offloading on .Xr vlan 4 Modified: head/sys/dev/firewire/if_fwe.c == --- head/sys/dev/firewire/if_fwe.c Wed Dec 6 22:08:35 2017 (r326641) +++ head/sys/dev/firewire/if_fwe.c Wed Dec 6 23:03:34 2017 (r326642) @@ -395,7 +395,6 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* Disable interrupts */ fc->set_intr(fc, 0); ifp->if_capenable |= IFCAP_POLLING; - ifp->if_capenable |= IFCAP_POLLING_NOCOUNT; return (error); } if (!(ifr->ifr_reqcap & IFCAP_POLLING) && @@ -404,7 +403,6 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* Enable interrupts. */ fc->set_intr(fc, 1); ifp->if_capenable &= ~IFCAP_POLLING; - ifp->if_capenable &= ~IFCAP_POLLING_NOCOUNT; return (error); } } Modified: head/sys/dev/firewire/if_fwip.c == --- head/sys/dev/firewire/if_fwip.c Wed Dec 6 22:08:35 2017 (r326641) +++ head/sys/dev/firewire/if_fwip.c Wed Dec 6 23:03:34 2017 (r326642) @@ -410,8 +410,7 @@ fwip_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data return (error); /* Disable interrupts */ fc->set_intr(fc, 0); - ifp->if_capenable |= IFCAP_POLLING | - IFCAP_POLLING_NOCOUNT; + ifp->if_capenable |= IFCAP_POLLING; return (error); } if (!(ifr->ifr_reqcap & IFCAP_POLLING) && @@ -420,7 +419,6 @@ fwip_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data /* Enable interrupts. */ fc->set_intr(fc, 1); ifp->if_capenable &= ~IFCAP_POLLING; - ifp->if_capenable &= ~IFCAP_POLLING_NOCOUNT; return (error); } } Modified: head/sys/dev/lmc/if_lmc.c == --- head/sys/dev/lmc/if_lmc.c Wed Dec 6 22:08:35 2017(r326641) +++ head/sys/dev/lmc/if_lmc.c Wed Dec 6 23:03:34 2017(r326642) @@ -3823,7 +3823,6 @@ setup_ifnet(struct ifnet *ifp) # if defined(DEVICE_POLLING) ifp->if_capabilities |= IFCAP_POLLING; - ifp->if_capenable|= IFCAP_POLLING_NOCOUNT; # endif if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev)); Modified: head/sys/dev/smc/if_smc.c == --- head/sys/dev/smc/if_smc.c Wed Dec 6 22:08:35 2017(r326641) +++ head/sys/dev/smc/if_smc.c Wed Dec 6 23:03:34 2017(r326642) @@ -1216,7 +1216,6 @@ smc_stop(struct smc_softc *sc) #ifdef DEVICE_POLLING ether_poll_deregister(sc->smc_ifp); sc->smc_ifp->if_capenable &= ~IFCAP_POLLING; - sc->smc_ifp->if_capenable &= ~IFCAP_POLLING_NOCOUNT; #endif /* @@ -1276,7 +12
svn commit: r326641 - head/contrib/dma
Author: bapt Date: Wed Dec 6 22:08:35 2017 New Revision: 326641 URL: https://svnweb.freebsd.org/changeset/base/326641 Log: Split body of mails not respecting RFC2822 For mails which has a body not respecting RFC2822 (which often happen with crontabs) try to split by words finding the last space before 1000's character If no spaces are found then consider the mail to be malformed anyway PR: 208261 Modified: head/contrib/dma/mail.c Modified: head/contrib/dma/mail.c == --- head/contrib/dma/mail.c Wed Dec 6 22:06:48 2017(r326640) +++ head/contrib/dma/mail.c Wed Dec 6 22:08:35 2017(r326641) @@ -41,6 +41,8 @@ #include "dma.h" +#define MAX_LINE_RFC8221000 + void bounce(struct qitem *it, const char *reason) { @@ -341,19 +343,47 @@ newaddr: goto again; } +static int +writeline(struct queue *queue, const char *line, ssize_t linelen) +{ + ssize_t len; + + while (linelen > 0) { + len = linelen; + if (linelen > MAX_LINE_RFC822) { + len = MAX_LINE_RFC822 - 10; + } + + if (fwrite(line, len, 1, queue->mailf) != 1) + return (-1); + + if (linelen <= MAX_LINE_RFC822) + break; + + if (fwrite("\n", 1, 1, queue->mailf) != 1) + return (-1); + + line += MAX_LINE_RFC822 - 10; + linelen = strlen(line); + } + return (0); +} + int readmail(struct queue *queue, int nodot, int recp_from_header) { struct parse_state parse_state; - char line[1000];/* by RFC2822 */ - size_t linelen; + char *line = NULL; + ssize_t linelen; + size_t linecap = 0; + char newline[MAX_LINE_RFC822]; size_t error; int had_headers = 0; int had_from = 0; int had_messagid = 0; int had_date = 0; - int had_last_line = 0; int nocopy = 0; + int ret = -1; parse_state.state = NONE; @@ -372,24 +402,17 @@ readmail(struct queue *queue, int nodot, int recp_from return (-1); while (!feof(stdin)) { - if (fgets(line, sizeof(line) - 1, stdin) == NULL) + newline[0] = '\0'; + if ((linelen = getline(&line, &linecap, stdin)) <= 0) break; - if (had_last_line) - errlogx(EX_DATAERR, "bad mail input format:" - " from %s (uid %d) (envelope-from %s)", - username, useruid, queue->sender); - linelen = strlen(line); - if (linelen == 0 || line[linelen - 1] != '\n') { - /* -* This line did not end with a newline character. -* If we fix it, it better be the last line of -* the file. -*/ - line[linelen] = '\n'; - line[linelen + 1] = 0; - had_last_line = 1; - } + if (!had_headers) { + if (linelen > MAX_LINE_RFC822) { + /* XXX also split headers */ + errlogx(EX_DATAERR, "bad mail input format:" + " from %s (uid %d) (envelope-from %s)", + username, useruid, queue->sender); + } /* * Unless this is a continuation, switch of * the Bcc: nocopy flag. @@ -430,31 +453,39 @@ readmail(struct queue *queue, int nodot, int recp_from while (!had_date || !had_messagid || !had_from) { if (!had_date) { had_date = 1; - snprintf(line, sizeof(line), "Date: %s\n", rfc822date()); + snprintf(newline, sizeof(newline), "Date: %s\n", rfc822date()); } else if (!had_messagid) { /* XXX msgid, assign earlier and log? */ had_messagid = 1; - snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", + snprintf(newline, sizeof(newline), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", (uintmax_t)time(NULL), queue->id, (uintmax_t)random(), hostname()); } else if (!had_
svn commit: r326640 - in head/lib/libc: gen tests/gen
Author: asomers Date: Wed Dec 6 22:06:48 2017 New Revision: 326640 URL: https://svnweb.freebsd.org/changeset/base/326640 Log: Optimize telldir(3) Currently each call to telldir() requires a malloc and adds an entry to a linked list which must be traversed on future telldir(), seekdir(), closedir(), and readdir() calls. Applications that call telldir() for every directory entry incur O(n^2) behavior in readdir() and O(n) in telldir() and closedir(). This optimization eliminates the malloc() and linked list in most cases by packing the relevant information into a single long. On 64-bit architectures msdosfs, NFS, tmpfs, UFS, and ZFS can all use the packed representation. On 32-bit architectures msdosfs, NFS, and UFS can use the packed representation, but ZFS and tmpfs can only use it for about the first 128 files per directory. Memory savings is about 50 bytes per telldir(3) call. Speedup for telldir()-heavy directory traversals is about 20-30x for one million files per directory. Reviewed by: kib, mav, mckusick MFC after:3 weeks Sponsored by: Spectra Logic Corp Differential Revision:https://reviews.freebsd.org/D13385 Added: head/lib/libc/tests/gen/dir2_test.c (contents, props changed) Modified: head/lib/libc/gen/telldir.c head/lib/libc/gen/telldir.h head/lib/libc/tests/gen/Makefile Modified: head/lib/libc/gen/telldir.c == --- head/lib/libc/gen/telldir.c Wed Dec 6 22:03:11 2017(r326639) +++ head/lib/libc/gen/telldir.c Wed Dec 6 22:06:48 2017(r326640) @@ -54,11 +54,25 @@ __FBSDID("$FreeBSD$"); long telldir(DIR *dirp) { - struct ddloc *lp, *flp; - long idx; + struct ddloc_mem *lp, *flp; + union ddloc_packed ddloc; if (__isthreaded) _pthread_mutex_lock(&dirp->dd_lock); + /* +* Outline: +* 1) If the directory position fits in a packed structure, return that. +* 2) Otherwise, see if it's already been recorded in the linked list +* 3) Otherwise, malloc a new one +*/ + if (dirp->dd_seek < (1ul << DD_SEEK_BITS) && + dirp->dd_loc < (1ul << DD_LOC_BITS)) { + ddloc.s.is_packed = 1; + ddloc.s.loc = dirp->dd_loc; + ddloc.s.seek = dirp->dd_seek; + goto out; + } + flp = NULL; LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { if (lp->loc_seek == dirp->dd_seek) { @@ -72,7 +86,7 @@ telldir(DIR *dirp) } } if (lp == NULL) { - lp = malloc(sizeof(struct ddloc)); + lp = malloc(sizeof(struct ddloc_mem)); if (lp == NULL) { if (__isthreaded) _pthread_mutex_unlock(&dirp->dd_lock); @@ -86,10 +100,17 @@ telldir(DIR *dirp) else LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); } - idx = lp->loc_index; + ddloc.i.is_packed = 0; + /* +* Technically this assignment could overflow on 32-bit architectures, +* but we would get ENOMEM long before that happens. +*/ + ddloc.i.index = lp->loc_index; + +out: if (__isthreaded) _pthread_mutex_unlock(&dirp->dd_lock); - return (idx); + return (ddloc.l); } /* @@ -99,34 +120,47 @@ telldir(DIR *dirp) void _seekdir(DIR *dirp, long loc) { - struct ddloc *lp; + struct ddloc_mem *lp; struct dirent *dp; + union ddloc_packed ddloc; + off_t loc_seek; + long loc_loc; - LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { - if (lp->loc_index == loc) - break; + ddloc.l = loc; + + if (ddloc.s.is_packed) { + loc_seek = ddloc.s.seek; + loc_loc = ddloc.s.loc; + } else { + LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { + if (lp->loc_index == ddloc.i.index) + break; + } + if (lp == NULL) + return; + + loc_seek = lp->loc_seek; + loc_loc = lp->loc_loc; } - if (lp == NULL) + if (loc_loc == dirp->dd_loc && loc_seek == dirp->dd_seek) return; - if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek) - return; /* If it's within the same chunk of data, don't bother reloading. */ - if (lp->loc_seek == dirp->dd_seek) { + if (loc_seek == dirp->dd_seek) { /* * If we go back to 0 don't make the next readdir * trigger a call to getdirentries(). */ - if (lp->loc_loc == 0) + if (loc_loc == 0) dirp->dd_flags |= __DTF_SKIPREA
Re: svn commit: r326624 - head/sys/cam/ata
Oh good, I'll be able to sleep tonight after all. :-) -Ravi -Original Message- From: on behalf of Alan Somers Date: 2017-12-06, Wednesday at 10:15 To: Ravi Pokala Cc: "src-committ...@freebsd.org" , "svn-src-...@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r326624 - head/sys/cam/ata Nope. The ATA spec prohibited them, and nobody ever manufactured any. But you might be able to fake one with CTL or QEMU or something similar. On Wed, Dec 6, 2017 at 10:11 AM, Ravi Pokala wrote: > ... disks of >=1TiB that still use CHS addressing. Out of morbid curiosity, are there any such monstrosities? -Ravi (rpokala@) -Original Message- From: on behalf of Alan Somers Date: 2017-12-06, Wednesday at 09:01 To: , , Subject: svn commit: r326624 - head/sys/cam/ata Author: asomers Date: Wed Dec 6 17:01:25 2017 New Revision: 326624 URL: https://svnweb.freebsd.org/changeset/base/326624 Log: cam: fix sign-extension error in adagetparams adagetparams contains a sign-extension error that will cause the sector count to be incorrectly calculated for ATA disks of >=1TiB that still use CHS addressing. Disks using LBA48 addressing are unaffected. Reported by: Coverity CID: 1007296 Reviewed by: ken MFC after:3 weeks Sponsored by: Spectra Logic Corp Differential Revision:https://reviews.freebsd.org/D13198 Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Wed Dec 6 14:53:53 2017(r326623) +++ head/sys/cam/ata/ata_da.c Wed Dec 6 17:01:25 2017(r326624) @@ -3377,7 +3377,8 @@ adagetparams(struct cam_periph *periph, struct ccb_get dp->heads = cgd->ident_data.heads; dp->secs_per_track = cgd->ident_data.sectors; dp->cylinders = cgd->ident_data.cylinders; - dp->sectors = cgd->ident_data.cylinders * dp->heads * dp->secs_per_track; + dp->sectors = cgd->ident_data.cylinders * + (u_int32_t)(dp->heads * dp->secs_per_track); } lbasize = (u_int32_t)cgd->ident_data.lba_size_1 | ((u_int32_t)cgd->ident_data.lba_size_2 << 16); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326636 - head/contrib/binutils/libiberty
Author: stevek Date: Wed Dec 6 21:18:45 2017 New Revision: 326636 URL: https://svnweb.freebsd.org/changeset/base/326636 Log: The function make_relative_prefix_1 does not properly free locally allocated memory when it returns early. Free the memory associated with the variables full_programe, bin_dirs, prog_dirs, and prefix_dirs when the function returns early. Submitted by: Tom Rix Reviewed by: jhibbits, emaste Approved by: sjg (mentor) Obtained from:Juniper Networks, Inc. MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D9691 Modified: head/contrib/binutils/libiberty/make-relative-prefix.c Modified: head/contrib/binutils/libiberty/make-relative-prefix.c == --- head/contrib/binutils/libiberty/make-relative-prefix.c Wed Dec 6 21:12:24 2017(r326635) +++ head/contrib/binutils/libiberty/make-relative-prefix.c Wed Dec 6 21:18:45 2017(r326636) @@ -299,10 +299,18 @@ make_relative_prefix_1 (const char *progname, const ch full_progname = strdup(progname); prog_dirs = split_directories (full_progname, &prog_num); - bin_dirs = split_directories (bin_prefix, &bin_num); + if (prog_dirs == NULL) +{ + free (full_progname); + return NULL; +} free (full_progname); - if (bin_dirs == NULL || prog_dirs == NULL) -return NULL; + bin_dirs = split_directories (bin_prefix, &bin_num); + if (bin_dirs == NULL) +{ + free_split_directories(prog_dirs); + return NULL; +} /* Remove the program name from comparison of directory names. */ prog_num--; @@ -365,7 +373,12 @@ make_relative_prefix_1 (const char *progname, const ch ret = (char *) malloc (needed_len); if (ret == NULL) -return NULL; +{ + free_split_directories (prog_dirs); + free_split_directories (bin_dirs); + free_split_directories (prefix_dirs); + return NULL; +} /* Build up the pathnames in argv[0]. */ *ret = '\0'; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326635 - head/lib/libc/stdio
Author: stevek Date: Wed Dec 6 21:12:24 2017 New Revision: 326635 URL: https://svnweb.freebsd.org/changeset/base/326635 Log: The function fwscanf() return value is wrong when encountering an early matching failure. According to the Open Group documentation for fwscanf: "Upon successful completion, these functions shall return the number of successfully matched and assigned input items; this number can be zero in the event of an early matching failure." Without this change, fwscanf would return EOF in the case of an early matching failure, instead of the proper return value of 0. This change aligns fwscanf(3) with the implementation in fscanf(3). PR: 202240 Submitted by: rajendra...@gmail.com Reviewed by: jhb, cem Approved by: sjg (mentor) MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D13288 Modified: head/lib/libc/stdio/vfwscanf.c Modified: head/lib/libc/stdio/vfwscanf.c == --- head/lib/libc/stdio/vfwscanf.c Wed Dec 6 21:00:41 2017 (r326634) +++ head/lib/libc/stdio/vfwscanf.c Wed Dec 6 21:12:24 2017 (r326635) @@ -494,7 +494,7 @@ literal: goto input_failure; if (wi != c) { __ungetwc(wi, fp, locale); - goto input_failure; + goto match_failure; } nread++; continue; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326634 - head/share/mk
Author: bdrewery Date: Wed Dec 6 21:00:41 2017 New Revision: 326634 URL: https://svnweb.freebsd.org/changeset/base/326634 Log: AUTO_OBJ: Don't create nested OBJDIRS with print-dir or make -n. Sponsored by: Dell EMC Modified: head/share/mk/bsd.obj.mk Modified: head/share/mk/bsd.obj.mk == --- head/share/mk/bsd.obj.mkWed Dec 6 20:23:38 2017(r326633) +++ head/share/mk/bsd.obj.mkWed Dec 6 21:00:41 2017(r326634) @@ -55,7 +55,8 @@ CANONICALOBJDIR= ${.OBJDIR} # Handle special case where SRCS is full-pathed and requires # nested objdirs. This duplicates some auto.obj.mk logic. .if (!empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)) && \ -(${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "") +(${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "") && \ +!make(print-dir) && empty(.MAKEFLAGS:M-[nN]) _wantdirs= ${SRCS:M*/*:H} ${DPSRCS:M*/*:H} .if !empty(_wantdirs) _wantdirs:=${_wantdirs:O:u} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326633 - head/share/misc
Author: bapt Date: Wed Dec 6 20:23:38 2017 New Revision: 326633 URL: https://svnweb.freebsd.org/changeset/base/326633 Log: Update to 2017-12-06 MFC after:2 days Modified: head/share/misc/pci_vendors Modified: head/share/misc/pci_vendors == --- head/share/misc/pci_vendors Wed Dec 6 20:10:05 2017(r326632) +++ head/share/misc/pci_vendors Wed Dec 6 20:23:38 2017(r326633) @@ -3,8 +3,8 @@ # # List of PCI ID's # -# Version: 2017.10.21 -# Date:2017-10-21 03:15:01 +# Version: 2017.12.06 +# Date:2017-12-06 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at http://pci-ids.ucw.cz/. @@ -751,6 +751,7 @@ 131b Kaveri [Radeon R4 Graphics] 131c Kaveri [Radeon R7 Graphics] 131d Kaveri [Radeon R6 Graphics] + 15dd Radeon Vega 8 Mobile 1714 BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series] 103c 168b ProBook 4535s 3150 RV380/M24 [Mobility Radeon X600] @@ -1629,6 +1630,7 @@ 6623 Mars 6631 Oland 6640 Saturn XT [FirePro M6100] + 106b 014b Tropo XT [Radeon R9 M380 Mac Edition] 6641 Saturn PRO [Radeon HD 8930M] 6646 Bonaire XT [Radeon R9 M280X] 6647 Bonaire PRO [Radeon R9 M270X] @@ -2370,7 +2372,8 @@ 6828 Cape Verde PRO [FirePro W600] 6829 Cape Verde 682a Venus PRO - 682b Venus LE [Radeon HD 8830M] + 682b Venus LE / Tropo PRO-L [Radeon HD 8830M / R7 M465X] + 0128 079c Radeon R7 465X 682c Cape Verde GL [FirePro W4100] 682d Chelsea XT GL [FirePro M4000] 682f Chelsea LP [Radeon HD 7730M] @@ -2504,6 +2507,7 @@ 144d c0c7 Radeon HD 7550M 6842 Thames LE [Radeon HD 7000M Series] 6843 Thames [Radeon HD 7670M] + 6861 Vega 10 XT [Radeon PRO WX 9100] 6863 Vega 10 XTX [Radeon Vega Frontier Edition] 687f Vega 10 XT [Radeon RX Vega 64] 6888 Cypress XT [FirePro V8800] @@ -4037,6 +4041,7 @@ 141f Family 15h (Models 30h-3fh) Processor Function 5 1422 Family 15h (Models 30h-3fh) Processor Root Complex 1423 Family 15h (Models 30h-3fh) I/O Memory Management Unit + 1424 Family 15h (Models 30h-3fh) Processor Root Port 1426 Family 15h (Models 30h-3fh) Processor Root Port 1436 Liverpool Processor Root Complex 1437 Liverpool I/O Memory Management Unit @@ -4045,6 +4050,7 @@ 1450 Family 17h (Models 00h-0fh) Root Complex 1451 Family 17h (Models 00h-0fh) I/O Memory Management Unit 1452 Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge + 1453 Family 17h (Models 00h-0fh) PCIe GPP Bridge 1454 Family 17h (Models 00h-0fh) Internal PCIe GPP Bridge 0 to Bus B 1456 Family 17h (Models 00h-0fh) Platform Security Processor 1457 Family 17h (Models 00h-0fh) HD Audio Controller @@ -5217,6 +5223,7 @@ 3020 Samurai_IDE 1043 ASUSTeK Computer Inc. 0464 Radeon R9 270x GPU + 0521 RX580 [RX 580 Dual O8G] 0675 ISDNLink P-IN100-ST-D 0675 1704 ISDN Adapter (PCI Bus, D, C) 0675 1707 ISDN Adapter (PCI Bus, DV, W) @@ -6176,6 +6183,7 @@ 103c 12dd 4Gb Fibre Channel [AB429A] 2432 ISP2432-based 4Gb Fibre Channel to PCI Express HBA 103c 7040 FC1142SR 4Gb 1-port PCIe Fibre Channel Host Bus Adapter [HPAE311A] + 1077 0137 QLE2460 4 GB PCI-X Host-Bus-Adapter 2532 ISP2532-based 8Gb Fibre Channel to PCI Express HBA 1014 041e FC EN0Y/EN12 PCIe2 LP 8 Gb 4-port Fibre Channel Adapter for POWER 103c 3262 StorageWorks 81Q @@ -6227,6 +6235,10 @@ 1077 000b 25GE 2P QL41262HxCU-DE Adapter 1077 0011 FastLinQ QL41212H 25GbE Adapter 1077 0012 FastLinQ QL41112H 10GbE Adapter + 1590 021d 10/25GbE 2P QL41222HLCU-HP Adapter + 1590 021e 10/25GbE 2P QL41162HMRJ-HP Adapter + 1590 021f 10/25GbE 2P QL41262HMCU-HP Adapter + 1590 0220 10/25GbE 2P QL41122HLRJ-HP Adapter 8080 FastLinQ QL41000 Series 10/25/40/50GbE Controller (FCoE) 1077 0001 10GE 2P QL41162HxRJ-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter @@ -6247,6 +6259,8 @@ 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter (SR-IOV VF) 1077 0011 FastLinQ QL41212H 25GbE Adapter (SR-IOV VF) 1077 0012 FastLinQ QL41112H 10GbE Adapter (SR-IOV VF) + 1590 021e 10/25GbE 2P QL41162HMRJ-HP Adapter + 1590 021f 10/25GbE 2P QL41262HMCU-HP Adapter 8430 ISP8324 1/10GbE Converged Network Controller (NIC VF) 8431 8300 Series 10GbE Converged N
svn commit: r326632 - head/usr.bin/sdiff
Author: bapt Date: Wed Dec 6 20:10:05 2017 New Revision: 326632 URL: https://svnweb.freebsd.org/changeset/base/326632 Log: sdiff(1) can now be built defaults warning level Modified: head/usr.bin/sdiff/Makefile Modified: head/usr.bin/sdiff/Makefile == --- head/usr.bin/sdiff/Makefile Wed Dec 6 20:09:30 2017(r326631) +++ head/usr.bin/sdiff/Makefile Wed Dec 6 20:10:05 2017(r326632) @@ -4,7 +4,6 @@ PROG= sdiff SRCS= edit.c sdiff.c -WARNS= 3 MAN1= sdiff.1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326631 - head/usr.bin/sdiff
Author: bapt Date: Wed Dec 6 20:09:30 2017 New Revision: 326631 URL: https://svnweb.freebsd.org/changeset/base/326631 Log: Rename variables confusing gcc 4.2.1 While there is no reason it shadows div(3) gcc 4.2.1 complains about it MFC after:1 week Modified: head/usr.bin/sdiff/sdiff.c Modified: head/usr.bin/sdiff/sdiff.c == --- head/usr.bin/sdiff/sdiff.c Wed Dec 6 20:05:36 2017(r326630) +++ head/usr.bin/sdiff/sdiff.c Wed Dec 6 20:09:30 2017(r326631) @@ -618,7 +618,7 @@ QUIT: * Takes into account that tabs can take multiple columns. */ static void -println(const char *s1, const char div, const char *s2) +println(const char *s1, const char divider, const char *s2) { size_t col; @@ -635,7 +635,7 @@ println(const char *s1, const char div, const char *s2 putchar(' '); /* Only print left column. */ - if (div == ' ' && !s2) { + if (divider == ' ' && !s2) { printf(" (\n"); return; } @@ -645,10 +645,10 @@ println(const char *s1, const char div, const char *s2 * need to add the space for padding. */ if (!s2) { - printf(" %c\n", div); + printf(" %c\n", divider); return; } - printf(" %c ", div); + printf(" %c ", divider); col += 3; /* Skip angle bracket and space. */ @@ -870,14 +870,14 @@ parsecmd(FILE *diffpipe, FILE *file1, FILE *file2) * Queues up a diff line. */ static void -enqueue(char *left, char div, char *right) +enqueue(char *left, char divider, char *right) { struct diffline *diffp; if (!(diffp = malloc(sizeof(struct diffline err(2, "enqueue"); diffp->left = left; - diffp->div = div; + diffp->div = divider; diffp->right = right; STAILQ_INSERT_TAIL(&diffhead, diffp, diffentries); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326630 - head/usr.bin/sdiff
Author: bapt Date: Wed Dec 6 20:05:36 2017 New Revision: 326630 URL: https://svnweb.freebsd.org/changeset/base/326630 Log: Fix -Wincompatible-pointer-types-discards-qualifiers warnings MFC after:1 week Modified: head/usr.bin/sdiff/sdiff.c Modified: head/usr.bin/sdiff/sdiff.c == --- head/usr.bin/sdiff/sdiff.c Wed Dec 6 18:36:54 2017(r326629) +++ head/usr.bin/sdiff/sdiff.c Wed Dec 6 20:05:36 2017(r326630) @@ -29,7 +29,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -#define DIFF_PATH "/usr/bin/diff" +static char diff_path[] = "/usr/bin/diff"; #define WIDTH 126 /* @@ -213,9 +213,11 @@ main(int argc, char **argv) int ch, fd[2] = {-1}, status; pid_t pid=0; const char *outfile = NULL; - char **diffargv, *diffprog = DIFF_PATH, *filename1, *filename2, + char **diffargv, *diffprog = diff_path, *filename1, *filename2, *tmp1, *tmp2, *s1, *s2; int i; + char I_arg[] = "-I"; + char speed_lf[] = "--speed-large-files"; /* * Process diff flags. @@ -269,14 +271,14 @@ main(int argc, char **argv) sprintf(diffargv[1], "%s%c", diffargv[1], ch); break; case 'H': - diffargv[diffargc++] = "--speed-large-files"; + diffargv[diffargc++] = speed_lf; break; case DIFFPROG_OPT: diffargv[0] = diffprog = optarg; break; case 'I': Iflag = 1; - diffargv[diffargc++] = "-I"; + diffargv[diffargc++] = I_arg; diffargv[diffargc++] = optarg; break; case 'l': ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326629 - head/sys/vm
Author: markj Date: Wed Dec 6 18:36:54 2017 New Revision: 326629 URL: https://svnweb.freebsd.org/changeset/base/326629 Log: Use unique wait messages in the page daemon control loop. Discussed with: alc MFC after:1 week Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cWed Dec 6 18:11:56 2017(r326628) +++ head/sys/vm/vm_pageout.cWed Dec 6 18:36:54 2017(r326629) @@ -1818,7 +1818,7 @@ vm_pageout_worker(void *arg) */ mtx_unlock(&vm_page_queue_free_mtx); if (pass >= 1) - pause("psleep", hz / VM_INACT_SCAN_RATE); + pause("pwait", hz / VM_INACT_SCAN_RATE); pass++; } else { /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326624 - head/sys/cam/ata
Nope. The ATA spec prohibited them, and nobody ever manufactured any. But you might be able to fake one with CTL or QEMU or something similar. On Wed, Dec 6, 2017 at 10:11 AM, Ravi Pokala wrote: > > ... disks of >=1TiB that still use CHS addressing. > > Out of morbid curiosity, are there any such monstrosities? > > -Ravi (rpokala@) > > -Original Message- > From: on behalf of Alan Somers > > Date: 2017-12-06, Wednesday at 09:01 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r326624 - head/sys/cam/ata > > Author: asomers > Date: Wed Dec 6 17:01:25 2017 > New Revision: 326624 > URL: https://svnweb.freebsd.org/changeset/base/326624 > > Log: > cam: fix sign-extension error in adagetparams > > adagetparams contains a sign-extension error that will cause the sector > count to be incorrectly calculated for ATA disks of >=1TiB that still use > CHS addressing. Disks using LBA48 addressing are unaffected. > > Reported by: Coverity > CID: 1007296 > Reviewed by: ken > MFC after:3 weeks > Sponsored by: Spectra Logic Corp > Differential Revision:https://reviews.freebsd.org/D13198 > > Modified: > head/sys/cam/ata/ata_da.c > > Modified: head/sys/cam/ata/ata_da.c > > == > --- head/sys/cam/ata/ata_da.c Wed Dec 6 14:53:53 2017(r326623) > +++ head/sys/cam/ata/ata_da.c Wed Dec 6 17:01:25 2017(r326624) > @@ -3377,7 +3377,8 @@ adagetparams(struct cam_periph *periph, struct > ccb_get > dp->heads = cgd->ident_data.heads; > dp->secs_per_track = cgd->ident_data.sectors; > dp->cylinders = cgd->ident_data.cylinders; > - dp->sectors = cgd->ident_data.cylinders * dp->heads * > dp->secs_per_track; > + dp->sectors = cgd->ident_data.cylinders * > + (u_int32_t)(dp->heads * dp->secs_per_track); > } > lbasize = (u_int32_t)cgd->ident_data.lba_size_1 | > ((u_int32_t)cgd->ident_data.lba_size_2 << 16); > > > > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326628 - head/contrib/tcpdump
On Wed, Dec 06, 2017 at 06:11:56PM +, Ed Maste wrote: E> Author: emaste E> Date: Wed Dec 6 18:11:56 2017 E> New Revision: 326628 E> URL: https://svnweb.freebsd.org/changeset/base/326628 E> E> Log: E> tcpdump: remove undesired svn:keywords property from contrib Thanks! -- Gleb Smirnoff ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326628 - head/contrib/tcpdump
Author: emaste Date: Wed Dec 6 18:11:56 2017 New Revision: 326628 URL: https://svnweb.freebsd.org/changeset/base/326628 Log: tcpdump: remove undesired svn:keywords property from contrib Reported by: glebius MFC after:6 days MFC with: r326613 Modified: Directory Properties: head/contrib/tcpdump/ (props changed) head/contrib/tcpdump/funcattrs.h (props changed) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326624 - head/sys/cam/ata
> ... disks of >=1TiB that still use CHS addressing. Out of morbid curiosity, are there any such monstrosities? -Ravi (rpokala@) -Original Message- From: on behalf of Alan Somers Date: 2017-12-06, Wednesday at 09:01 To: , , Subject: svn commit: r326624 - head/sys/cam/ata Author: asomers Date: Wed Dec 6 17:01:25 2017 New Revision: 326624 URL: https://svnweb.freebsd.org/changeset/base/326624 Log: cam: fix sign-extension error in adagetparams adagetparams contains a sign-extension error that will cause the sector count to be incorrectly calculated for ATA disks of >=1TiB that still use CHS addressing. Disks using LBA48 addressing are unaffected. Reported by: Coverity CID: 1007296 Reviewed by: ken MFC after:3 weeks Sponsored by: Spectra Logic Corp Differential Revision:https://reviews.freebsd.org/D13198 Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Wed Dec 6 14:53:53 2017(r326623) +++ head/sys/cam/ata/ata_da.c Wed Dec 6 17:01:25 2017(r326624) @@ -3377,7 +3377,8 @@ adagetparams(struct cam_periph *periph, struct ccb_get dp->heads = cgd->ident_data.heads; dp->secs_per_track = cgd->ident_data.sectors; dp->cylinders = cgd->ident_data.cylinders; - dp->sectors = cgd->ident_data.cylinders * dp->heads * dp->secs_per_track; + dp->sectors = cgd->ident_data.cylinders * + (u_int32_t)(dp->heads * dp->secs_per_track); } lbasize = (u_int32_t)cgd->ident_data.lba_size_1 | ((u_int32_t)cgd->ident_data.lba_size_2 << 16); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326626 - head/lib/libproc
Author: markj Date: Wed Dec 6 17:52:01 2017 New Revision: 326626 URL: https://svnweb.freebsd.org/changeset/base/326626 Log: Use a global extern declaration to appease gcc. Reported by: gjb X-MFC with: r326498 Modified: head/lib/libproc/proc_create.c Modified: head/lib/libproc/proc_create.c == --- head/lib/libproc/proc_create.c Wed Dec 6 17:50:10 2017 (r326625) +++ head/lib/libproc/proc_create.c Wed Dec 6 17:52:01 2017 (r326626) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include "_libproc.h" +extern char * const *environ; + static int getelfclass(int); static int proc_init(pid_t, int, int, struct proc_handle **); @@ -179,7 +181,6 @@ int proc_create(const char *file, char * const *argv, char * const *envp, proc_child_func *pcf, void *child_arg, struct proc_handle **pphdl) { - extern char * const *environ; struct proc_handle *phdl; int error, status; pid_t pid; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326625 - head/usr.bin/logger
Author: glebius Date: Wed Dec 6 17:50:10 2017 New Revision: 326625 URL: https://svnweb.freebsd.org/changeset/base/326625 Log: Fix crash with a dotless hostname. Modified: head/usr.bin/logger/logger.c Modified: head/usr.bin/logger/logger.c == --- head/usr.bin/logger/logger.cWed Dec 6 17:01:25 2017 (r326624) +++ head/usr.bin/logger/logger.cWed Dec 6 17:50:10 2017 (r326625) @@ -183,7 +183,7 @@ main(int argc, char *argv[]) if (hostname == NULL) { hostname = hbuf; (void )gethostname(hbuf, MAXHOSTNAMELEN); - *strchr(hostname, '.') = '\0'; + *strchrnul(hostname, '.') = '\0'; } /* log input line if appropriate */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326624 - head/sys/cam/ata
Author: asomers Date: Wed Dec 6 17:01:25 2017 New Revision: 326624 URL: https://svnweb.freebsd.org/changeset/base/326624 Log: cam: fix sign-extension error in adagetparams adagetparams contains a sign-extension error that will cause the sector count to be incorrectly calculated for ATA disks of >=1TiB that still use CHS addressing. Disks using LBA48 addressing are unaffected. Reported by: Coverity CID: 1007296 Reviewed by: ken MFC after:3 weeks Sponsored by: Spectra Logic Corp Differential Revision:https://reviews.freebsd.org/D13198 Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c == --- head/sys/cam/ata/ata_da.c Wed Dec 6 14:53:53 2017(r326623) +++ head/sys/cam/ata/ata_da.c Wed Dec 6 17:01:25 2017(r326624) @@ -3377,7 +3377,8 @@ adagetparams(struct cam_periph *periph, struct ccb_get dp->heads = cgd->ident_data.heads; dp->secs_per_track = cgd->ident_data.sectors; dp->cylinders = cgd->ident_data.cylinders; - dp->sectors = cgd->ident_data.cylinders * dp->heads * dp->secs_per_track; + dp->sectors = cgd->ident_data.cylinders * + (u_int32_t)(dp->heads * dp->secs_per_track); } lbasize = (u_int32_t)cgd->ident_data.lba_size_1 | ((u_int32_t)cgd->ident_data.lba_size_2 << 16); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326623 - head/sys/arm/allwinner
Author: kevans Date: Wed Dec 6 14:53:53 2017 New Revision: 326623 URL: https://svnweb.freebsd.org/changeset/base/326623 Log: aw_mp.c: use argument name in macros Rather than relying on 'cluster' existing in the context they're used in, use the argument name. Differential Revision:https://reviews.freebsd.org/D12931 Modified: head/sys/arm/allwinner/aw_mp.c Modified: head/sys/arm/allwinner/aw_mp.c == --- head/sys/arm/allwinner/aw_mp.c Wed Dec 6 10:47:50 2017 (r326622) +++ head/sys/arm/allwinner/aw_mp.c Wed Dec 6 14:53:53 2017 (r326623) @@ -83,13 +83,13 @@ __FBSDID("$FreeBSD$"); #defineCPUCFG_DBGCTL0 0x1e0 #defineCPUCFG_DBGCTL1 0x1e4 -#defineCPUS_CL_RST(cl) (0x30 + (cluster) * 0x4) -#defineCPUX_CL_CTRL0(cl) (0x0 + (cluster) * 0x10) -#defineCPUX_CL_CTRL1(cl) (0x4 + (cluster) * 0x10) -#defineCPUX_CL_CPU_STATUS(cl) (0x30 + (cluster) * 0x4) -#defineCPUX_CL_RST(cl) (0x80 + (cluster) * 0x4) -#definePRCM_CL_PWROFF(cl) (0x100 + (cluster) * 0x4) -#definePRCM_CL_PWR_CLAMP(cl, cpu) (0x140 + (cluster) * 0x4 + (cpu) * 0x4) +#defineCPUS_CL_RST(cl) (0x30 + (cl) * 0x4) +#defineCPUX_CL_CTRL0(cl) (0x0 + (cl) * 0x10) +#defineCPUX_CL_CTRL1(cl) (0x4 + (cl) * 0x10) +#defineCPUX_CL_CPU_STATUS(cl) (0x30 + (cl) * 0x4) +#defineCPUX_CL_RST(cl) (0x80 + (cl) * 0x4) +#definePRCM_CL_PWROFF(cl) (0x100 + (cl) * 0x4) +#definePRCM_CL_PWR_CLAMP(cl, cpu) (0x140 + (cl) * 0x4 + (cpu) * 0x4) void aw_mp_setmaxid(platform_t plat) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326622 - head/usr.sbin/newsyslog
Author: bapt Date: Wed Dec 6 10:47:50 2017 New Revision: 326622 URL: https://svnweb.freebsd.org/changeset/base/326622 Log: Really fix typo and improve wording of the comment Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 10:20:01 2017 (r326621) +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 10:47:50 2017 (r326622) @@ -151,7 +151,7 @@ struct compress_types { const char *flag; /* Flag in configuration file */ const char *suffix; /* Compression suffix */ const char *path; /* Path to compression program */ - char **args;/* Compession arguments */ + char **args;/* Compression program arguments */ }; static char f_arg[] = "-f"; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326621 - head/usr.sbin/newsyslog
On Wed, Dec 06, 2017 at 10:41:34AM +, Alexey Dokuchaev wrote: > On Wed, Dec 06, 2017 at 10:20:01AM +, Baptiste Daroussin wrote: > > New Revision: 326621 > > URL: https://svnweb.freebsd.org/changeset/base/326621 > > > > Log: > > Fix typo > > Still not fixed. > > > Reported by: danfe > > > > Modified: > > head/usr.sbin/newsyslog/newsyslog.c > > > > Modified: head/usr.sbin/newsyslog/newsyslog.c > > == > > --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 10:06:00 2017 > > (r326620) > > +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 10:20:01 2017 > > (r326621) > > @@ -151,7 +151,7 @@ struct compress_types { > > const char *flag; /* Flag in configuration file */ > > const char *suffix; /* Compression suffix */ > > const char *path; /* Path to compression program */ > > - char **args;/* Comrpession arguments */ > > + char **args;/* Compession arguments */ > > Spelling is hard, I know. :-) meh > > Compession -> "Compression program arguments" perhaps? done :) Thanks, Bapt signature.asc Description: PGP signature
Re: svn commit: r326621 - head/usr.sbin/newsyslog
On Wed, Dec 06, 2017 at 10:20:01AM +, Baptiste Daroussin wrote: > New Revision: 326621 > URL: https://svnweb.freebsd.org/changeset/base/326621 > > Log: > Fix typo Still not fixed. > Reported by:danfe > > Modified: > head/usr.sbin/newsyslog/newsyslog.c > > Modified: head/usr.sbin/newsyslog/newsyslog.c > == > --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 10:06:00 2017 > (r326620) > +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 10:20:01 2017 > (r326621) > @@ -151,7 +151,7 @@ struct compress_types { > const char *flag; /* Flag in configuration file */ > const char *suffix; /* Compression suffix */ > const char *path; /* Path to compression program */ > - char **args;/* Comrpession arguments */ > + char **args;/* Compession arguments */ Spelling is hard, I know. :-) Compession -> "Compression program arguments" perhaps? ./danfe ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326617 - head/usr.sbin/newsyslog
On Wed, Dec 06, 2017 at 10:15:35AM +, Alexey Dokuchaev wrote: > On Wed, Dec 06, 2017 at 09:44:35AM +, Baptiste Daroussin wrote: > > New Revision: 326617 > > URL: https://svnweb.freebsd.org/changeset/base/326617 > > > > Log: > > Allow newsyslog to execute compression commands which > > have a semantic different than the traditional gzip(1) > > > > This is done to allow to use zstd(1) as a compression tool without > > having to patch it to change its default behavior. > > > > Modified: > > head/usr.sbin/newsyslog/newsyslog.c > > > > Modified: head/usr.sbin/newsyslog/newsyslog.c > > == > > --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 06:49:53 2017 > > (r326616) > > +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 09:44:35 2017 > > (r326617) > > @@ -151,14 +151,23 @@ struct compress_types { > > const char *flag; /* Flag in configuration file */ > > const char *suffix; /* Compression suffix */ > > const char *path; /* Path to compression program */ > > + char **args;/* Comrpession arguments */ > > Comrpession? Fixed thanks > > > + strlcpy(command, pgm_path, sizeof(command)); > > + for (c = 1; args[c] != NULL; c++) { > > + strlcat(command, " ", sizeof(command)); > > + strlcat(command, args[c], sizeof(command)); > > + } > > I'm wondering if we should check strlcpy/strlcat() return values here and > abort early if someone is trying to overrun command buffer? > At worse we will have a truncated command to prompt in the debug/verbose informations, which imho is fine. Best regards, Bapt signature.asc Description: PGP signature
svn commit: r326621 - head/usr.sbin/newsyslog
Author: bapt Date: Wed Dec 6 10:20:01 2017 New Revision: 326621 URL: https://svnweb.freebsd.org/changeset/base/326621 Log: Fix typo Reported by: danfe Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 10:06:00 2017 (r326620) +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 10:20:01 2017 (r326621) @@ -151,7 +151,7 @@ struct compress_types { const char *flag; /* Flag in configuration file */ const char *suffix; /* Compression suffix */ const char *path; /* Path to compression program */ - char **args;/* Comrpession arguments */ + char **args;/* Compession arguments */ }; static char f_arg[] = "-f"; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r326617 - head/usr.sbin/newsyslog
On Wed, Dec 06, 2017 at 09:44:35AM +, Baptiste Daroussin wrote: > New Revision: 326617 > URL: https://svnweb.freebsd.org/changeset/base/326617 > > Log: > Allow newsyslog to execute compression commands which > have a semantic different than the traditional gzip(1) > > This is done to allow to use zstd(1) as a compression tool without > having to patch it to change its default behavior. > > Modified: > head/usr.sbin/newsyslog/newsyslog.c > > Modified: head/usr.sbin/newsyslog/newsyslog.c > == > --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 06:49:53 2017 > (r326616) > +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 09:44:35 2017 > (r326617) > @@ -151,14 +151,23 @@ struct compress_types { > const char *flag; /* Flag in configuration file */ > const char *suffix; /* Compression suffix */ > const char *path; /* Path to compression program */ > + char **args;/* Comrpession arguments */ Comrpession? > + strlcpy(command, pgm_path, sizeof(command)); > + for (c = 1; args[c] != NULL; c++) { > + strlcat(command, " ", sizeof(command)); > + strlcat(command, args[c], sizeof(command)); > + } I'm wondering if we should check strlcpy/strlcat() return values here and abort early if someone is trying to overrun command buffer? ./danfe ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326618 - head/sys/contrib/zstd/programs
Author: bapt Date: Wed Dec 6 09:53:10 2017 New Revision: 326618 URL: https://svnweb.freebsd.org/changeset/base/326618 Log: Revert local changes made to make zstd(1) frontend behave like gzip(1) and friends This change was made to allow zstd(1) to be a dropin replacement for gzip(1) and friends, allowing easy integration, in particular with newsyslog(8). At the price of having a zstd(1) command which by default behaves differently than what upstream default, confusing users. newsyslog(8) has been adapted to now be more flexible in what it accepts as compression program, so we can switch back zstd(1) to its default behaviour Reported by: many Modified: head/sys/contrib/zstd/programs/fileio.c head/sys/contrib/zstd/programs/zstdcli.c Modified: head/sys/contrib/zstd/programs/fileio.c == --- head/sys/contrib/zstd/programs/fileio.c Wed Dec 6 09:44:35 2017 (r326617) +++ head/sys/contrib/zstd/programs/fileio.c Wed Dec 6 09:53:10 2017 (r326618) @@ -203,7 +203,7 @@ static U32 g_dictIDFlag = 1; void FIO_setDictIDFlag(unsigned dictIDFlag) { g_dictIDFlag = dictIDFlag; } static U32 g_checksumFlag = 1; void FIO_setChecksumFlag(unsigned checksumFlag) { g_checksumFlag = checksumFlag; } -static U32 g_removeSrcFile = 1; +static U32 g_removeSrcFile = 0; void FIO_setRemoveSrcFile(unsigned flag) { g_removeSrcFile = (flag>0); } static U32 g_memLimit = 0; void FIO_setMemLimit(unsigned memLimit) { g_memLimit = memLimit; } Modified: head/sys/contrib/zstd/programs/zstdcli.c == --- head/sys/contrib/zstd/programs/zstdcli.cWed Dec 6 09:44:35 2017 (r326617) +++ head/sys/contrib/zstd/programs/zstdcli.cWed Dec 6 09:53:10 2017 (r326618) @@ -68,7 +68,7 @@ #define MB *(1 <<20) #define GB *(1U<<30) -#define DISPLAY_LEVEL_DEFAULT 1 +#define DISPLAY_LEVEL_DEFAULT 2 static const char*g_defaultDictName = "dictionary"; static const unsigned g_defaultMaxDictSize = 110 KB; @@ -421,7 +421,7 @@ int main(int argCount, const char* argv[]) /* preset behaviors */ if (exeNameMatch(programName, ZSTD_ZSTDMT)) nbThreads=0; if (exeNameMatch(programName, ZSTD_UNZSTD)) operation=zom_decompress; -if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(); outFileName=stdoutmark; g_displayLevel=1; FIO_setRemoveSrcFile(0); } +if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(); outFileName=stdoutmark; g_displayLevel=1; } if (exeNameMatch(programName, ZSTD_GZ)) { suffix = GZ_EXTENSION; FIO_setCompressionType(FIO_gzipCompression); FIO_setRemoveSrcFile(1); }/* behave like gzip */ if (exeNameMatch(programName, ZSTD_GUNZIP)) { operation=zom_decompress; FIO_setRemoveSrcFile(1); } /* behave like gunzip */ if (exeNameMatch(programName, ZSTD_GZCAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(); outFileName=stdoutmark; g_displayLevel=1; } /* behave like gzcat */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326617 - head/usr.sbin/newsyslog
Author: bapt Date: Wed Dec 6 09:44:35 2017 New Revision: 326617 URL: https://svnweb.freebsd.org/changeset/base/326617 Log: Allow newsyslog to execute compression commands which have a semantic different than the traditional gzip(1) This is done to allow to use zstd(1) as a compression tool without having to patch it to change its default behavior. Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 06:49:53 2017 (r326616) +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 09:44:35 2017 (r326617) @@ -151,14 +151,23 @@ struct compress_types { const char *flag; /* Flag in configuration file */ const char *suffix; /* Compression suffix */ const char *path; /* Path to compression program */ + char **args;/* Comrpession arguments */ }; +static char f_arg[] = "-f"; +static char q_arg[] = "-q"; +static char rm_arg[] = "--rm"; +static char *gz_args[] ={ NULL, f_arg, NULL, NULL }; +#define bzip2_args gz_args +#define xz_args gz_args +static char *zstd_args[] = { NULL, q_arg, rm_arg, NULL, NULL }; + static const struct compress_types compress_type[COMPRESS_TYPES] = { - { "", "", "" }, /* no compression */ - { "Z", COMPRESS_SUFFIX_GZ, _PATH_GZIP },/* gzip compression */ - { "J", COMPRESS_SUFFIX_BZ2, _PATH_BZIP2 }, /* bzip2 compression */ - { "X", COMPRESS_SUFFIX_XZ, _PATH_XZ }, /* xz compression */ - { "Y", COMPRESS_SUFFIX_ZST, _PATH_ZSTD }/* zst compression */ + { "", "", "", NULL},/* none */ + { "Z", COMPRESS_SUFFIX_GZ, _PATH_GZIP, gz_args},/* gzip */ + { "J", COMPRESS_SUFFIX_BZ2, _PATH_BZIP2, bzip2_args}, /* bzip2 */ + { "X", COMPRESS_SUFFIX_XZ, _PATH_XZ, xz_args }, /* xz */ + { "Y", COMPRESS_SUFFIX_ZST, _PATH_ZSTD, zstd_args } /* zst */ }; struct conf_entry { @@ -2001,6 +2010,8 @@ do_zipwork(struct zipwork_entry *zwork) int errsav, fcount, zstatus; pid_t pidzip, wpid; char zresult[MAXPATHLEN]; + char command[BUFSIZ]; + char **args; int c; assert(zwork != NULL); @@ -2013,6 +2024,7 @@ do_zipwork(struct zipwork_entry *zwork) pgm_path = compress_type[c].path; (void) strlcat(zresult, compress_type[c].suffix, sizeof(zresult)); + args = compress_type[c].args; break; } } @@ -2026,6 +2038,13 @@ do_zipwork(struct zipwork_entry *zwork) else pgm_name++; + args[0] = strdup(pgm_name); + if (args[0] == NULL) + err(1, "strdup()"); + for (c = 0; args[c] != NULL; c++) + ; + args[c] = zwork->zw_fname; + if (zwork->zw_swork != NULL && zwork->zw_swork->sw_runcmd == 0 && zwork->zw_swork->sw_pidok <= 0) { warnx( @@ -2035,6 +2054,11 @@ do_zipwork(struct zipwork_entry *zwork) return; } + strlcpy(command, pgm_path, sizeof(command)); + for (c = 1; args[c] != NULL; c++) { + strlcat(command, " ", sizeof(command)); + strlcat(command, args[c], sizeof(command)); + } if (noaction) { printf("\t%s %s\n", pgm_name, zwork->zw_fname); change_attrs(zresult, zwork->zw_conf); @@ -2058,8 +2082,8 @@ do_zipwork(struct zipwork_entry *zwork) } if (!pidzip) { /* The child process executes the compression command */ - execl(pgm_path, pgm_path, "-f", zwork->zw_fname, (char *)0); - err(1, "execl(`%s -f %s')", pgm_path, zwork->zw_fname); + execv(pgm_path, (char *const*) args); + err(1, "execv(`%s')", command); } wpid = waitpid(pidzip, &zstatus, 0); @@ -2069,13 +2093,12 @@ do_zipwork(struct zipwork_entry *zwork) return; } if (!WIFEXITED(zstatus)) { - warnx("`%s -f %s' did not terminate normally", pgm_name, - zwork->zw_fname); + warnx("`%s' did not terminate normally", command); return; } if (WEXITSTATUS(zstatus)) { - warnx("`%s -f %s' terminated with a non-zero status (%d)", - pgm_name, zwork->zw_fname, WEXITSTATUS(zstatus)); + warnx("`%s' terminated with a non-zero status (%d)", command, + WEXITSTATUS(zstatus)); return; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-he
Re: svn commit: r316980 - head/contrib/zstd/programs
On Tue, Dec 05, 2017 at 08:42:11PM -0500, Allan Jude wrote: > On 2017-12-05 20:17, Conrad Meyer wrote: > > Ping. Please revert this change. If you want zstd to behave this > > way, pursue it upstream first. > > > > Thanks, > > Conrad > > > > On Wed, Nov 15, 2017 at 7:38 PM, Conrad Meyer wrote: > >> Please revert this change. > >> > >> First, it introduces the POLA-violating behavior that zstdcat deletes > >> its source files. This is not how zcat/bzcat behaves. > >> > >> Second, it introduces a needless behavioral difference between FreeBSD > >> zstd and the rest of the world's zstd. The zstd documentation we ship > >> continues to claim that zstd preserves source files by default, yet > >> this change makes that documentation exactly backwards. While we can > >> change FreeBSD's documentation to accommodate the change, we can't > >> change Google results. > >> > >> Thanks, > >> Conrad > >> > >> On Sat, Apr 15, 2017 at 1:15 PM, Baptiste Daroussin > >> wrote: > >>> Author: bapt > >>> Date: Sat Apr 15 20:15:44 2017 > >>> New Revision: 316980 > >>> URL: https://svnweb.freebsd.org/changeset/base/316980 > >>> > >>> Log: > >>> Change some default to make zstd a dropin replacement for gzip,bzip etc > >>> in most cases > >>> > >>> Changes ares: > >>> - quiet by default > >>> - remove the source files one compression completion by default > >>> > >>> Modified: > >>> head/contrib/zstd/programs/fileio.c > >>> head/contrib/zstd/programs/zstdcli.c > >>> > >>> Modified: head/contrib/zstd/programs/fileio.c > >>> == > >>> --- head/contrib/zstd/programs/fileio.c Sat Apr 15 20:06:24 2017 > >>> (r316979) > >>> +++ head/contrib/zstd/programs/fileio.c Sat Apr 15 20:15:44 2017 > >>> (r316980) > >>> @@ -138,7 +138,7 @@ static U32 g_dictIDFlag = 1; > >>> void FIO_setDictIDFlag(unsigned dictIDFlag) { g_dictIDFlag = dictIDFlag; > >>> } > >>> static U32 g_checksumFlag = 1; > >>> void FIO_setChecksumFlag(unsigned checksumFlag) { g_checksumFlag = > >>> checksumFlag; } > >>> -static U32 g_removeSrcFile = 0; > >>> +static U32 g_removeSrcFile = 1; > >>> void FIO_setRemoveSrcFile(unsigned flag) { g_removeSrcFile = (flag>0); } > >>> static U32 g_memLimit = 0; > >>> void FIO_setMemLimit(unsigned memLimit) { g_memLimit = memLimit; } > >>> > >>> Modified: head/contrib/zstd/programs/zstdcli.c > >>> == > >>> --- head/contrib/zstd/programs/zstdcli.cSat Apr 15 20:06:24 2017 > >>> (r316979) > >>> +++ head/contrib/zstd/programs/zstdcli.cSat Apr 15 20:15:44 2017 > >>> (r316980) > >>> @@ -61,7 +61,7 @@ > >>> #define MB *(1 <<20) > >>> #define GB *(1U<<30) > >>> > >>> -#define DEFAULT_DISPLAY_LEVEL 2 > >>> +#define DEFAULT_DISPLAY_LEVEL 1 > >>> > >>> static const char*g_defaultDictName = "dictionary"; > >>> static const unsigned g_defaultMaxDictSize = 110 KB; > >>> > > > > Upstream recommends we create an additional hardlink, called 'zz' (like > xz but zstd), to do such compatibility, and keep 'zstd' the same as zstd > on every other distro. > Actually I would prefer not to do it and simply adapt newsyslog to be more flexible. it is the only consumer of the zstd command. Bapt signature.asc Description: PGP signature
Re: svn commit: r316980 - head/contrib/zstd/programs
On Tue, Dec 05, 2017 at 05:17:22PM -0800, Conrad Meyer wrote: > Ping. Please revert this change. If you want zstd to behave this > way, pursue it upstream first. This is planned, for now I first need to modify newsyslog to accept more arguments for the compression program, then I'll switch back zstd to a vanilla. I am not pushing into the direction of yet another hardlink > > Thanks, > Conrad > > On Wed, Nov 15, 2017 at 7:38 PM, Conrad Meyer wrote: > > Please revert this change. > > > > First, it introduces the POLA-violating behavior that zstdcat deletes > > its source files. This is not how zcat/bzcat behaves. > > > > Second, it introduces a needless behavioral difference between FreeBSD > > zstd and the rest of the world's zstd. The zstd documentation we ship > > continues to claim that zstd preserves source files by default, yet > > this change makes that documentation exactly backwards. While we can > > change FreeBSD's documentation to accommodate the change, we can't > > change Google results. > > > > Thanks, > > Conrad > > > > On Sat, Apr 15, 2017 at 1:15 PM, Baptiste Daroussin > > wrote: > >> Author: bapt > >> Date: Sat Apr 15 20:15:44 2017 > >> New Revision: 316980 > >> URL: https://svnweb.freebsd.org/changeset/base/316980 > >> > >> Log: > >> Change some default to make zstd a dropin replacement for gzip,bzip etc > >> in most cases > >> > >> Changes ares: > >> - quiet by default > >> - remove the source files one compression completion by default > >> > >> Modified: > >> head/contrib/zstd/programs/fileio.c > >> head/contrib/zstd/programs/zstdcli.c > >> > >> Modified: head/contrib/zstd/programs/fileio.c > >> == > >> --- head/contrib/zstd/programs/fileio.c Sat Apr 15 20:06:24 2017 > >> (r316979) > >> +++ head/contrib/zstd/programs/fileio.c Sat Apr 15 20:15:44 2017 > >> (r316980) > >> @@ -138,7 +138,7 @@ static U32 g_dictIDFlag = 1; > >> void FIO_setDictIDFlag(unsigned dictIDFlag) { g_dictIDFlag = dictIDFlag; } > >> static U32 g_checksumFlag = 1; > >> void FIO_setChecksumFlag(unsigned checksumFlag) { g_checksumFlag = > >> checksumFlag; } > >> -static U32 g_removeSrcFile = 0; > >> +static U32 g_removeSrcFile = 1; > >> void FIO_setRemoveSrcFile(unsigned flag) { g_removeSrcFile = (flag>0); } > >> static U32 g_memLimit = 0; > >> void FIO_setMemLimit(unsigned memLimit) { g_memLimit = memLimit; } > >> > >> Modified: head/contrib/zstd/programs/zstdcli.c > >> == > >> --- head/contrib/zstd/programs/zstdcli.cSat Apr 15 20:06:24 2017 > >> (r316979) > >> +++ head/contrib/zstd/programs/zstdcli.cSat Apr 15 20:15:44 2017 > >> (r316980) > >> @@ -61,7 +61,7 @@ > >> #define MB *(1 <<20) > >> #define GB *(1U<<30) > >> > >> -#define DEFAULT_DISPLAY_LEVEL 2 > >> +#define DEFAULT_DISPLAY_LEVEL 1 > >> > >> static const char*g_defaultDictName = "dictionary"; > >> static const unsigned g_defaultMaxDictSize = 110 KB; > >> signature.asc Description: PGP signature