Re: svn commit: r227650 - in head: lib/libkiconv sys/conf sys/fs/msdosfs sys/fs/smbfs sys/kern sys/libkern sys/modules/libiconv sys/modules/libmchain sys/netsmb sys/sys
On Fri, 2011-11-18 at 03:19 +, Alexey Dokuchaev wrote: > On Fri, Nov 18, 2011 at 03:05:21AM +, Kevin Lo wrote: > > Author: kevlo > > Date: Fri Nov 18 03:05:20 2011 > > New Revision: 227650 > > URL: http://svn.freebsd.org/changeset/base/227650 > > > > Log: > > Add unicode support to msdosfs and smbfs; original pathes from imura, > > bug fixes by Kuan-Chung Chiu . > > Wow, long anticipated! Any MFCs planned? Will do until 9.0 is released. > I've also posted a message[1] on > unicode support for msdosfs/ntfs on -fs@ back in October, perhaps you could > take a look on these patches and, ultimately, fix NTFS too? :-) Could you try the attached patch which adds unicode support to NTFS? Thanks! > > Thanks! > > ./danfe > > [1] http://docs.freebsd.org/cgi/mid.cgi?20111013181602.GA35354 Kevin Index: sys/fs/ntfs/ntfs_vnops.c === --- sys/fs/ntfs/ntfs_vnops.c (revision 227854) +++ sys/fs/ntfs/ntfs_vnops.c (working copy) @@ -481,7 +481,7 @@ ntfs_readdir(ap) struct uio *uio = ap->a_uio; struct ntfsmount *ntmp = ip->i_mp; int i, j, error = 0; - wchar c; + char *c; u_int32_t faked = 0, num; int ncookies = 0; struct dirent cde; @@ -538,11 +538,10 @@ ntfs_readdir(ap) if(!ntfs_isnamepermitted(ntmp,iep)) continue; - for(i=0, j=0; iie_fnamelen; i++, j++) { + for(i=0, j=0; iie_fnamelen; i++) { c = NTFS_U28(iep->ie_fname[i]); -if (c&0xFF00) - cde.d_name[j++] = (char)(c>>8); -cde.d_name[j] = (char)c&0xFF; +while (*c != '\0') + cde.d_name[j++] = *c++; } cde.d_name[j] = '\0'; dprintf(("ntfs_readdir: elem: %d, fname:[%s] type: %d, flag: %d, ", Index: sys/fs/ntfs/ntfs_subr.c === --- sys/fs/ntfs/ntfs_subr.c (revision 227854) +++ sys/fs/ntfs/ntfs_subr.c (working copy) @@ -669,23 +669,17 @@ ntfs_uastricmp(ntmp, ustr, ustrlen, astr, astrlen) const char *astr; size_t astrlen; { - int len; + const char *astrp = astr; + int len, res; size_t i, j, mbstrlen = astrlen; - int res; - wchar wc; if (ntmp->ntm_ic_l2u) { - for (i = 0, j = 0; i < ustrlen && j < astrlen; i++, j++) { - if (j < astrlen -1) { -wc = (wchar)astr[j]<<8 | (astr[j+1]&0xFF); -len = 2; - } else { -wc = (wchar)astr[j]<<8 & 0xFF00; -len = 1; - } + for (i = 0, j = 0; i < ustrlen && j < astrlen; i++) { + len = 4; res = ((int) NTFS_TOUPPER(ustr[i])) - -((int)NTFS_TOUPPER(NTFS_82U(wc, &len))); - j += len - 1; + ((int)NTFS_TOUPPER(NTFS_82U(astrp, &len))); + astrp += len; + j += len; mbstrlen -= len - 1; if (res) @@ -698,7 +692,8 @@ ntfs_uastricmp(ntmp, ustr, ustrlen, astr, astrlen) */ for (i = 0; i < ustrlen && i < astrlen; i++) { res = ((int) NTFS_TOUPPER(NTFS_82U(NTFS_U28(ustr[i]), &len))) - -((int)NTFS_TOUPPER(NTFS_82U((wchar)astr[i], &len))); +((int)NTFS_TOUPPER(NTFS_82U(astrp, &len))); + astrp++; if (res) return res; } @@ -717,23 +712,18 @@ ntfs_uastrcmp(ntmp, ustr, ustrlen, astr, astrlen) const char *astr; size_t astrlen; { - char u, l; + char *c; size_t i, j, mbstrlen = astrlen; int res; - wchar wc; - for (i = 0, j = 0; (i < ustrlen) && (j < astrlen); i++, j++) { - res = 0; - wc = NTFS_U28(ustr[i]); - u = (char)(wc>>8); - l = (char)wc; - if (u != '\0' && j < astrlen -1) { - res = (int) (u - astr[j++]); + for (i = 0, j = 0; (i < ustrlen) && (j < astrlen); i++, mbstrlen++) { + c = NTFS_U28(ustr[i]); + while (*c != '\0') { + res = (int) (*c++ - astr[j++]); + if (res) +return res; mbstrlen--; } - res = (res<<8) + (int) (l - astr[j]); - if (res) - return res; } return (ustrlen - mbstrlen); } @@ -2137,50 +2127,47 @@ ntfs_82u_uninit(struct ntfsmount *ntmp) } /* - * maps the Unicode char to 8bit equivalent - * XXX currently only gets lower 8bit from the Unicode char - * and substitutes a '_' for it if the result would be '\0'; - * something better has to be definitely though out + * maps the Unicode char to local character */ -wchar +char * ntfs_u28( struct ntfsmount *ntmp, wchar wc) { - char *p, *outp, inbuf[3], outbuf[3]; + char *p, *outp, inbuf[3], outbuf[5];; size_t ilen, olen; + outp = outbuf; if (ntfs_iconv && ntmp->ntm_ic_u2l) { - ilen = olen = 2; + ilen = 2; + olen = 4; inbuf[0] = (char)(wc>>8); inbuf[1] = (char)wc; inbuf[2] = '\0'; p = inbuf; - outp = outbuf; ntfs_iconv->convchr(ntmp->ntm_ic_u2l, (const char **)&p, &ilen, &outp, &olen); - if (olen == 1) { - return ((wchar)(outbuf[0]&0xFF)); - } else if (olen == 0) { - return ((wchar)((outbuf[0]<<8) | (outbuf[1]&0xFF))); - } - return ('?'); + if (olen == 4) + *outp++ = '?'; + *outp = '\0'; + outp = outbuf; + return (outp); } p = ntmp->ntm_u28[(wc>>8)&0xFF]; - if (p == NULL) - return ('_'); - return (p[wc&0xFF]&0xFF); + outbuf[0] = (p == NULL) ? '_' : p[wc&0xFF] & 0xFF; + outbuf[1] = '\0'; + return
Re: svn commit: r227650 - in head: lib/libkiconv sys/conf sys/fs/msdosfs sys/fs/smbfs sys/kern sys/libkern sys/modules/libiconv sys/modules/libmchain sys/netsmb sys/sys
Also, I've regenerated imura's patch for cd9660 against HEAD, but I don't have test case. Please test it. http://www.cnmc.tw/~buganini/cd9660.patch.txt Buganini ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227868 - head/sys/dev/ath
Author: adrian Date: Wed Nov 23 05:00:25 2011 New Revision: 227868 URL: http://svn.freebsd.org/changeset/base/227868 Log: Flesh out the TX aggregation completion statistics. * Failall is now named just that. * Add TX ok and TX fail, for aggregate frame sub-frames. This will break athstats; a followup commit wil resolve this. Sponsored by: Hobnob, Inc. Modified: head/sys/dev/ath/if_ath_sysctl.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_ath_sysctl.c == --- head/sys/dev/ath/if_ath_sysctl.cWed Nov 23 03:55:48 2011 (r227867) +++ head/sys/dev/ath/if_ath_sysctl.cWed Nov 23 05:00:25 2011 (r227868) @@ -842,9 +842,15 @@ ath_sysctl_stats_attach(struct ath_softc &sc->sc_stats.ast_tx_data_underrun, 0, ""); SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_delim_underrun", CTLFLAG_RD, &sc->sc_stats.ast_tx_delim_underrun, 0, ""); - SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_aggrfail", CTLFLAG_RD, - &sc->sc_stats.ast_tx_aggrfail, 0, + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_aggr_failall", CTLFLAG_RD, + &sc->sc_stats.ast_tx_aggr_failall, 0, "Number of aggregate TX failures (whole frame)"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_aggr_ok", CTLFLAG_RD, + &sc->sc_stats.ast_tx_aggr_ok, 0, + "Number of aggregate TX OK completions (subframe)"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_aggr_fail", CTLFLAG_RD, + &sc->sc_stats.ast_tx_aggr_fail, 0, + "Number of aggregate TX failures (subframe)"); SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_intr", CTLFLAG_RD, &sc->sc_stats.ast_rx_intr, 0, "RX interrupts"); Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cWed Nov 23 03:55:48 2011 (r227867) +++ head/sys/dev/ath/if_ath_tx.cWed Nov 23 05:00:25 2011 (r227868) @@ -2940,7 +2940,6 @@ ath_tx_comp_aggr_error(struct ath_softc TAILQ_INIT(&bf_q); TAILQ_INIT(&bf_cq); - sc->sc_stats.ast_tx_aggrfail++; /* * Update rate control - all frames have failed. @@ -2955,12 +2954,14 @@ ath_tx_comp_aggr_error(struct ath_softc ATH_TXQ_LOCK(sc->sc_ac2q[tid->ac]); tap = ath_tx_get_tx_tid(an, tid->tid); + sc->sc_stats.ast_tx_aggr_failall++; /* Retry all subframes */ bf = bf_first; while (bf) { bf_next = bf->bf_next; bf->bf_next = NULL; /* Remove it from the aggr list */ + sc->sc_stats.ast_tx_aggr_fail++; if (ath_tx_retry_subframe(sc, bf, &bf_q)) { drops++; bf->bf_next = NULL; @@ -3196,6 +3197,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * ATH_BA_ISSET(ba, ba_index)); if (tx_ok && ATH_BA_ISSET(ba, ba_index)) { + sc->sc_stats.ast_tx_aggr_ok++; ath_tx_update_baw(sc, an, atid, bf); bf->bf_state.bfs_dobaw = 0; if (! bf->bf_state.bfs_addedbaw) @@ -3205,6 +3207,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * bf->bf_next = NULL; TAILQ_INSERT_TAIL(&bf_cq, bf, bf_list); } else { + sc->sc_stats.ast_tx_aggr_fail++; if (ath_tx_retry_subframe(sc, bf, &bf_q)) { drops++; bf->bf_next = NULL; Modified: head/sys/dev/ath/if_athioctl.h == --- head/sys/dev/ath/if_athioctl.h Wed Nov 23 03:55:48 2011 (r227867) +++ head/sys/dev/ath/if_athioctl.h Wed Nov 23 05:00:25 2011 (r227868) @@ -148,12 +148,14 @@ struct ath_stats { u_int32_t ast_tx_swretrymax; /* software TX retry max limit reach */ u_int32_t ast_tx_data_underrun; u_int32_t ast_tx_delim_underrun; - u_int32_t ast_tx_aggrfail;/* aggregate TX failed in its entirety */ + u_int32_t ast_tx_aggr_failall;/* aggregate TX failed in its entirety */ u_int32_t ast_tx_getnobuf; u_int32_t ast_tx_getbusybuf; u_int32_t ast_tx_intr; u_int32_t ast_rx_intr; - u_int32_t ast_pad[4]; + u_int32_t ast_tx_aggr_ok; /* aggregate TX ok */ + u_int32_t ast_tx_aggr_fail; /* aggregate TX failed */ + u_int32_t ast_pad[2]; }; #defineSIOCGATHSTATS _IOWR('i', 137, struct ifreq) ___ svn-src-head@freebsd.org mailing list http://li
svn commit: r227869 - head/tools/tools/ath/athstats
Author: adrian Date: Wed Nov 23 05:01:23 2011 New Revision: 227869 URL: http://svn.freebsd.org/changeset/base/227869 Log: Add the new statistics introduced in r227868. Sponsored by: Hobnob, Inc. Modified: head/tools/tools/ath/athstats/athstats.c Modified: head/tools/tools/ath/athstats/athstats.c == --- head/tools/tools/ath/athstats/athstats.cWed Nov 23 05:00:25 2011 (r227868) +++ head/tools/tools/ath/athstats/athstats.cWed Nov 23 05:01:23 2011 (r227869) @@ -284,10 +284,14 @@ static const struct fmt athstats[] = { { 5,"txdataunderrun", "TXDAU","A-MPDU TX FIFO data underrun" }, #defineS_TX_DELIM_UNDERRUN AFTER(S_TX_DATA_UNDERRUN) { 5,"txdelimunderrun", "TXDEU","A-MPDU TX Delimiter underrun" }, -#defineS_TX_AGGR_FAIL AFTER(S_TX_DELIM_UNDERRUN) - { 10, "txaggrfail", "txaggrfail", "A-MPDU TX attempt failed" }, +#defineS_TX_AGGR_OKAFTER(S_TX_DELIM_UNDERRUN) + { 5,"txaggrok", "TXAOK","A-MPDU sub-frame TX attempt success" }, +#defineS_TX_AGGR_FAIL AFTER(S_TX_AGGR_OK) + { 4,"txaggrfail", "TXAF", "A-MPDU sub-frame TX attempt success" }, +#defineS_TX_AGGR_FAILALL AFTER(S_TX_AGGR_FAIL) + { 7,"txaggrfailall","TXAFALL", "A-MPDU sub-frame TX attempt success" }, #ifndef __linux__ -#defineS_CABQ_XMIT AFTER(S_TX_AGGR_FAIL) +#defineS_CABQ_XMIT AFTER(S_TX_AGGR_FAILALL) { 5,"cabxmit", "cabxmit", "cabq frames transmitted" }, #defineS_CABQ_BUSY AFTER(S_CABQ_XMIT) { 5,"cabqbusy", "cabqbusy", "cabq xmit overflowed beacon interval" }, @@ -299,7 +303,7 @@ static const struct fmt athstats[] = { { 5,"rxbusdma", "rxbusdma", "rx setup failed for dma resrcs" }, #defineS_FF_TXOK AFTER(S_RX_BUSDMA) #else -#defineS_FF_TXOK AFTER(S_TX_AGGR_FAIL) +#defineS_FF_TXOK AFTER(S_TX_AGGR_FAILALL) #endif { 5,"fftxok", "fftxok", "fast frames xmit successfully" }, #defineS_FF_TXERR AFTER(S_FF_TXOK) @@ -775,7 +779,9 @@ ath_get_curstat(struct statfoo *sf, int case S_TX_SWRETRIES_MAX:STAT(tx_swretrymax); case S_TX_DATA_UNDERRUN:STAT(tx_data_underrun); case S_TX_DELIM_UNDERRUN: STAT(tx_delim_underrun); - case S_TX_AGGR_FAIL:STAT(tx_aggrfail); + case S_TX_AGGR_OK: STAT(tx_aggr_ok); + case S_TX_AGGR_FAIL:STAT(tx_aggr_fail); + case S_TX_AGGR_FAILALL: STAT(tx_aggr_failall); } b[0] = '\0'; return 0; @@ -1014,9 +1020,10 @@ ath_get_totstat(struct statfoo *sf, int case S_TX_SWRETRIES_MAX:STAT(tx_swretrymax); case S_TX_DATA_UNDERRUN:STAT(tx_data_underrun); case S_TX_DELIM_UNDERRUN: STAT(tx_delim_underrun); - case S_TX_AGGR_FAIL:STAT(tx_aggrfail); + case S_TX_AGGR_OK: STAT(tx_aggr_ok); + case S_TX_AGGR_FAIL:STAT(tx_aggr_fail); + case S_TX_AGGR_FAILALL: STAT(tx_aggr_failall); } - b[0] = '\0'; return 0; #undef RXANT ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227870 - head/tools/tools/ath/athstats
Author: adrian Date: Wed Nov 23 05:03:27 2011 New Revision: 227870 URL: http://svn.freebsd.org/changeset/base/227870 Log: Tidy up the statistic documentation. Sponsored by: Hobnob, Inc. Modified: head/tools/tools/ath/athstats/athstats.c Modified: head/tools/tools/ath/athstats/athstats.c == --- head/tools/tools/ath/athstats/athstats.cWed Nov 23 05:01:23 2011 (r227869) +++ head/tools/tools/ath/athstats/athstats.cWed Nov 23 05:03:27 2011 (r227870) @@ -287,9 +287,9 @@ static const struct fmt athstats[] = { #defineS_TX_AGGR_OKAFTER(S_TX_DELIM_UNDERRUN) { 5,"txaggrok", "TXAOK","A-MPDU sub-frame TX attempt success" }, #defineS_TX_AGGR_FAIL AFTER(S_TX_AGGR_OK) - { 4,"txaggrfail", "TXAF", "A-MPDU sub-frame TX attempt success" }, + { 4,"txaggrfail", "TXAF", "A-MPDU sub-frame TX attempt failures" }, #defineS_TX_AGGR_FAILALL AFTER(S_TX_AGGR_FAIL) - { 7,"txaggrfailall","TXAFALL", "A-MPDU sub-frame TX attempt success" }, + { 7,"txaggrfailall","TXAFALL", "A-MPDU TX frame failures" }, #ifndef __linux__ #defineS_CABQ_XMIT AFTER(S_TX_AGGR_FAILALL) { 5,"cabxmit", "cabxmit", "cabq frames transmitted" }, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227871 - head/sys/dev/vte
Author: kevlo Date: Wed Nov 23 05:34:01 2011 New Revision: 227871 URL: http://svn.freebsd.org/changeset/base/227871 Log: Remove unused variable mii. This variable is initialized but not used. Reviewed by: yongari Modified: head/sys/dev/vte/if_vte.c Modified: head/sys/dev/vte/if_vte.c == --- head/sys/dev/vte/if_vte.c Wed Nov 23 05:03:27 2011(r227870) +++ head/sys/dev/vte/if_vte.c Wed Nov 23 05:34:01 2011(r227871) @@ -1621,14 +1621,12 @@ static void vte_init_locked(struct vte_softc *sc) { struct ifnet *ifp; - struct mii_data *mii; bus_addr_t paddr; uint8_t *eaddr; VTE_LOCK_ASSERT(sc); ifp = sc->vte_ifp; - mii = device_get_softc(sc->vte_miibus); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227778 - head/sys/net
On 23/11/2011, at 1:00 AM, Lawrence Stewart wrote: > On 11/23/11 00:30, John Baldwin wrote: >> On Monday, November 21, 2011 2:28:10 am Lawrence Stewart wrote: >>> On 11/21/11 17:18, Julien Ridoux wrote: On 21/11/2011, at 4:39 PM, Lawrence Stewart wrote: > On 11/21/11 16:12, Ben Kaduk wrote: >> On Sun, Nov 20, 2011 at 11:17 PM, Lawrence >> Stewartwrote: >>> Author: lstewart Date: Mon Nov 21 04:17:24 2011 New Revision: >>> 227778 URL: http://svn.freebsd.org/changeset/base/227778 >>> >>> Log: - When feed-forward clock support is compiled in, change >>> the BPF header to contain both a regular timestamp obtained >>> from the system clock and the current feed-forward ffcounter >>> value. This enables new possibilities including >> >> Is it really necessary to make the ABI dependent on a kernel >> configuration option? This causes all sorts of headaches if >> loadable modules ever want to use that ABI, something that we >> just ran into with vm_page_t and friends and had a long thread on >> -current about. > > Fair question. Julien, if pcap and other consumers will happily > ignore the new ffcount_stamp member in the bpf header, is there any > reason to conditionally add the ffcounter into the header struct? It is a valid question indeed. The feedback I have received so far was to not have the feed-forward clock support be a default kernel configuration option. What follows is based on this assumption. The commit (r227747) introduces sysctl that are conditioned by the same "FFCLOCK" kernel configuration option. If a loadable module tests for the presence of this sysctl, it will know if the ffcount_stamp member is available. Is it too much of a hack? Alternatively, if the ffcounter is added to the bpf header unconditionally, the ffcount_stamp member can be set to 0. Loadable modules will then see a consistent ABI but will retrieve a meaningless value. I am not sure which option makes more sense, any preference? >>> >>> If I understand the issues correctly, I think the appropriate path >>> forward is to remove the conditional change to the bpf header and have >>> ffcount_stamp become a permanent member of the struct. We'll just leave >>> the member uninitialised in the !FFCLOCK case. This change will make the >>> patch un-MFCable, but I think that's ok. >>> >>> As to the issue of how a kernel module would detect if it's being loaded >>> into a FFCLOCK enabled kernel, why wouldn't we expect modules to >>> "#include opt_ffclock.h" and conditionally compile code based on FFCLOCK >>> being defined? Is there a use case for run-time (as opposed to >>> compile-time) module detection of feed-forward clock capabilities? >> >> Think of standalone modules that are not built as part of a kernel (e.g. >> 3rd party device drivers). In general we should avoid having structures >> change size for kernel options, especially common structures. It just adds >> lots of pain and suffering and complexity. We are stuck with it for PAE on >> i386 (which causes pain), and for LOCK_PROFILING (but that is sufficiently >> rare and expensive it seems to be ok). I think 8 bytes for bpf packet is >> not sufficiently expensive to justify the extra headache. Just always leave >> the new field in. > > hmm... Julien almost has a patch finished which accomplishes what my most > recent email in this thread describes. Julien, I suggest we get it finished > and follow up to this thread with a pointer to the patch for people to look > at. If there's still a strong feeling that what it does is going to bring > pain we can do away with the new BPF_FFCOUNTER config option and have the bpf > header struct just grow by 8 bytes. > > Stay tuned... Thanks all for the feedback. With some delay, I have a patch against r227871 that implements what Lawrence proposed. You can find it here: http://www.cubinlab.ee.unimelb.edu.au/~jrid/patches/ffclock-bpf-header-r227871.patch I have tested this under a few typical scenario, it works as expected but already brings some headaches (hence the long delay mentioned above :-)). I thought a bit more of user cases. I believe many of them call for having both feed-forward counter and its conversion in second be present in the BPF header. For example, this allows to have absolute packet departure/arrival times (as per usual), but also provides the opportunity to compute inter-arrival times accurately using the difference clock. There are other examples I can think of, and if one believe the feed-forward clock approach becomes more popular, such usages will be more and more common. Assuming the BPF header grows by 8 bytes independent of any kernel option, I admit that the current implementation is a bit ugly. The BPF structure is not nicely packed and looks clunky. Ideally, the feed-forward counter should be placed
svn commit: r227872 - head/sys/dev/ath
Author: adrian Date: Wed Nov 23 07:12:26 2011 New Revision: 227872 URL: http://svn.freebsd.org/changeset/base/227872 Log: Re-lock the ath lock after ath_reset() has been called. The calibrate callout is done with the sc lock held. This only showed up when using an older NIC (AR5212) whose radio/phy requires the rfgain adjustment. Pointy-hat-to:adrian Sponsored by: Hobnob, Inc. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Wed Nov 23 05:34:01 2011(r227871) +++ head/sys/dev/ath/if_ath.c Wed Nov 23 07:12:26 2011(r227872) @@ -5370,6 +5370,7 @@ ath_calibrate(void *arg) sc->sc_doresetcal = AH_TRUE; ATH_UNLOCK(sc); ath_reset(ifp, ATH_RESET_NOLOSS); + ATH_LOCK(sc); return; } /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227798 - in head: . lib/libpam lib/libpam/modules
On Tue, Nov 22, 2011 at 10:38:02PM +0100, Dag-Erling Sm??rgrav wrote: > Dag-Erling Sm??rgrav writes: > > Jilles Tjoelker writes: > > > Although this will work, I think it trades the quality of the binaries > > > for a cleaner build system. It is better to pass all libraries to ld(1) > > > even though a .so may have unresolved references: the NEEDED entry > > > serves as an additional protection against version mismatches and symbol > > > versioning (if you ever add it) requires ld(1) to have access to the .so > > > containing the definition so it knows the version name to store in the > > > output file. > > These are plugins. The names and prototypes of the functions they > > export were set in stone 15 years ago. > > Sorry, that was a bit unclear. What I was trying to say is that symbol > versioning is not and will never be an issue. Does plugin depend on the library which loaded it ? In other words, does it reference the symbols from the library ? If yes, then plugin _must_ have a dependency on the library recorded as DT_NEEDED. pgp8iim6LenZD.pgp Description: PGP signature
svn commit: r227873 - head/usr.bin/procstat
Author: trociny Date: Wed Nov 23 07:34:09 2011 New Revision: 227873 URL: http://svn.freebsd.org/changeset/base/227873 Log: Fix build, hopefully. Reviewed by: kib Modified: head/usr.bin/procstat/procstat_auxv.c Modified: head/usr.bin/procstat/procstat_auxv.c == --- head/usr.bin/procstat/procstat_auxv.c Wed Nov 23 07:12:26 2011 (r227872) +++ head/usr.bin/procstat/procstat_auxv.c Wed Nov 23 07:34:09 2011 (r227873) @@ -42,14 +42,13 @@ #include "procstat.h" -static char auxv[sizeof(Elf_Auxinfo) * 256]; +static Elf_Auxinfo auxv[256]; void procstat_auxv(struct kinfo_proc *kipp) { - Elf_Auxinfo *aux; - int i, error, name[4]; - size_t len; + int error, name[4]; + size_t len, i; if (!hflag) printf("%5s %-16s %-53s\n", "PID", "COMM", "AUXV"); @@ -58,7 +57,7 @@ procstat_auxv(struct kinfo_proc *kipp) name[1] = KERN_PROC; name[2] = KERN_PROC_AUXV; name[3] = kipp->ki_pid; - len = sizeof(auxv); + len = sizeof(auxv) * sizeof(*auxv); error = sysctl(name, 4, auxv, &len, NULL, 0); if (error < 0 && errno != ESRCH) { warn("sysctl: kern.proc.auxv: %d: %d", kipp->ki_pid, errno); @@ -72,106 +71,116 @@ procstat_auxv(struct kinfo_proc *kipp) printf(" -\n"); return; } - for (aux = (Elf_Auxinfo *)auxv, i = 0; i < 256; i++, aux++) { - switch(aux->a_type) { + for (i = 0; i < len; i++) { + switch(auxv[i].a_type) { case AT_NULL: - printf(" (%d)\n", i + 1); + printf(" (%zu)\n", i + 1); return; case AT_IGNORE: printf(" AT_IGNORE=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; case AT_EXECFD: printf(" AT_EXECFD=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; case AT_PHDR: printf(" AT_PHDR=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; case AT_PHENT: printf(" AT_PHENT=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; case AT_PHNUM: printf(" AT_PHNUM=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; case AT_PAGESZ: printf(" AT_PAGESZ=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; case AT_BASE: printf(" AT_BASE=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; case AT_FLAGS: printf(" AT_FLAGS=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; case AT_ENTRY: printf(" AT_ENTRY=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; +#ifdef AT_NOTELF case AT_NOTELF: printf(" AT_NOTELF=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; +#endif +#ifdef AT_UID case AT_UID: printf(" AT_UID=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; +#endif +#ifdef AT_EUID case AT_EUID: printf(" AT_EUID=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; +#endif +#ifdef AT_GID case AT_GID: printf(" AT_GID=0x%lu", - (unsigned long)aux->a_un.a_val); + (unsigned long)auxv[i].a_un.a_val); break; +#endif +#ifdef AT_EGID
Re: svn commit: r227778 - head/sys/net
On 11/23/11 17:42, Julien Ridoux wrote: On 23/11/2011, at 1:00 AM, Lawrence Stewart wrote: On 11/23/11 00:30, John Baldwin wrote: On Monday, November 21, 2011 2:28:10 am Lawrence Stewart wrote: On 11/21/11 17:18, Julien Ridoux wrote: On 21/11/2011, at 4:39 PM, Lawrence Stewart wrote: On 11/21/11 16:12, Ben Kaduk wrote: On Sun, Nov 20, 2011 at 11:17 PM, Lawrence Stewart wrote: Author: lstewart Date: Mon Nov 21 04:17:24 2011 New Revision: 227778 URL: http://svn.freebsd.org/changeset/base/227778 Log: - When feed-forward clock support is compiled in, change the BPF header to contain both a regular timestamp obtained from the system clock and the current feed-forward ffcounter value. This enables new possibilities including Is it really necessary to make the ABI dependent on a kernel configuration option? This causes all sorts of headaches if loadable modules ever want to use that ABI, something that we just ran into with vm_page_t and friends and had a long thread on -current about. Fair question. Julien, if pcap and other consumers will happily ignore the new ffcount_stamp member in the bpf header, is there any reason to conditionally add the ffcounter into the header struct? It is a valid question indeed. The feedback I have received so far was to not have the feed-forward clock support be a default kernel configuration option. What follows is based on this assumption. The commit (r227747) introduces sysctl that are conditioned by the same "FFCLOCK" kernel configuration option. If a loadable module tests for the presence of this sysctl, it will know if the ffcount_stamp member is available. Is it too much of a hack? Alternatively, if the ffcounter is added to the bpf header unconditionally, the ffcount_stamp member can be set to 0. Loadable modules will then see a consistent ABI but will retrieve a meaningless value. I am not sure which option makes more sense, any preference? If I understand the issues correctly, I think the appropriate path forward is to remove the conditional change to the bpf header and have ffcount_stamp become a permanent member of the struct. We'll just leave the member uninitialised in the !FFCLOCK case. This change will make the patch un-MFCable, but I think that's ok. As to the issue of how a kernel module would detect if it's being loaded into a FFCLOCK enabled kernel, why wouldn't we expect modules to "#include opt_ffclock.h" and conditionally compile code based on FFCLOCK being defined? Is there a use case for run-time (as opposed to compile-time) module detection of feed-forward clock capabilities? Think of standalone modules that are not built as part of a kernel (e.g. 3rd party device drivers). In general we should avoid having structures change size for kernel options, especially common structures. It just adds lots of pain and suffering and complexity. We are stuck with it for PAE on i386 (which causes pain), and for LOCK_PROFILING (but that is sufficiently rare and expensive it seems to be ok). I think 8 bytes for bpf packet is not sufficiently expensive to justify the extra headache. Just always leave the new field in. hmm... Julien almost has a patch finished which accomplishes what my most recent email in this thread describes. Julien, I suggest we get it finished and follow up to this thread with a pointer to the patch for people to look at. If there's still a strong feeling that what it does is going to bring pain we can do away with the new BPF_FFCOUNTER config option and have the bpf header struct just grow by 8 bytes. Stay tuned... Thanks all for the feedback. With some delay, I have a patch against r227871 that implements what Lawrence proposed. You can find it here: http://www.cubinlab.ee.unimelb.edu.au/~jrid/patches/ffclock-bpf-header-r227871.patch There are a few nits, but the patch implements what I envisaged, thanks Julien. I have tested this under a few typical scenario, it works as expected but already brings some headaches (hence the long delay mentioned above :-)). I thought a bit more of user cases. I believe many of them call for having both feed-forward counter and its conversion in second be present in the BPF header. For example, this allows to have absolute packet departure/arrival times (as per usual), but also provides the opportunity to compute inter-arrival times accurately using the difference clock. There are other examples I can think of, and if one believe the feed-forward clock approach becomes more popular, such usages will be more and more common. Assuming the BPF header grows by 8 bytes independent of any kernel option, I admit that the current implementation is a bit ugly. The BPF structure is not nicely packed and looks clunky. Ideally, the feed-forward counter should be placed just below the bh_tstamp member, but this would require libpcap and all ports depending on it to be recompiled after this change. Even though it looks a bit gross, we would still add it at the end to avoid g
Re: svn commit: r227808 - head/lib/libc/string
On Tue, 22 Nov 2011, Eitan Adler wrote: Log: - add check for pointer equality prior to performing the O(n) pass This seems like a negative optimization. The pointers are unequal in the usual case. More seriously, it gives worse undefined behaviour when the pointers are invalid. E.g., strcmp(NULL, NULL) now returns 0 where it used to trap for the null pointer access. This has many style bugs. - while here change 's' to 's1' in strcoll Submitted by: eadler@ Reviewed by: theraven@ Approved by: brooks@ MFC after: 2 weeks Modified: head/lib/libc/string/strcasecmp.c == --- head/lib/libc/string/strcasecmp.c Mon Nov 21 23:32:14 2011 (r227807) +++ head/lib/libc/string/strcasecmp.c Tue Nov 22 00:07:53 2011 (r227808) @@ -48,6 +48,9 @@ strcasecmp_l(const char *s1, const char const u_char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2; + if (s1 == s2) + return (0); + This adds non-KNF indentation (3 spaces instead of 1 tab) and an extra blank line. Previous locale changes have already mangled this file, with additions of extra blank lines and worse. FIX_LOCALE(locale); while (tolower_l(*us1, locale) == tolower_l(*us2++, locale)) @@ -65,18 +68,21 @@ int strncasecmp_l(const char *s1, const char *s2, size_t n, locale_t locale) { FIX_LOCALE(locale); - if (n != 0) { - const u_char - *us1 = (const u_char *)s1, - *us2 = (const u_char *)s2; - - do { - if (tolower_l(*us1, locale) != tolower_l(*us2++, locale)) - return (tolower_l(*us1, locale) - tolower_l(*--us2, locale)); - if (*us1++ == '\0') - break; - } while (--n != 0); - } + + const u_char + *us1 = (const u_char *)s1, + *us2 = (const u_char *)s2; + This adds a dependency on C99 by placing the declarations after a statement. Moving the declarations out of an inner block is otherwise good. + if (( s1 == s2) | (n == 0)) This adds an extra space, a weird operator (arithmetic OR instead of logical OR), and extra parentheses. The extra parentheses are more needed with the weird operator (arithmetic OR has a weird precedence that happens to make the parentheses unnecessary here, but compilers should warn about the relative precedences being surprising and force you to add the parentheses). + return (0); This adds the usual non-KNF indentation. + + This adds 2 extra blank lines instead of only 1. + do { + if (tolower_l(*us1, locale) != tolower_l(*us2++, locale)) + return (tolower_l(*us1, locale) - tolower_l(*--us2, locale)); + if (*us1++ == '\0') + break; + } while (--n != 0); return (0); } Modified: head/lib/libc/string/strcmp.c == --- head/lib/libc/string/strcmp.c Mon Nov 21 23:32:14 2011 (r227807) +++ head/lib/libc/string/strcmp.c Tue Nov 22 00:07:53 2011 (r227808) @@ -44,6 +44,9 @@ __FBSDID("$FreeBSD$"); int strcmp(const char *s1, const char *s2) { + if (s1 == s2) + return (0); + This adds non-KNF indentation and an extra blank line, and removes the strange KNF blank line before the (null) declarations. while (*s1 == *s2++) if (*s1++ == '\0') return (0); Modified: head/lib/libc/string/strcoll.c OK. Modified: head/lib/libc/string/strncmp.c == --- head/lib/libc/string/strncmp.c Mon Nov 21 23:32:14 2011 (r227807) +++ head/lib/libc/string/strncmp.c Tue Nov 22 00:07:53 2011 (r227808) @@ -39,8 +39,9 @@ int strncmp(const char *s1, const char *s2, size_t n) { - if (n == 0) + if ((n == 0) | (s1 == s2)) return (0); + As above, but without removing the blank line before the null declarations, without the extra space before s1, with only 1 extra blank line, and with the equality tests reversed relative to the above. do { if (*s1 != *s2++) return (*(const unsigned char *)s1 - Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On Mon, 21 Nov 2011 m...@freebsd.org wrote: On Mon, Nov 21, 2011 at 6:50 PM, Eitan Adler wrote: Author: eadler (ports committer) Date: Tue Nov 22 02:50:24 2011 New Revision: 227812 URL: http://svn.freebsd.org/changeset/base/227812 Log: ?- fix some style(9) nits with my last commit ?- add a comment explaining why I used '|' instead of '||' ?Submitted by: danfe@ ?Approved by: ?emaste@ Modified: ?head/lib/libc/string/strcasecmp.c ?head/lib/libc/string/strncmp.c Hard 0xa0's make the quotes almost unreadable :-(. Modified: head/lib/libc/string/strcasecmp.c == --- head/lib/libc/string/strcasecmp.c ? Tue Nov 22 02:27:59 2011 ? ? ? ?(r227811) +++ head/lib/libc/string/strcasecmp.c ? Tue Nov 22 02:50:24 2011 ? ? ? ?(r227812) @@ -49,7 +49,7 @@ strcasecmp_l(const char *s1, const char ? ? ? ? ? ? ? ? ? ? ? ?*us1 = (const u_char *)s1, ? ? ? ? ? ? ? ? ? ? ? ?*us2 = (const u_char *)s2; ? ? ? ?if (s1 == s2) - ? ? ? ? ? return (0); + ? ? ? ? ? ? ? return (0); ? ? ? ?FIX_LOCALE(locale); @@ -73,8 +73,9 @@ strncasecmp_l(const char *s1, const char ? ? ? ? ? ? ? ? ? ? ? ?*us1 = (const u_char *)s1, ? ? ? ? ? ? ? ? ? ? ? ?*us2 = (const u_char *)s2; - ? ? ? if (( s1 == s2) | (n == 0)) - ? ? ? ? ? return (0); + ? ? ? /* use a bitwise or to avoid an additional branch instruction */ + ? ? ? if ((s1 == s2) | (n == 0)) + ? ? ? ? ? ? ? return (0); I guess I'm a little confused. Do we really have profiling information at this level that suggests the overhead of the branch is significant? I thought most hardware had pretty good branch-prediction, particularly with speculative execution. Every time I have profiled the string functions, changes like this always have an insignificant effect, even in benchmarks. Normal code spends perhaps 0.01% of its time calling string functions, so the improvements from optimizing string functions are 0.01% of an insignificant amount. If this optimization were any good, then the compiler would already do it. In fact, gcc-4.2.1 already does it -- the reverse of it -- it rewrites: "if ((i == 0) | (j == 0)) return; test();" into: "if (i == 0 || j == 0) return; test();" with most optimization flags that I tried. This happens even at -O with -march=i386, although since a plain i386 doesn't have branch target prediction and has slow branches, the first version is probably actually faster for a plain i386. But gcc-3.3.3 doesn't do this rewrite, even with -O3 -march=athlon-xp, For i386, the generated code is quite slow: gcc-3.3.3 -O -march=i386: % cmpl$0, i % sete%dl % cmpl$0, j % sete%al % orl %edx, %eax % testb $1, %al % jne .L3 % ... # call to test() not shown here or below % .L3: % leave % ret `sete' is quite slow on plain i386 too. For athlon-xp: gcc-3.3.3 -O3 -march=athlon-xp: % movlj, %edx % movli, %eax % testl %eax, %eax % sete%cl % testl %edx, %edx % sete%al % orl %ecx, %eax % testb $1, %al % je .L4 % .L3: % leave % ret This is essentially the same, except it uses load-test instead of cmp-mem, and the branch is taken in the opposite case. Weirdly, gcc42 does almost exactly the opposite with i386 and athlon-xp: gcc-4.2.1 -O -march=i386: % cmpl$0, i % je .L5 % cmpl$0, j % je .L5 % ... % .L5: % leave % ret gcc-4.2.1 -O3 -march=athlon-xp: % movli, %edx % movlj, %eax % movl%esp, %ebp % testl %edx, %edx % sete%dl % testl %eax, %eax % sete%al % orb %al, %dl % je .L7 % leave % ret I guess this is because it knows that 'sete' is slow on i386. But for nocona, it goes back to rewriting the expression to use || so that there are 2 branches: gcc-4.2.1 -O3 -march=nocona: % movli, %edx % testl %edx, %edx % je .L5 % movlj, %eax % testl %eax, %eax % jne .L7 % .L5: % popl%ebp % ret This is the same as for plain i386 and plain -O, except it use load-test instead of cmp-mem the same as gcc-3.3.3 does for athlon-xp. It doesn't take the branch in the opposite case like gcc-3.3.3 does for athlon-xp. Wouldn't something like __predict_false() have more value for performance, Unlikely. Both writing | vs ||, and writing __predict_foo(), are only hints to the compiler, since the compiler knows how to rewrite the former but probably shouldn't unless it is sure, and it can ignore __predict_foo() but probably shouldn't unless it is sure. Or perhaps it trusts the programmer's directives for branches as much as ones for `register'. Similarly for `if (foo) ...; else ...;' vs `if (!foo) etc' - the programmer may have chosen the order carefully, but who knows? gcc-3-3.3 an
svn commit: r227814 - head/sys/dev/ppbus
Author: attilio Date: Tue Nov 22 11:35:24 2011 New Revision: 227814 URL: http://svn.freebsd.org/changeset/base/227814 Log: - Use ppb_assert_locked() rather than using explicit mtx_assert call - Make ppbus code agnostic in regard of INVARIANTS option MFC after:2 weeks Modified: head/sys/dev/ppbus/lpt.c head/sys/dev/ppbus/ppb_base.c head/sys/dev/ppbus/ppb_msq.c head/sys/dev/ppbus/vpo.c Modified: head/sys/dev/ppbus/lpt.c == --- head/sys/dev/ppbus/lpt.cTue Nov 22 06:56:45 2011(r227813) +++ head/sys/dev/ppbus/lpt.cTue Nov 22 11:35:24 2011(r227814) @@ -447,10 +447,9 @@ lptout(void *arg) { struct lpt_data *sc = arg; device_t dev = sc->sc_dev; -#if defined(INVARIANTS) || defined(LPT_DEBUG) - device_t ppbus = device_get_parent(dev); -#endif + device_t ppbus; + ppbus = device_get_parent(dev); ppb_assert_locked(ppbus); lprintf(("T %x ", ppb_rstr(ppbus))); if (sc->sc_state & OPEN) { Modified: head/sys/dev/ppbus/ppb_base.c == --- head/sys/dev/ppbus/ppb_base.c Tue Nov 22 06:56:45 2011 (r227813) +++ head/sys/dev/ppbus/ppb_base.c Tue Nov 22 11:35:24 2011 (r227814) @@ -60,7 +60,7 @@ ppb_poll_bus(device_t bus, int max, int i, j, error; char r; - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); /* try at least up to 10ms */ for (j = 0; j < ((how & PPB_POLL) ? max : 1); j++) { @@ -96,12 +96,9 @@ ppb_poll_bus(device_t bus, int max, int ppb_get_epp_protocol(device_t bus) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif uintptr_t protocol; - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); BUS_READ_IVAR(device_get_parent(bus), bus, PPC_IVAR_EPP_PROTO, &protocol); return (protocol); @@ -117,7 +114,7 @@ ppb_get_mode(device_t bus) struct ppb_data *ppb = DEVTOSOFTC(bus); /* XXX yet device mode = ppbus mode = chipset mode */ - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); return (ppb->mode); } @@ -132,7 +129,7 @@ ppb_set_mode(device_t bus, int mode) struct ppb_data *ppb = DEVTOSOFTC(bus); int old_mode = ppb_get_mode(bus); - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); if (PPBUS_SETMODE(device_get_parent(bus), mode)) return (-1); @@ -150,11 +147,8 @@ ppb_set_mode(device_t bus, int mode) int ppb_write(device_t bus, char *buf, int len, int how) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); return (PPBUS_WRITE(device_get_parent(bus), buf, len, how)); } @@ -166,11 +160,8 @@ ppb_write(device_t bus, char *buf, int l int ppb_reset_epp_timeout(device_t bus) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); return(PPBUS_RESET_EPP(device_get_parent(bus))); } @@ -182,11 +173,8 @@ ppb_reset_epp_timeout(device_t bus) int ppb_ecp_sync(device_t bus) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); return (PPBUS_ECP_SYNC(device_get_parent(bus))); } @@ -198,12 +186,9 @@ ppb_ecp_sync(device_t bus) int ppb_get_status(device_t bus, struct ppb_status *status) { -#ifdef INVARIANTS - struct ppb_data *ppb = DEVTOSOFTC(bus); -#endif register char r; - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); r = status->status = ppb_rstr(bus); Modified: head/sys/dev/ppbus/ppb_msq.c == --- head/sys/dev/ppbus/ppb_msq.cTue Nov 22 06:56:45 2011 (r227813) +++ head/sys/dev/ppbus/ppb_msq.cTue Nov 22 11:35:24 2011 (r227814) @@ -117,13 +117,10 @@ mode2xfer(device_t bus, struct ppb_devic int ppb_MS_init(device_t bus, device_t dev, struct ppb_microseq *loop, int opcode) { -#ifdef INVARIANTS - struct ppb_data *ppb = device_get_softc(bus); -#endif struct ppb_device *ppbdev = (struct ppb_device *)device_get_ivars(dev); struct ppb_xfer *xfer = mode2xfer(bus, ppbdev, opcode); - mtx_assert(ppb->ppc_lock, MA_OWNED); + ppb_assert_locked(bus); xfer->loop = loop; return (0); Modified: head/sys/dev/ppbus/vpo.c == --- head/sys/dev/ppbus/vpo.cTue Nov 22 06:56:45 2011(r227813) +++ head/sys/dev/ppbus/vpo.cTue Nov 22 11:35:24 2011(r227814) @@ -298,11 +298,8 @@
Re: svn commit: r227701 - in head/sys: arm/xscale/ixp425 dev/ahci dev/ata dev/gpio dev/mvs dev/ppbus dev/ppc dev/siba dev/siis dev/usb kern sys
On Monday, November 21, 2011 1:39:33 pm Marius Strobl wrote: > On Mon, Nov 21, 2011 at 11:16:47AM -0500, John Baldwin wrote: > > On Saturday, November 19, 2011 5:11:51 am Hans Petter Selasky wrote: > > > Author: hselasky > > > Date: Sat Nov 19 10:11:50 2011 > > > New Revision: 227701 > > > URL: http://svn.freebsd.org/changeset/base/227701 > > > > > > Log: > > > Move the device_delete_all_children() function from usb_util.c > > > to kern/subr_bus.c. Simplify this function so that it no longer > > > depends on malloc() to execute. Identify a few other places where > > > it makes sense to use device_delete_all_children(). > > > > > > MFC after: 1 week > > > > Sorry I didn't review this earlier when you sent it to me. In general I > > think this is a good idea, and reducing the duplicated code is great. > > Could we rename it to just device_delete_children(9)? Using both "all" and > the plural seems redundant and doesn't match device_get_children(9) which > also operates on all children. That sounds like a good idea. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227816 - head/sys/conf
Author: kib Date: Tue Nov 22 13:27:53 2011 New Revision: 227816 URL: http://svn.freebsd.org/changeset/base/227816 Log: Remove the wrong comment about ufs not being loadable. Note that only root filesystem module needs to be available before root is mounted. MFC after:1 week Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Tue Nov 22 12:12:01 2011(r227815) +++ head/sys/conf/NOTES Tue Nov 22 13:27:53 2011(r227816) @@ -965,11 +965,10 @@ options ZERO_COPY_SOCKETS # FILESYSTEM OPTIONS # -# Only the root, /usr, and /tmp filesystems need be statically -# compiled; everything else will be automatically loaded at mount -# time. (Exception: the UFS family--- FFS --- cannot -# currently be demand-loaded.) Some people still prefer to statically -# compile other filesystems as well. +# Only the root filesystem needs to be statically compiled or preloaded +# as module; everything else will be automatically loaded at mount +# time. Some people still prefer to statically compile other +# filesystems as well. # # NB: The PORTAL filesystem is known to be buggy, and WILL panic your # system if you attempt to do anything with it. It is included here ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227778 - head/sys/net
On Monday, November 21, 2011 2:28:10 am Lawrence Stewart wrote: > On 11/21/11 17:18, Julien Ridoux wrote: > > > > On 21/11/2011, at 4:39 PM, Lawrence Stewart wrote: > > > >> On 11/21/11 16:12, Ben Kaduk wrote: > >>> On Sun, Nov 20, 2011 at 11:17 PM, Lawrence > >>> Stewart wrote: > Author: lstewart Date: Mon Nov 21 04:17:24 2011 New Revision: > 227778 URL: http://svn.freebsd.org/changeset/base/227778 > > Log: - When feed-forward clock support is compiled in, change > the BPF header to contain both a regular timestamp obtained > from the system clock and the current feed-forward ffcounter > value. This enables new possibilities including > >>> > >>> Is it really necessary to make the ABI dependent on a kernel > >>> configuration option? This causes all sorts of headaches if > >>> loadable modules ever want to use that ABI, something that we > >>> just ran into with vm_page_t and friends and had a long thread on > >>> -current about. > >> > >> Fair question. Julien, if pcap and other consumers will happily > >> ignore the new ffcount_stamp member in the bpf header, is there any > >> reason to conditionally add the ffcounter into the header struct? > > > > It is a valid question indeed. The feedback I have received so far > > was to not have the feed-forward clock support be a default kernel > > configuration option. What follows is based on this assumption. > > > > The commit (r227747) introduces sysctl that are conditioned by the > > same "FFCLOCK" kernel configuration option. If a loadable module > > tests for the presence of this sysctl, it will know if the > > ffcount_stamp member is available. Is it too much of a hack? > > > > Alternatively, if the ffcounter is added to the bpf header > > unconditionally, the ffcount_stamp member can be set to 0. Loadable > > modules will then see a consistent ABI but will retrieve a > > meaningless value. > > > > I am not sure which option makes more sense, any preference? > > If I understand the issues correctly, I think the appropriate path > forward is to remove the conditional change to the bpf header and have > ffcount_stamp become a permanent member of the struct. We'll just leave > the member uninitialised in the !FFCLOCK case. This change will make the > patch un-MFCable, but I think that's ok. > > As to the issue of how a kernel module would detect if it's being loaded > into a FFCLOCK enabled kernel, why wouldn't we expect modules to > "#include opt_ffclock.h" and conditionally compile code based on FFCLOCK > being defined? Is there a use case for run-time (as opposed to > compile-time) module detection of feed-forward clock capabilities? Think of standalone modules that are not built as part of a kernel (e.g. 3rd party device drivers). In general we should avoid having structures change size for kernel options, especially common structures. It just adds lots of pain and suffering and complexity. We are stuck with it for PAE on i386 (which causes pain), and for LOCK_PROFILING (but that is sufficiently rare and expensive it seems to be ok). I think 8 bytes for bpf packet is not sufficiently expensive to justify the extra headache. Just always leave the new field in. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227817 - head/sys/fs/msdosfs
Author: kib Date: Tue Nov 22 13:30:36 2011 New Revision: 227817 URL: http://svn.freebsd.org/changeset/base/227817 Log: Put all the messages from msdosfs under the MSDOSFS_DEBUG ifdef. They are confusing to user, and not informative for general consumption. MFC after:1 week Modified: head/sys/fs/msdosfs/msdosfs_conv.c head/sys/fs/msdosfs/msdosfs_denode.c head/sys/fs/msdosfs/msdosfs_fat.c head/sys/fs/msdosfs/msdosfs_lookup.c head/sys/fs/msdosfs/msdosfs_vfsops.c Modified: head/sys/fs/msdosfs/msdosfs_conv.c == --- head/sys/fs/msdosfs/msdosfs_conv.c Tue Nov 22 13:27:53 2011 (r227816) +++ head/sys/fs/msdosfs/msdosfs_conv.c Tue Nov 22 13:30:36 2011 (r227817) @@ -1036,8 +1036,10 @@ mbnambuf_write(struct mbnambuf *nbp, cha size_t count, newlen; if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) { +#ifdef MSDOSFS_DEBUG printf("msdosfs: non-decreasing id: id %d, last id %d\n", id, nbp->nb_last_id); +#endif return; } @@ -1046,7 +1048,9 @@ mbnambuf_write(struct mbnambuf *nbp, cha count = strlen(name); newlen = nbp->nb_len + count; if (newlen > WIN_MAXLEN || newlen > MAXNAMLEN) { +#ifdef MSDOSFS_DEBUG printf("msdosfs: file name length %zu too large\n", newlen); +#endif return; } Modified: head/sys/fs/msdosfs/msdosfs_denode.c == --- head/sys/fs/msdosfs/msdosfs_denode.cTue Nov 22 13:27:53 2011 (r227816) +++ head/sys/fs/msdosfs/msdosfs_denode.cTue Nov 22 13:30:36 2011 (r227817) @@ -263,8 +263,10 @@ deget(pmp, dirclust, diroffset, depp) * instead of what is written in directory entry. */ if (diroffset == 0 && ldep->de_StartCluster != dirclust) { +#ifdef MSDOSFS_DEBUG printf("deget(): \".\" entry at clust %lu != %lu\n", dirclust, ldep->de_StartCluster); +#endif ldep->de_StartCluster = dirclust; } @@ -274,8 +276,11 @@ deget(pmp, dirclust, diroffset, depp) if (error == E2BIG) { ldep->de_FileSize = de_cn2off(pmp, size); error = 0; - } else + } else { +#ifdef MSDOSFS_DEBUG printf("deget(): pcbmap returned %d\n", error); +#endif + } } } else nvp->v_type = VREG; @@ -351,8 +356,10 @@ detrunc(dep, length, flags, cred, td) * directory's life. */ if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp)) { +#ifdef MSDOSFS_DEBUG printf("detrunc(): can't truncate root directory, clust %ld, offset %ld\n", dep->de_dirclust, dep->de_diroffset); +#endif return (EINVAL); } Modified: head/sys/fs/msdosfs/msdosfs_fat.c == --- head/sys/fs/msdosfs/msdosfs_fat.c Tue Nov 22 13:27:53 2011 (r227816) +++ head/sys/fs/msdosfs/msdosfs_fat.c Tue Nov 22 13:30:36 2011 (r227817) @@ -503,7 +503,9 @@ fatentry(function, pmp, cn, oldcontents, * Be sure they asked us to do something. */ if ((function & (FAT_SET | FAT_GET)) == 0) { +#ifdef MSDOSFS_DEBUG printf("fatentry(): function code doesn't specify get or set\n"); +#endif return (EINVAL); } @@ -512,7 +514,9 @@ fatentry(function, pmp, cn, oldcontents, * where to put it, give them an error. */ if ((function & FAT_GET) && oldcontents == NULL) { +#ifdef MSDOSFS_DEBUG printf("fatentry(): get function with no place to put result\n"); +#endif return (EINVAL); } #endif @@ -997,7 +1001,9 @@ extendfile(dep, count, bpp, ncp, flags) */ if (dep->de_StartCluster == MSDOSFSROOT && (dep->de_Attributes & ATTR_DIRECTORY)) { +#ifdef MSDOSFS_DEBUG printf("extendfile(): attempt to extend root directory\n"); +#endif return (ENOSPC); } Modified: head/sys/fs/msdosfs/msdosfs_lookup.c == --- head/sys/fs/msdosfs/msdosfs_lookup.cTue Nov 22 13:27:53 2011 (r227816) +++ head/sys/fs/msdosfs/msdosfs_lookup.cTue Nov 22 13:30:36 2011 (r227817) @@ -902,8 +902,10 @@ doscheckpath(source, target) out:; if (bp) brelse(bp); +#ifdef MSDOSFS_DEBUG if (error == ENOTDIR) printf("doscheckpath(): .. not a directory?\n"); +#endif if (dep != NULL) vput(DETOV(dep));
Re: svn commit: r227778 - head/sys/net
On 11/23/11 00:30, John Baldwin wrote: On Monday, November 21, 2011 2:28:10 am Lawrence Stewart wrote: On 11/21/11 17:18, Julien Ridoux wrote: On 21/11/2011, at 4:39 PM, Lawrence Stewart wrote: On 11/21/11 16:12, Ben Kaduk wrote: On Sun, Nov 20, 2011 at 11:17 PM, Lawrence Stewartwrote: Author: lstewart Date: Mon Nov 21 04:17:24 2011 New Revision: 227778 URL: http://svn.freebsd.org/changeset/base/227778 Log: - When feed-forward clock support is compiled in, change the BPF header to contain both a regular timestamp obtained from the system clock and the current feed-forward ffcounter value. This enables new possibilities including Is it really necessary to make the ABI dependent on a kernel configuration option? This causes all sorts of headaches if loadable modules ever want to use that ABI, something that we just ran into with vm_page_t and friends and had a long thread on -current about. Fair question. Julien, if pcap and other consumers will happily ignore the new ffcount_stamp member in the bpf header, is there any reason to conditionally add the ffcounter into the header struct? It is a valid question indeed. The feedback I have received so far was to not have the feed-forward clock support be a default kernel configuration option. What follows is based on this assumption. The commit (r227747) introduces sysctl that are conditioned by the same "FFCLOCK" kernel configuration option. If a loadable module tests for the presence of this sysctl, it will know if the ffcount_stamp member is available. Is it too much of a hack? Alternatively, if the ffcounter is added to the bpf header unconditionally, the ffcount_stamp member can be set to 0. Loadable modules will then see a consistent ABI but will retrieve a meaningless value. I am not sure which option makes more sense, any preference? If I understand the issues correctly, I think the appropriate path forward is to remove the conditional change to the bpf header and have ffcount_stamp become a permanent member of the struct. We'll just leave the member uninitialised in the !FFCLOCK case. This change will make the patch un-MFCable, but I think that's ok. As to the issue of how a kernel module would detect if it's being loaded into a FFCLOCK enabled kernel, why wouldn't we expect modules to "#include opt_ffclock.h" and conditionally compile code based on FFCLOCK being defined? Is there a use case for run-time (as opposed to compile-time) module detection of feed-forward clock capabilities? Think of standalone modules that are not built as part of a kernel (e.g. 3rd party device drivers). In general we should avoid having structures change size for kernel options, especially common structures. It just adds lots of pain and suffering and complexity. We are stuck with it for PAE on i386 (which causes pain), and for LOCK_PROFILING (but that is sufficiently rare and expensive it seems to be ok). I think 8 bytes for bpf packet is not sufficiently expensive to justify the extra headache. Just always leave the new field in. hmm... Julien almost has a patch finished which accomplishes what my most recent email in this thread describes. Julien, I suggest we get it finished and follow up to this thread with a pointer to the patch for people to look at. If there's still a strong feeling that what it does is going to bring pain we can do away with the new BPF_FFCOUNTER config option and have the bpf header struct just grow by 8 bytes. Stay tuned... Cheers, Lawrence ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227818 - head/lib/libc/locale
Author: theraven Date: Tue Nov 22 14:11:42 2011 New Revision: 227818 URL: http://svn.freebsd.org/changeset/base/227818 Log: Fix a crash when trying to duplicate a locale that contains some implicit C locale components. Reported by: Michael Butler Approved by: dim (mentor) Modified: head/lib/libc/locale/xlocale.c Modified: head/lib/libc/locale/xlocale.c == --- head/lib/libc/locale/xlocale.c Tue Nov 22 13:30:36 2011 (r227817) +++ head/lib/libc/locale/xlocale.c Tue Nov 22 14:11:42 2011 (r227818) @@ -200,8 +200,13 @@ static int dupcomponent(int type, locale if (new->components[type]) { strncpy(new->components[type]->locale, src->locale, ENCODING_LEN); } - } else { + } else if (base->components[type]) { new->components[type] = xlocale_retain(base->components[type]); + } else { + /* If the component was NULL, return success - if base is a valid +* locale then the flag indicating that this isn't present should be +* set. If it isn't a valid locale, then we're stuck anyway. */ + return 1; } return (0 != new->components[type]); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On 22 Nov 2011, at 11:21, Bruce Evans wrote: > If this optimization were any good, then the compiler would already do > it. In fact, gcc-4.2.1 already does it -- the reverse of it -- it rewrites: > > "if ((i == 0) | (j == 0)) return; test();" > > into: > > "if (i == 0 || j == 0) return; test();" In general, I prefer | in cases where execution order does not matter because it frees the compiler up to insert branches or not, depending on which is more efficient for the target. In this case, either | or || is fine, because neither reads any memory or has side effects so | and || are equivalent to the compiler, but the use of | tells a human reading the code that the order is unimportant. David___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On Tue, Nov 22, 2011, Eitan Adler wrote: > + /* use a bitwise or to avoid an additional branch instruction */ > + if ((s1 == s2) | (n == 0)) > + return (0); I think there are three issues with this. First, the comment suggesting that using '|' instead of '||' isn't correct; any reasonable compiler knows how to optimize side-effect-free expressions like these. (The reverse transformation, from the arithmetic expression to the boolean one, is actually harder for the compiler in general.) Second, the overwhelming precedent in FreeBSD is to use boolean operators to combine boolean expressions, so you might try to get some consensus on the issue before you go around replacing them with bitwise operators. I for one don't find the bitwise operators clearer, but I don't speak for everyone else. Third, it's not clear that checking whether s1 == s2 is even an optimization. Most programs simply aren't going to pass identical pointers as arguments to strcmp(), so for the overwhelming majority of cases, this is just a wasted test and a wasted slot in a branch predict table. (FWIW, I doubt that a realistic benchmark would demonstrate any measurable difference.) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227791 - head/sys/netinet
Qing, first I'd like to notice that we are speaking about obsoleted interfaces. This should be taken into account during all the discussion. We shouldn't make code more complex in favor to make obsoleted interfaces more smart. 1) Scrubbing in in_ifinit() is done only in case of SIOCSIFADDR. The latter isn't ever used in our userland code. And I suppose isn't used by any software in ports. Because you can't set a CIDR prefix with SIOCSIFADDR, which makes it useless in 2011. Actually I'd be glad to cut that SIOCSIFADDR/SIOCSIFNETMASK at all. 2) The code that restores the oldaddr is activated only in two cases: 2.1) SIOCSIFADDR 2.2) SIOCAIFADDR with an address in the in_aliasreq that already exists on the interface. If it doesn't exist, address is _added_, not changed! I'll skip on SIOCSIFADDR, said enough on it. To trigger 2.2 we need something like this: # ifconfig igb1 10.0.0.1/24 # ifconfig igb1 10.0.0.1/24 alias I don't see any idea in smart error recovering for this strange case and even can't imagine error. Back to your comments: On Mon, Nov 21, 2011 at 01:36:13PM -0800, Qing Li wrote: Q> > From my point of view logically speaking, we should first remove route, Q> > then remove address. Otherwise, for a short time we've got an invalid Q> > route in table. Q> Q> For a short time you have an invalid address, it is faster to remove the Q> address from the list to prevent usage, then to flush the route, which would Q> also trigger L2 table flushes as well. I have made a test case that proves, that usage of deleted address isn't prevented when it is removed, but loopback route still exists. The test is the following run a race between this program: struct ifreq ifr; int s; bzero(&ifr, sizeof(struct ifreq)); strncpy(ifr.ifr_name, "igb1", sizeof ifr.ifr_name); ifr.ifr_addr.sa_family = AF_INET; ifr.ifr_addr.sa_len = sizeof(struct sockaddr_in); ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr = inet_addr("10.0.0.1"); s = socket(AF_INET, SOCK_DGRAM, 0); for (;;) ioctl(s, SIOCSIFADDR, &ifr); And this script: while (true); do nc -z 10.0.0.1 22 || echo Fail; done The script would never fail, that proves that traffic flows even when address is temporarily wiped. With new code script may fail. One note: your system will panic w/o fix that I've mailed you before, but this is a separate issue that should be discussed separately. Q> > Q> Putting "in_scrubprefix()" at the top does not gain you anything at Q> > Q> all, but can Q> > Q> potentially be problematic if additional tasks are in fact performed Q> > Q> in "if_ioctl()" Q> > Q> that may in fact affect the logic in "in_ifinit()". Q> > Q> Q> > Q> Case in point, I had to perform additional routing related tasks so I Q> > Q> re-introduced "nd6_rtrequest()" in r227460. Q> > Q> > Pardon, can you please elaborate on this? I don't see any problems that Q> > I intoroduced, but if ther are any, we can either push in_scrubprefix() Q> > down the function as it was before, of fix them some other way. Q> > Q> Q> The point being, perhaps the address related tasks to be performed in Q> "if_ioctl()" today is limited, however, we may need to perform additional Q> housekeeping tasks in "if_ioctl()", and if there is error, we would want to Q> revert the process. Q> Q> There are so many different L2 and pseudo interface functions that map Q> to "if_ioctl()", it is Not safe to ignore its error and not reflect that error Q> back to the consistency of the routing table and the interface address Q> list. Yep, most of modern if_ioctl's do not fail at all. But my code checks for error, so that isn't a problem. Q> Again, removing the associated route at the beginning of in_ifinit() does Q> not gain much in terms of performance or code cleanness, nor does it Q> improve the logic, so why limit what we could do in the future in "if_ioctl()" Q> by making such a change ?? Q> Q> > Q> > Q> You are not simplifying much logic by removing the error recovery code from Q> > Q> the return of "if_ioctl()". So why removing the flexibility of what Q> > Q> "if_ioctl()" is Q> > Q> intended for as part of the address configuration logic ? Q> > Q> > Because in_ifinit() was inconsistent. It tried to recover in case Q> > of (*ifp->if_ioctl) failure, but did not try to recover in case Q> > of failure of: Q> > Q> > in_addprefix() Q> > ifa_add_loopback_route() Q> > Q> Q> The "inconsistency" is due to the fact failures from these two functions Q> are not fatal, and does not necessarily affect the actual operations. Q> Q> In function "in_addprefix()", there are 2 main possible errors. EEXIST is Q> non fatal, it just means the same prefix route is already covered by Q> another address, and what is being inserted is just an alias. Q> Q> The other error is due to RTM_ADD failure, however, since IFA_ROUTE is Q> not set on the address when failure occurs, no route
Re: svn commit: r227812 - head/lib/libc/string
on 22/11/2011 16:20 David Chisnall said the following: > the use of | tells a human reading the code that the order is unimportant I think that it tells that we are dealing with bit flags, not with logical operations. Which would be a lie^W^W an incorrect hint in this case (both to humans and compilers). -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On Tue, Nov 22, 2011, David Schultz wrote: > First, the comment suggesting that using '|' instead of '||' isn't > correct; any reasonable compiler knows how to optimize > side-effect-free expressions like these. (The reverse > transformation, from the arithmetic expression to the boolean one, > is actually harder for the compiler in general.) That should read "the comment suggesting that using '|' instead of '||' <> isn't correct". ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227822 - head/sys/fs/tmpfs
Author: ivoras Date: Tue Nov 22 16:18:12 2011 New Revision: 227822 URL: http://svn.freebsd.org/changeset/base/227822 Log: Avoid panics from recursive rename operations. Not a perfect patch but good enough for now. PR: kern/159418 Submitted by: Gleb Kurtsou Reviewed by: kib MFC after:1 month Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c == --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Nov 22 16:08:12 2011 (r227821) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Nov 22 16:18:12 2011 (r227822) @@ -965,11 +965,8 @@ tmpfs_rename(struct vop_rename_args *v) /* If we need to move the directory between entries, lock the * source so that we can safely operate on it. */ - if (tdvp != fdvp) { - error = vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if (error != 0) - goto out; - } + if (fdvp != tdvp && fdvp != tvp) + vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); fdnode = VP_TO_TMPFS_DIR(fdvp); fnode = VP_TO_TMPFS_NODE(fvp); de = tmpfs_dir_lookup(fdnode, fnode, fcnp); @@ -1143,7 +1140,7 @@ tmpfs_rename(struct vop_rename_args *v) error = 0; out_locked: - if (fdnode != tdnode) + if (fdvp != tdvp && fdvp != tvp) VOP_UNLOCK(fdvp, 0); out: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227823 - in head: share/man/man4 sys/dev/acpi_support
Author: jh Date: Tue Nov 22 16:44:50 2011 New Revision: 227823 URL: http://svn.freebsd.org/changeset/base/227823 Log: Append unit number to the WMI status device name to allow attaching multiple acpi_wmi(4) instances. PR: kern/162491 Reviewed by: avg Modified: head/share/man/man4/acpi_wmi.4 head/sys/dev/acpi_support/acpi_wmi.c Modified: head/share/man/man4/acpi_wmi.4 == --- head/share/man/man4/acpi_wmi.4 Tue Nov 22 16:18:12 2011 (r227822) +++ head/share/man/man4/acpi_wmi.4 Tue Nov 22 16:44:50 2011 (r227823) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2010 +.Dd November 22, 2011 .Dt ACPI_WMI 4 .Os .Sh NAME @@ -49,16 +49,16 @@ The .Nm driver provides an interface for vendor specific WMI implementations (e.g. HP and Acer laptops). -It creates /dev/wmistat, which can be read to get +It creates /dev/wmistat%d, which can be read to get information about GUIDs found in the system. .Sh FILES -.Bl -tag -width /dev/wmistat -compact -.It Pa /dev/wmistat +.Bl -tag -width /dev/wmistat%d -compact +.It Pa /dev/wmistat%d WMI status device. .El .Sh EXAMPLES .Bd -literal -# cat /dev/wmistat +# cat /dev/wmistat0 GUID INST EXPE METH STR EVENT OID {5FB7F034-2C63-45E9-BE91-3D44E2C707E4} 1 NO WMAA NO NOAA {95F24279-4D7B-4334-9387-ACCDC67EF61C} 1 NO NO NO 0x80+ - Modified: head/sys/dev/acpi_support/acpi_wmi.c == --- head/sys/dev/acpi_support/acpi_wmi.cTue Nov 22 16:18:12 2011 (r227822) +++ head/sys/dev/acpi_support/acpi_wmi.cTue Nov 22 16:44:50 2011 (r227823) @@ -265,7 +265,7 @@ acpi_wmi_attach(device_t dev) acpi_wmi_ec_handler); } else { sc->wmistat_dev_t = make_dev(&wmistat_cdevsw, 0, UID_ROOT, - GID_WHEEL, 0644, "wmistat"); + GID_WHEEL, 0644, "wmistat%d", device_get_unit(dev)); sc->wmistat_dev_t->si_drv1 = sc; sc->wmistat_open_pid = 0; sc->wmistat_bufptr = -1; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227778 - head/sys/net
On Tue, 22 Nov 2011, John Baldwin wrote: Think of standalone modules that are not built as part of a kernel (e.g. 3rd party device drivers). In general we should avoid having structures change size for kernel options, especially common structures. It just adds lots of pain and suffering and complexity. We are stuck with it for PAE on i386 (which causes pain), and for LOCK_PROFILING (but that is sufficiently rare and expensive it seems to be ok). I think 8 bytes for bpf packet is not sufficiently expensive to justify the extra headache. Just always leave the new field in. This is exactly what I was thinking of -- thanks for making more concrete. Sorry for the radio silence yesterday; too many meetings. -Ben ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
Meta comment: I should have sent this patch to -hackers prior to seeking approval to commit. I learned my lesson and will seek wider review before making such changes in the future. On Tue, Nov 22, 2011 at 6:21 AM, Bruce Evans wrote: I saw your email about the style changes. I'd like to flesh out what changes should be made first before making another commit>> I guess I'm a little confused. Do we really have profiling>> information at this level that suggests the overhead of the branch is>> significant? I thought most hardware had pretty good>> branch-prediction, particularly with speculative execution. I made this change at the direction of theraven@. I assume he knows a little bit more about compilers than I do. ;)It seems from the rest of this thread that even if this were an optimization it still shouldn't be done at source code code level. > Every time I have profiled the string functions, changes like this always> > have an insignificant effect, even in benchmarks. Normal code spends> > perhaps 0.01% of its time calling string functions, so the improvements> from > optimizing string functions are 0.01% of an insignificant amount. The problem with profiling this type of change is that it is hard to find a good representative benchmark. I could easily write code that will show you that adding the equality check is a good idea or that it is a horrible idea. IMHO it saves enough time when they are equal, but loses almost no time when the strings are not equal. >> Wouldn't something like __predict_false() have more value for>> performance, It seems that at most this couldn't hurt. On Tue, Nov 22, 2011 at 10:33 AM, David Schultz wrote: > Third, it's not clear that checking whether s1 == s2 is even an > optimization. Most programs simply aren't going to pass identical > pointers as arguments to strcmp(), so for the overwhelming > majority of cases, this is just a wasted test and a wasted slot in > a branch predict table. (FWIW, I doubt that a realistic benchmark > would demonstrate any measurable difference.) It is fairly common for programs to compare a value passed to a function to a array of strings. Also note that for the strn*cmp functions we already have a branch so this isn't always a wasted slot. Here is what I'd like to do next: - fix bde@'s style nits - change the | to a || and remove the comment - but leave the equality check as is. - find a src committer to approve the patch - go back to working on ports for a while ;) Is this the right course of action? Or should I just revert both commits entirely? -- Eitan Adler Ports committer X11, Bugbusting teams ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227827 - head/sys/sys
Author: rmh Date: Tue Nov 22 18:53:54 2011 New Revision: 227827 URL: http://svn.freebsd.org/changeset/base/227827 Log: Define __FreeBSD_kernel__ macro in sys/param.h. __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, which by definition is always true on FreeBSD. This macro is also defined on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD. It is tempting to use this macro in userland code when we want to enable kernel-specific routines, and in fact it's fine to do this in code that is part of FreeBSD itself. However, be aware that as presence of this macro is still not widespread (e.g. older FreeBSD versions, 3rd party compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in external applications without also checking for __FreeBSD__ as an alternative. Approved by: kib (mentor) MFC after:2 weeks Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hTue Nov 22 17:33:08 2011(r227826) +++ head/sys/sys/param.hTue Nov 22 18:53:54 2011(r227827) @@ -60,6 +60,22 @@ #undef __FreeBSD_version #define __FreeBSD_version 101 /* Master, propagated to newvers */ +/* + * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, + * which by definition is always true on FreeBSD. This macro is also defined + * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD. + * + * It is tempting to use this macro in userland code when we want to enable + * kernel-specific routines, and in fact it's fine to do this in code that + * is part of FreeBSD itself. However, be aware that as presence of this + * macro is still not widespread (e.g. older FreeBSD versions, 3rd party + * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in + * external applications without also checking for __FreeBSD__ as an + * alternative. + */ +#undef __FreeBSD_kernel__ +#define __FreeBSD_kernel__ + #ifdef _KERNEL #defineP_OSREL_SIGWAIT 70 #defineP_OSREL_SIGSEGV 74 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227828 - head/sys/dev/vge
Author: yongari Date: Tue Nov 22 18:58:39 2011 New Revision: 227828 URL: http://svn.freebsd.org/changeset/base/227828 Log: Always start MII auto polling before accessing any MII registers. Modified: head/sys/dev/vge/if_vge.c Modified: head/sys/dev/vge/if_vge.c == --- head/sys/dev/vge/if_vge.c Tue Nov 22 18:53:54 2011(r227827) +++ head/sys/dev/vge/if_vge.c Tue Nov 22 18:58:39 2011(r227828) @@ -1099,6 +1099,7 @@ vge_attach(device_t dev) goto fail; } + vge_miipoll_start(sc); /* Do MII setup */ error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, @@ -2028,6 +2029,7 @@ vge_init_locked(struct vge_softc *sc) */ vge_stop(sc); vge_reset(sc); + vge_miipoll_start(sc); /* * Initialize the RX and TX descriptors and mbufs. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On Tuesday, November 22, 2011 10:33:32 am David Schultz wrote: > On Tue, Nov 22, 2011, Eitan Adler wrote: > > + /* use a bitwise or to avoid an additional branch instruction */ > > + if ((s1 == s2) | (n == 0)) > > + return (0); > > I think there are three issues with this. > > First, the comment suggesting that using '|' instead of '||' isn't > correct; any reasonable compiler knows how to optimize > side-effect-free expressions like these. (The reverse > transformation, from the arithmetic expression to the boolean one, > is actually harder for the compiler in general.) > > Second, the overwhelming precedent in FreeBSD is to use boolean > operators to combine boolean expressions, so you might try to get > some consensus on the issue before you go around replacing them > with bitwise operators. I for one don't find the bitwise > operators clearer, but I don't speak for everyone else. I concur, it should just use boolean logic since it is doing a boolean test. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227829 - in head: share/man/man9 sys/sys
Author: marius Date: Tue Nov 22 19:31:43 2011 New Revision: 227829 URL: http://svn.freebsd.org/changeset/base/227829 Log: - Add a DEVMETHOD_END alias for KOBJMETHOD_END so that along with 'driver_t' and DEVMETHOD() we can fully hide the explicit mention of kobj(9) from device drivers. - Update the example in driver.9 to use DEVMETHOD_END. Submitted by: jhb MFC after:3 days Modified: head/share/man/man9/driver.9 head/sys/sys/bus.h Modified: head/share/man/man9/driver.9 == --- head/share/man/man9/driver.9Tue Nov 22 18:58:39 2011 (r227828) +++ head/share/man/man9/driver.9Tue Nov 22 19:31:43 2011 (r227829) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2010 +.Dd November 22, 2011 .Dt DRIVER 9 .Os .Sh NAME @@ -58,7 +58,7 @@ static device_method_t foo_methods[] = { DEVMETHOD(bogo_twiddle, foo_twiddle), /* Terminate method list */ - { 0, 0 } + DEVMETHOD_END }; static driver_t foo_driver = { Modified: head/sys/sys/bus.h == --- head/sys/sys/bus.h Tue Nov 22 18:58:39 2011(r227828) +++ head/sys/sys/bus.h Tue Nov 22 19:31:43 2011(r227829) @@ -571,9 +571,10 @@ extern int bus_current_pass; void bus_set_pass(int pass); /** - * Shorthand for constructing method tables. + * Shorthands for constructing method tables. */ #defineDEVMETHOD KOBJMETHOD +#defineDEVMETHOD_END KOBJMETHOD_END /* * Some common device interfaces. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227830 - head/sys/netinet
Author: glebius Date: Tue Nov 22 19:37:57 2011 New Revision: 227830 URL: http://svn.freebsd.org/changeset/base/227830 Log: Fix SIOCDIFADDR semantics: if no address is specified, then delete first one. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Tue Nov 22 19:31:43 2011(r227829) +++ head/sys/netinet/in.c Tue Nov 22 19:37:57 2011(r227830) @@ -375,7 +375,7 @@ in_control(struct socket *so, u_long cmd switch (cmd) { case SIOCAIFADDR: case SIOCDIFADDR: - { + if (ifra->ifra_addr.sin_len == AF_INET) { struct in_ifaddr *oia; IN_IFADDR_RLOCK(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227831 - head/sys/netinet
Author: glebius Date: Tue Nov 22 19:39:27 2011 New Revision: 227831 URL: http://svn.freebsd.org/changeset/base/227831 Log: style(9) nit Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Tue Nov 22 19:37:57 2011(r227830) +++ head/sys/netinet/in.c Tue Nov 22 19:39:27 2011(r227831) @@ -249,7 +249,8 @@ in_control(struct socket *so, u_long cmd ifra->ifra_addr.sin_family != AF_INET) return (EINVAL); if (ifra->ifra_broadaddr.sin_len != 0 && - (ifra->ifra_broadaddr.sin_len != sizeof(struct sockaddr_in) || + (ifra->ifra_broadaddr.sin_len != + sizeof(struct sockaddr_in) || ifra->ifra_broadaddr.sin_family != AF_INET)) return (EINVAL); #if 0 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227832 - head/sys/net
Author: glebius Date: Tue Nov 22 19:42:17 2011 New Revision: 227832 URL: http://svn.freebsd.org/changeset/base/227832 Log: Improve logging: - don't hardcode function name - use LOG_DEBUG for such a debug message - print error value Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Tue Nov 22 19:39:27 2011(r227831) +++ head/sys/net/if.c Tue Nov 22 19:42:17 2011(r227832) @@ -1475,7 +1475,7 @@ ifa_add_loopback_route(struct ifaddr *if RT_REMREF(rt); RT_UNLOCK(rt); } else if (error != 0) - log(LOG_INFO, "ifa_add_loopback_route: insertion failed\n"); + log(LOG_DEBUG, "%s: insertion failed: %u\n", __func__, error); return (error); } @@ -1499,7 +1499,7 @@ ifa_del_loopback_route(struct ifaddr *if error = rtrequest1_fib(RTM_DELETE, &info, NULL, 0); if (error != 0) - log(LOG_INFO, "ifa_del_loopback_route: deletion failed\n"); + log(LOG_DEBUG, "%s: deletion failed: %u\n", __func__, error); return (error); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227797 - head/share/mk
With this change, I can no longer update a FreeBSD 9.0-current system from June 2010 to FreeBSD 10.0. I suspect I'm not the only one. On 2011/11/21, at 16:35, Dag-Erling Smorgrav wrote: > Author: des > Date: Mon Nov 21 16:35:57 2011 > New Revision: 227797 > URL: http://svn.freebsd.org/changeset/base/227797 > > Log: > As threatened on -arch, add {SHARED,STATIC}_{C,CXX}FLAGS, which allow a > Makefile to specify different CFLAGS for shared and static libraries. > > MFC after: 3 weeks > > Modified: > head/share/mk/bsd.lib.mk > > Modified: head/share/mk/bsd.lib.mk > == > --- head/share/mk/bsd.lib.mk Mon Nov 21 16:06:23 2011(r227796) > +++ head/share/mk/bsd.lib.mk Mon Nov 21 16:35:57 2011(r227797) > @@ -67,23 +67,29 @@ PICFLAG=-fpic > > PO_FLAG=-pg > > +.c.o: > + ${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} > + > .c.po: > - ${CC} ${PO_FLAG} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} > + ${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o > ${.TARGET} > @[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \ > (${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \ > ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}) > > .c.So: > - ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} > + ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o > ${.TARGET} > @[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \ > (${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \ > ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}) > > +.cc.o: > + ${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} > + > .cc.po .C.po .cpp.po .cxx.po: > - ${CXX} ${PO_FLAG} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} > + ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o > ${.TARGET} > > .cc.So .C.So .cpp.So .cxx.So: > - ${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} > + ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o > ${.TARGET} > > .f.po: > ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} > ___ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org" Regards, -- Rui Paulo ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On Tue, Nov 22, 2011, Eitan Adler wrote: > The problem with profiling this type of change is that it is hard to > find a good representative benchmark. I could easily write code that > will show you that adding the equality check is a good idea or that it > is a horrible idea. IMHO it saves enough time when they are equal, but > loses almost no time when the strings are not equal. Benchmark or not, I think you'll have a very hard time finding a single real program that routinely calls strcasecmp() with identical pointers! > Here is what I'd like to do next: > > - fix bde@'s style nits > - change the | to a || and remove the comment > - but leave the equality check as is. > - find a src committer to approve the patch > - go back to working on ports for a while ;) > > Is this the right course of action? Or should I just revert both > commits entirely? Fixing the style nits would be good, and it sounds like several people are in favor of using boolean operators to combine boolean expressions. I don't think the extra tests you added make much difference either way, but I wouldn't want to see even more special cases sprinkled throughout the source tree without some validation that shows they are helpful. You shouldn't let this discourage you from working on src in the future. Not everyone is going to agree with everything you want to change. One observation: The level of nit-picking tends to be inversely proportional to the size of the change you're making. In other words, if you put a lot of effort into a really significant improvement, then it's *your* code and people are less likely to bother you about the details. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227833 - in head/sys: kern sys
Author: trociny Date: Tue Nov 22 20:40:18 2011 New Revision: 227833 URL: http://svn.freebsd.org/changeset/base/227833 Log: Add new sysctls, KERN_PROC_ENV and KERN_PROC_AUXV, to return environment strings and ELF auxiliary vectors from a process stack. Make sysctl_kern_proc_args to read not cached arguments from the process stack. Export proc_getargv() and proc_getenvv() so they can be reused by procfs and linprocfs. Suggested by: kib Reviewed by: kib Discussed with: kib, rwatson, jilles Tested by:pho MFC after:2 weeks Modified: head/sys/kern/kern_proc.c head/sys/sys/proc.h head/sys/sys/sysctl.h Modified: head/sys/kern/kern_proc.c == --- head/sys/kern/kern_proc.c Tue Nov 22 19:42:17 2011(r227832) +++ head/sys/kern/kern_proc.c Tue Nov 22 20:40:18 2011(r227833) @@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -50,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1358,6 +1361,289 @@ pargs_drop(struct pargs *pa) pargs_free(pa); } +static int +proc_read_mem(struct thread *td, struct proc *p, vm_offset_t offset, void* buf, +size_t len) +{ + struct iovec iov; + struct uio uio; + + iov.iov_base = (caddr_t)buf; + iov.iov_len = len; + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + uio.uio_offset = offset; + uio.uio_resid = (ssize_t)len; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_rw = UIO_READ; + uio.uio_td = td; + + return (proc_rwmem(p, &uio)); +} + +static int +proc_read_string(struct thread *td, struct proc *p, const char *sptr, char *buf, +size_t len) +{ + size_t i; + int error; + + error = proc_read_mem(td, p, (vm_offset_t)sptr, buf, len); + /* +* Reading the chunk may validly return EFAULT if the string is shorter +* than the chunk and is aligned at the end of the page, assuming the +* next page is not mapped. So if EFAULT is returned do a fallback to +* one byte read loop. +*/ + if (error == EFAULT) { + for (i = 0; i < len; i++, buf++, sptr++) { + error = proc_read_mem(td, p, (vm_offset_t)sptr, buf, 1); + if (error != 0) + return (error); + if (*buf == '\0') + break; + } + error = 0; + } + return (error); +} + +#define PROC_AUXV_MAX 256 /* Safety limit on auxv size. */ + +enum proc_vector_type { + PROC_ARG, + PROC_ENV, + PROC_AUX, +}; + +#ifdef COMPAT_FREEBSD32 +static int +get_proc_vector32(struct thread *td, struct proc *p, char ***proc_vectorp, +size_t *vsizep, enum proc_vector_type type) +{ + struct freebsd32_ps_strings pss; + Elf32_Auxinfo aux; + vm_offset_t vptr, ptr; + uint32_t *proc_vector32; + char **proc_vector; + size_t vsize, size; + int i, error; + + error = proc_read_mem(td, p, (vm_offset_t)(p->p_sysent->sv_psstrings), + &pss, sizeof(pss)); + if (error != 0) + return (error); + switch (type) { + case PROC_ARG: + vptr = (vm_offset_t)PTRIN(pss.ps_argvstr); + vsize = pss.ps_nargvstr; + if (vsize > ARG_MAX) + return (ENOEXEC); + size = vsize * sizeof(int32_t); + break; + case PROC_ENV: + vptr = (vm_offset_t)PTRIN(pss.ps_envstr); + vsize = pss.ps_nenvstr; + if (vsize > ARG_MAX) + return (ENOEXEC); + size = vsize * sizeof(int32_t); + break; + case PROC_AUX: + vptr = (vm_offset_t)PTRIN(pss.ps_envstr) + + (pss.ps_nenvstr + 1) * sizeof(int32_t); + if (vptr % 4 != 0) + return (ENOEXEC); + for (ptr = vptr, i = 0; i < PROC_AUXV_MAX; i++) { + error = proc_read_mem(td, p, ptr, &aux, sizeof(aux)); + if (error != 0) + return (error); + if (aux.a_type == AT_NULL) + break; + ptr += sizeof(aux); + } + if (aux.a_type != AT_NULL) + return (ENOEXEC); + vsize = i + 1; + size = vsize * sizeof(aux); + break; + default: + KASSERT(0, ("Wrong proc vector type: %d", type)); + } + proc_vector32 = malloc(size, M_TEMP, M_WAITOK); + error = proc_read_mem(td, p, vptr, proc_vector32, size); + if (error != 0) + goto done; +
Re: svn commit: r227798 - in head: . lib/libpam lib/libpam/modules
On Mon, Nov 21, 2011 at 04:40:39PM +, Dag-Erling Smorgrav wrote: > Author: des > Date: Mon Nov 21 16:40:39 2011 > New Revision: 227798 > URL: http://svn.freebsd.org/changeset/base/227798 > Log: > Simplify the libpam build by removing the shared modules' dependency > on the shared library. The modules are loaded by the library, so we > know it'll be there when we need it. Although this will work, I think it trades the quality of the binaries for a cleaner build system. It is better to pass all libraries to ld(1) even though a .so may have unresolved references: the NEEDED entry serves as an additional protection against version mismatches and symbol versioning (if you ever add it) requires ld(1) to have access to the .so containing the definition so it knows the version name to store in the output file. -- Jilles Tjoelker ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227834 - head/sys/fs/procfs
Author: trociny Date: Tue Nov 22 20:43:03 2011 New Revision: 227834 URL: http://svn.freebsd.org/changeset/base/227834 Log: In procfs_doproccmdline() if arguments are not cashed read them from the process stack. Suggested by: kib Reviewed by: kib Tested by:pho MFC after:2 weeks Modified: head/sys/fs/procfs/procfs_status.c Modified: head/sys/fs/procfs/procfs_status.c == --- head/sys/fs/procfs/procfs_status.c Tue Nov 22 20:40:18 2011 (r227833) +++ head/sys/fs/procfs/procfs_status.c Tue Nov 22 20:43:03 2011 (r227834) @@ -170,15 +170,10 @@ procfs_doprocstatus(PFS_FILL_ARGS) int procfs_doproccmdline(PFS_FILL_ARGS) { - struct ps_strings pstr; - char **ps_argvstr; - int error, i; /* * If we are using the ps/cmdline caching, use that. Otherwise -* revert back to the old way which only implements full cmdline -* for the current process and just p->p_comm for all other -* processes. +* read argv from the process space. * Note that if the argv is no longer available, we deliberately * don't fall back on p->p_comm or return an error: the authentic * Linux behaviour is to return zero-length in this case. @@ -190,30 +185,13 @@ procfs_doproccmdline(PFS_FILL_ARGS) PROC_UNLOCK(p); return (0); } - PROC_UNLOCK(p); - if (p != td->td_proc) { - sbuf_printf(sb, "%.*s", MAXCOMLEN, p->p_comm); - } else { - error = copyin((void *)p->p_sysent->sv_psstrings, &pstr, - sizeof(pstr)); - if (error) - return (error); - if (pstr.ps_nargvstr > ARG_MAX) - return (E2BIG); - ps_argvstr = malloc(pstr.ps_nargvstr * sizeof(char *), - M_TEMP, M_WAITOK); - error = copyin((void *)pstr.ps_argvstr, ps_argvstr, - pstr.ps_nargvstr * sizeof(char *)); - if (error) { - free(ps_argvstr, M_TEMP); - return (error); - } - for (i = 0; i < pstr.ps_nargvstr; i++) { - sbuf_copyin(sb, ps_argvstr[i], 0); - sbuf_printf(sb, "%c", '\0'); - } - free(ps_argvstr, M_TEMP); + + if ((p->p_flag & P_SYSTEM) != 0) { + PROC_UNLOCK(p); + return (0); } - return (0); + PROC_UNLOCK(p); + + return (proc_getargv(td, p, sb, ARG_MAX)); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227835 - head/sys/dev/vge
Author: yongari Date: Tue Nov 22 20:45:09 2011 New Revision: 227835 URL: http://svn.freebsd.org/changeset/base/227835 Log: Rework link establishment and link state detection logic. - Remove MIIBUS statchg callback and program VGE_DIAGCTL before initiating link establishment. Previously driver used to program VGE_DIAGCTL after getting a link in statchg callback. It seems the VGE_DIAGCTL register works like a kind of MII register such that it requires setting a 'to be' mode in advance rather than relying on resolved speed/duplex of established link. This means the statchg callback is not needed in driver. In addition, if there was no link at the time of media change, this was not called at all. - Introduce vge_ifmedia_upd_locked() to change current media to configured one. Actual media change is performed only after PHY reset and VGE_DIAGCTL setup. - In WOL configuration, make sure to clear forced mode such that controller can rely on auto-negotiation. - Unlike most other drivers that use miibus(4), vge(4) used controller's auto-polling feature for link state tracking via interrupt. This came from controller's inefficient mechanism to access MII registers. On link state change interrupt, vge(4) used to get current link state with series of MII register accesses. Because vge(4) already enabled auto polling, read PHY status register to resolved speed/duplex/flow control parameters. vge(4) still does not drive MII_TICK to reduce number of MII register accesses which in turn means the driver does not know the status of auto-negotiation. This was a one of long standing issue of vge(4). Probably driver may be able to implement a timer that keeps track of auto-negotiation state and restart auto-negotiation when driver couldn't establish a link within a specified period. However the controller does not provide a reliable way to detect auto-negotiation failure so I'm not sure whether it's worth to implement it in driver. Alternatively driver can completely disable MII auto-polling and let miibus(4) poll link state by driving MII_TICK. This may reduce unnecessary overhead of stopping/restarting MII auto-polling of controller. Unfortunately it was known that some variants of controller does not work correctly if MII auto-polling is disabled. Modified: head/sys/dev/vge/if_vge.c Modified: head/sys/dev/vge/if_vge.c == --- head/sys/dev/vge/if_vge.c Tue Nov 22 20:43:03 2011(r227834) +++ head/sys/dev/vge/if_vge.c Tue Nov 22 20:45:09 2011(r227835) @@ -173,6 +173,7 @@ static __inline void static voidvge_freebufs(struct vge_softc *); static voidvge_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int vge_ifmedia_upd(struct ifnet *); +static int vge_ifmedia_upd_locked(struct vge_softc *); static voidvge_init(void *); static voidvge_init_locked(struct vge_softc *); static voidvge_intr(void *); @@ -180,7 +181,6 @@ static void vge_intr_holdoff(struct vge_ static int vge_ioctl(struct ifnet *, u_long, caddr_t); static voidvge_link_statchg(void *); static int vge_miibus_readreg(device_t, int, int); -static voidvge_miibus_statchg(device_t); static int vge_miibus_writereg(device_t, int, int, int); static voidvge_miipoll_start(struct vge_softc *); static voidvge_miipoll_stop(struct vge_softc *); @@ -190,6 +190,7 @@ static void vge_reset(struct vge_softc * static int vge_rx_list_init(struct vge_softc *); static int vge_rxeof(struct vge_softc *, int); static voidvge_rxfilter(struct vge_softc *); +static voidvge_setmedia(struct vge_softc *); static voidvge_setvlan(struct vge_softc *); static voidvge_setwol(struct vge_softc *); static voidvge_start(struct ifnet *); @@ -218,7 +219,6 @@ static device_method_t vge_methods[] = { /* MII interface */ DEVMETHOD(miibus_readreg, vge_miibus_readreg), DEVMETHOD(miibus_writereg, vge_miibus_writereg), - DEVMETHOD(miibus_statchg, vge_miibus_statchg), { 0, 0 } }; @@ -1661,30 +1661,41 @@ vge_link_statchg(void *xsc) { struct vge_softc *sc; struct ifnet *ifp; - struct mii_data *mii; + uint8_t physts; sc = xsc; ifp = sc->vge_ifp; VGE_LOCK_ASSERT(sc); - mii = device_get_softc(sc->vge_miibus); - mii_pollstat(mii); - if ((sc->vge_flags & VGE_FLAG_LINK) != 0) { - if (!(mii->mii_media_status & IFM_ACTIVE)) { + physts = CSR_READ_1(sc, VGE_PHYSTS0); + if ((physts & VGE_PHYSTS_RESETSTS) == 0) { + if ((physts & VGE_PHYSTS_LINK) == 0) { sc->vge_flags &= ~VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_DOWN); -
svn commit: r227836 - head/sys/compat/linprocfs
Author: trociny Date: Tue Nov 22 20:45:11 2011 New Revision: 227836 URL: http://svn.freebsd.org/changeset/base/227836 Log: Retire linprocfs_doargv(). Instead use new functions, proc_getargv() and proc_getenvv(), which were implemented using linprocfs_doargv() as a reference. Suggested by: kib Reviewed by: kib Approved by: des (linprocfs maintainer) MFC after:2 weeks Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Tue Nov 22 20:45:09 2011 (r227835) +++ head/sys/compat/linprocfs/linprocfs.c Tue Nov 22 20:45:11 2011 (r227836) @@ -919,150 +919,6 @@ linprocfs_doprocroot(PFS_FILL_ARGS) return (0); } -#define MAX_ARGV_STR 512 /* Max number of argv-like strings */ -#define UIO_CHUNK_SZ 256 /* Max chunk size (bytes) for uiomove */ - -static int -linprocfs_doargv(struct thread *td, struct proc *p, struct sbuf *sb, -void (*resolver)(const struct ps_strings, u_long *, int *)) -{ - struct iovec iov; - struct uio tmp_uio; - struct ps_strings pss; - int ret, i, n_elements, elm_len; - u_long addr, pbegin; - char **env_vector, *envp; - char env_string[UIO_CHUNK_SZ]; -#ifdef COMPAT_FREEBSD32 - struct freebsd32_ps_strings pss32; - uint32_t *env_vector32; -#endif - -#defineUIO_HELPER(uio, iov, base, len, cnt, offset, sz, flg, rw, td) \ -do { \ - iov.iov_base = (caddr_t)(base); \ - iov.iov_len = (len);\ - uio.uio_iov = &(iov); \ - uio.uio_iovcnt = (cnt); \ - uio.uio_offset = (off_t)(offset); \ - uio.uio_resid = (sz); \ - uio.uio_segflg = (flg); \ - uio.uio_rw = (rw); \ - uio.uio_td = (td); \ -} while (0) - - env_vector = malloc(sizeof(char *) * MAX_ARGV_STR, M_TEMP, M_WAITOK); - -#ifdef COMPAT_FREEBSD32 - env_vector32 = NULL; - if (SV_PROC_FLAG(p, SV_ILP32) != 0) { - env_vector32 = malloc(sizeof(*env_vector32) * MAX_ARGV_STR, - M_TEMP, M_WAITOK); - elm_len = sizeof(int32_t); - envp = (char *)env_vector32; - - UIO_HELPER(tmp_uio, iov, &pss32, sizeof(pss32), 1, - (off_t)(p->p_sysent->sv_psstrings), - sizeof(pss32), UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - goto done; - pss.ps_argvstr = PTRIN(pss32.ps_argvstr); - pss.ps_nargvstr = pss32.ps_nargvstr; - pss.ps_envstr = PTRIN(pss32.ps_envstr); - pss.ps_nenvstr = pss32.ps_nenvstr; - } else { -#endif - elm_len = sizeof(char *); - envp = (char *)env_vector; - - UIO_HELPER(tmp_uio, iov, &pss, sizeof(pss), 1, - (off_t)(p->p_sysent->sv_psstrings), - sizeof(pss), UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - goto done; -#ifdef COMPAT_FREEBSD32 - } -#endif - - /* Get the array address and the number of elements */ - resolver(pss, &addr, &n_elements); - - /* Consistent with lib/libkvm/kvm_proc.c */ - if (n_elements > MAX_ARGV_STR) { - ret = E2BIG; - goto done; - } - - UIO_HELPER(tmp_uio, iov, envp, n_elements * elm_len, 1, - (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - goto done; -#ifdef COMPAT_FREEBSD32 - if (env_vector32 != NULL) { - for (i = 0; i < n_elements; i++) - env_vector[i] = PTRIN(env_vector32[i]); - } -#endif - - /* Now we can iterate through the list of strings */ - for (i = 0; i < n_elements; i++) { - pbegin = (vm_offset_t)env_vector[i]; - for (;;) { - UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), - 1, pbegin, iov.iov_len, UIO_SYSSPACE, UIO_READ, td); - ret = proc_rwmem(p, &tmp_uio); - if (ret != 0) - goto done; - - if (!strvalid(env_string, UIO_CHUNK_SZ)) { - /* -* We didn't find the end of th
svn commit: r227837 - head/sys/dev/vge
Author: yongari Date: Tue Nov 22 20:57:06 2011 New Revision: 227837 URL: http://svn.freebsd.org/changeset/base/227837 Log: Announce flow control capability to underlying PHY driver. Pause timer value is initialized to 0x. Controller allows just 4 different TX pause thresholds. The lowest possible threshold value looks too aggressive so use next available threshold value. Modified: head/sys/dev/vge/if_vge.c Modified: head/sys/dev/vge/if_vge.c == --- head/sys/dev/vge/if_vge.c Tue Nov 22 20:45:11 2011(r227836) +++ head/sys/dev/vge/if_vge.c Tue Nov 22 20:57:06 2011(r227837) @@ -1103,7 +1103,7 @@ vge_attach(device_t dev) /* Do MII setup */ error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -2112,9 +2112,16 @@ vge_init_locked(struct vge_softc *sc) vge_rxfilter(sc); vge_setvlan(sc); - /* Enable flow control */ - - CSR_WRITE_1(sc, VGE_CRS2, 0x8B); + /* Initialize pause timer. */ + CSR_WRITE_2(sc, VGE_TX_PAUSE_TIMER, 0x); + /* +* Initialize flow control parameters. +* TX XON high threshold : 48 +* TX pause low threshold : 24 +* Disable hald-duplex flow control +*/ + CSR_WRITE_1(sc, VGE_CRC2, 0xFF); + CSR_WRITE_1(sc, VGE_CRS2, VGE_CR2_XON_ENABLE | 0x0B); /* Enable jumbo frame reception (if desired) */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227838 - head/usr.bin/procstat
Author: trociny Date: Tue Nov 22 20:59:52 2011 New Revision: 227838 URL: http://svn.freebsd.org/changeset/base/227838 Log: Add new options, -e and -x, to display process environment variables and ELF auxiliary vectors. MFC after:2 weeks Added: head/usr.bin/procstat/procstat_auxv.c (contents, props changed) Modified: head/usr.bin/procstat/Makefile head/usr.bin/procstat/procstat.1 head/usr.bin/procstat/procstat.c head/usr.bin/procstat/procstat.h head/usr.bin/procstat/procstat_args.c Modified: head/usr.bin/procstat/Makefile == --- head/usr.bin/procstat/Makefile Tue Nov 22 20:57:06 2011 (r227837) +++ head/usr.bin/procstat/Makefile Tue Nov 22 20:59:52 2011 (r227838) @@ -4,6 +4,7 @@ PROG= procstat MAN= procstat.1 SRCS= procstat.c \ procstat_args.c \ + procstat_auxv.c \ procstat_basic.c\ procstat_bin.c \ procstat_cred.c \ Modified: head/usr.bin/procstat/procstat.1 == --- head/usr.bin/procstat/procstat.1Tue Nov 22 20:57:06 2011 (r227837) +++ head/usr.bin/procstat/procstat.1Tue Nov 22 20:59:52 2011 (r227838) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2011 +.Dd November 22, 2011 .Dt PROCSTAT 1 .Os .Sh NAME @@ -56,6 +56,8 @@ for printing: Display binary information for the process. .It Fl c Display command line arguments for the process. +.It Fl e +Display environment variables for the process. .It Fl f Display file descriptor information for the process. .It Fl i @@ -73,6 +75,8 @@ Display security credential information Display thread information for the process. .It Fl v Display virtual memory mappings for the process. +.It Fl x +Display ELF auxiliary vector for the process. .El .Pp All options generate output in the format of a table, the first field of Modified: head/usr.bin/procstat/procstat.c == --- head/usr.bin/procstat/procstat.cTue Nov 22 20:57:06 2011 (r227837) +++ head/usr.bin/procstat/procstat.cTue Nov 22 20:59:52 2011 (r227838) @@ -39,7 +39,8 @@ #include "procstat.h" -static int aflag, bflag, cflag, fflag, iflag, jflag, kflag, sflag, tflag, vflag; +static int aflag, bflag, cflag, eflag, fflag, iflag, jflag, kflag, sflag, tflag; +static int vflag, xflag; inthflag, nflag, Cflag; static void @@ -47,8 +48,9 @@ usage(void) { fprintf(stderr, "usage: procstat [-h] [-C] [-M core] [-N system] " - "[-w interval] [-b | -c | -f | -i | -j | -k | -s | -t | -v]\n"); - fprintf(stderr, "[-a | pid ...]\n"); + "[-w interval] \n"); + fprintf(stderr, "[-b | -c | -e | -f | -i | -j | -k | " + "-s | -t | -v | -x] [-a | pid ...]\n"); exit(EX_USAGE); } @@ -60,6 +62,8 @@ procstat(struct procstat *prstat, struct procstat_bin(kipp); else if (cflag) procstat_args(kipp); + else if (eflag) + procstat_env(kipp); else if (fflag) procstat_files(prstat, kipp); else if (iflag) @@ -74,6 +78,8 @@ procstat(struct procstat *prstat, struct procstat_threads(kipp); else if (vflag) procstat_vm(kipp); + else if (xflag) + procstat_auxv(kipp); else procstat_basic(kipp); } @@ -117,7 +123,7 @@ main(int argc, char *argv[]) interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "CN:M:abcfijkhstvw:")) != -1) { + while ((ch = getopt(argc, argv, "CN:M:abcefijkhstvw:x")) != -1) { switch (ch) { case 'C': Cflag++; @@ -141,6 +147,10 @@ main(int argc, char *argv[]) cflag++; break; + case 'e': + eflag++; + break; + case 'f': fflag++; break; @@ -186,6 +196,10 @@ main(int argc, char *argv[]) interval = l; break; + case 'x': + xflag++; + break; + case '?': default: usage(); @@ -196,7 +210,8 @@ main(int argc, char *argv[]) argv += optind; /* We require that either 0 or 1 mode flags be set. */ - tmp = bflag + cflag + fflag + (kflag ? 1 : 0) + sflag + tflag + vflag; + tmp = bflag + cflag + eflag + fflag + (kflag ? 1 : 0) + sflag + tflag + + vflag + xflag; if (!(tmp == 0 || tmp == 1)) usage(); Modified: head/usr.bin/procstat/procstat.h
svn commit: r227839 - head/lib/libkvm
Author: trociny Date: Tue Nov 22 21:12:28 2011 New Revision: 227839 URL: http://svn.freebsd.org/changeset/base/227839 Log: Now kvm_getenvv() and kvm_getargv() don't need procfs(5). MFC after:2 weeks Modified: head/lib/libkvm/kvm_getprocs.3 head/lib/libkvm/kvm_proc.c Modified: head/lib/libkvm/kvm_getprocs.3 == --- head/lib/libkvm/kvm_getprocs.3 Tue Nov 22 20:59:52 2011 (r227838) +++ head/lib/libkvm/kvm_getprocs.3 Tue Nov 22 21:12:28 2011 (r227839) @@ -32,7 +32,7 @@ .\" @(#)kvm_getprocs.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 27, 2003 +.Dd November 22, 2011 .Dt KVM_GETPROCS 3 .Os .Sh NAME @@ -172,10 +172,3 @@ on failure. .Xr kvm_write 3 .Sh BUGS These routines do not belong in the kvm interface. -.Pp -In order for -.Xr kvm_getenvv 3 -to function correctly, -.Xr procfs 5 -must be mounted on -.Pa /proc . Modified: head/lib/libkvm/kvm_proc.c == --- head/lib/libkvm/kvm_proc.c Tue Nov 22 20:59:52 2011(r227838) +++ head/lib/libkvm/kvm_proc.c Tue Nov 22 21:12:28 2011(r227839) @@ -72,9 +72,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include #include @@ -623,276 +620,16 @@ _kvm_realloc(kvm_t *kd, void *p, size_t return (np); } -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - /* - * Read in an argument vector from the user address space of process kp. - * addr if the user-space base address of narg null-terminated contiguous - * strings. This is used to read in both the command arguments and - * environment strings. Read at most maxcnt characters of strings. + * Get the command args or environment. */ static char ** -kvm_argv(kvm_t *kd, const struct kinfo_proc *kp, u_long addr, int narg, -int maxcnt) -{ - char *np, *cp, *ep, *ap; - u_long oaddr = -1; - int len, cc; - char **argv; - - /* -* Check that there aren't an unreasonable number of arguments, -* and that the address is in user space. Special test for -* VM_MIN_ADDRESS as it evaluates to zero, but is not a simple zero -* constant for some archs. We cannot use the pre-processor here and -* for some archs the compiler would trigger a signedness warning. -*/ - if (narg > 512 || addr + 1 < VM_MIN_ADDRESS + 1 || addr >= VM_MAXUSER_ADDRESS) - return (0); - - /* -* kd->argv : work space for fetching the strings from the target -*process's space, and is converted for returning to caller -*/ - if (kd->argv == 0) { - /* -* Try to avoid reallocs. -*/ - kd->argc = MAX(narg + 1, 32); - kd->argv = (char **)_kvm_malloc(kd, kd->argc * - sizeof(*kd->argv)); - if (kd->argv == 0) - return (0); - } else if (narg + 1 > kd->argc) { - kd->argc = MAX(2 * kd->argc, narg + 1); - kd->argv = (char **)_kvm_realloc(kd, kd->argv, kd->argc * - sizeof(*kd->argv)); - if (kd->argv == 0) - return (0); - } - /* -* kd->argspc : returned to user, this is where the kd->argv -* arrays are left pointing to the collected strings. -*/ - if (kd->argspc == 0) { - kd->argspc = (char *)_kvm_malloc(kd, PAGE_SIZE); - if (kd->argspc == 0) - return (0); - kd->arglen = PAGE_SIZE; - } - /* -* kd->argbuf : used to pull in pages from the target process. -* the strings are copied out of here. -*/ - if (kd->argbuf == 0) { - kd->argbuf = (char *)_kvm_malloc(kd, PAGE_SIZE); - if (kd->argbuf == 0) - return (0); - } - - /* Pull in the target process'es argv vector */ - cc = sizeof(char *) * narg; - if (kvm_uread(kd, kp, addr, (char *)kd->argv, cc) != cc) - return (0); - /* -* ap : saved start address of string we're working on in kd->argspc -* np : pointer to next place to write in kd->argspc -* len: length of data in kd->argspc -* argv: pointer to the argv vector that we are hunting around the -* target process space for, and converting to addresses in -* our address space (kd->argspc). -*/ - ap = np = kd->argspc; - argv = kd->argv; - len = 0; - /* -* Loop over pages, filling in the argument vector. -* Note that the argv strings could be pointing *anywhere* in -* the user address space and are no longer contigu
svn commit: r227840 - head/bin/ps
Author: trociny Date: Tue Nov 22 21:14:46 2011 New Revision: 227840 URL: http://svn.freebsd.org/changeset/base/227840 Log: No need in procfs(5). MFC after:2 weeks Modified: head/bin/ps/ps.1 head/bin/ps/ps.c Modified: head/bin/ps/ps.1 == --- head/bin/ps/ps.1Tue Nov 22 21:12:28 2011(r227839) +++ head/bin/ps/ps.1Tue Nov 22 21:14:46 2011(r227840) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd October 30, 2011 +.Dd November 22, 2011 .Dt PS 1 .Os .Sh NAME @@ -686,9 +686,6 @@ attempts to automatically determine the .Bl -tag -width ".Pa /boot/kernel/kernel" -compact .It Pa /boot/kernel/kernel default system namelist -.It Pa /proc -the mount point of -.Xr procfs 5 .El .Sh SEE ALSO .Xr kill 1 , Modified: head/bin/ps/ps.c == --- head/bin/ps/ps.cTue Nov 22 21:12:28 2011(r227839) +++ head/bin/ps/ps.cTue Nov 22 21:14:46 2011(r227840) @@ -130,7 +130,6 @@ struct listinfo { } l; }; -static int check_procfs(void); static int addelem_gid(struct listinfo *, const char *); static int addelem_pid(struct listinfo *, const char *); static int addelem_tty(struct listinfo *, const char *); @@ -411,14 +410,6 @@ main(int argc, char *argv[]) argv += optind; /* -* If the user specified ps -e then they want a copy of the process -* environment kvm_getenvv(3) attempts to open /proc//mem. -* Check to make sure that procfs is mounted on /proc, otherwise -* print a warning informing the user that output will be incomplete. -*/ - if (needenv == 1 && check_procfs() == 0) - warnx("Process environment requires procfs(5)"); - /* * If there arguments after processing all the options, attempt * to treat them as a list of process ids. */ @@ -1360,18 +1351,6 @@ kludge_oldps_options(const char *optlist return (newopts); } -static int -check_procfs(void) -{ - struct statfs mnt; - - if (statfs("/proc", &mnt) < 0) - return (0); - if (strcmp(mnt.f_fstypename, "procfs") != 0) - return (0); - return (1); -} - static void usage(void) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227841 - head
Author: des Date: Tue Nov 22 21:18:14 2011 New Revision: 227841 URL: http://svn.freebsd.org/changeset/base/227841 Log: Remove libpam from _prebuild_libs. This should unbreak the -jX build. MFC after:3 weeks Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue Nov 22 21:14:46 2011(r227840) +++ head/Makefile.inc1 Tue Nov 22 21:18:14 2011(r227841) @@ -1235,8 +1235,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 ${_cddl_lib_libumem} \ lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ - ${_secure_lib_libssl} \ - lib/libpam + ${_secure_lib_libssl} .if ${MK_LIBTHR} != "no" _lib_libthr= lib/libthr ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227842 - head/sys/dev/mii
Author: yongari Date: Tue Nov 22 21:22:06 2011 New Revision: 227842 URL: http://svn.freebsd.org/changeset/base/227842 Log: For IP1001 PHY, do not set multi-port device(MASTER). Ideally this bit should not affect link establishment process of auto-negotiation if manual configuration is not used, which is true in auto-negotiation. However it seems setting this bit interfere with IP1001 PHY's down-shifting feature such that establishing a 10/100Mbps link failed when 1000baseT link is not available during auto-negotiation process. Tested by:Andrey Smagin mail dot ru > Modified: head/sys/dev/mii/ip1000phy.c Modified: head/sys/dev/mii/ip1000phy.c == --- head/sys/dev/mii/ip1000phy.cTue Nov 22 21:18:14 2011 (r227841) +++ head/sys/dev/mii/ip1000phy.cTue Nov 22 21:22:06 2011 (r227842) @@ -324,7 +324,8 @@ ip1000phy_mii_phy_auto(struct mii_softc PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA); reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX; - reg |= IP1000PHY_1000CR_MASTER; + if (sc->mii_mpd_model != MII_MODEL_xxICPLUS_IP1001) + reg |= IP1000PHY_1000CR_MASTER; PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg); PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227840 - head/bin/ps
On Tue Nov 22 11, Mikolaj Golub wrote: > Author: trociny > Date: Tue Nov 22 21:14:46 2011 > New Revision: 227840 > URL: http://svn.freebsd.org/changeset/base/227840 > > Log: > No need in procfs(5). > > MFC after: 2 weeks > > Modified: > head/bin/ps/ps.1 > head/bin/ps/ps.c > > Modified: head/bin/ps/ps.1 > == > --- head/bin/ps/ps.1 Tue Nov 22 21:12:28 2011(r227839) > +++ head/bin/ps/ps.1 Tue Nov 22 21:14:46 2011(r227840) > @@ -29,7 +29,7 @@ > .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 > .\" $FreeBSD$ > .\" > -.Dd October 30, 2011 > +.Dd November 22, 2011 > .Dt PS 1 > .Os > .Sh NAME > @@ -686,9 +686,6 @@ attempts to automatically determine the > .Bl -tag -width ".Pa /boot/kernel/kernel" -compact > .It Pa /boot/kernel/kernel > default system namelist > -.It Pa /proc > -the mount point of > -.Xr procfs 5 are these references to procfs still necessary in the ps(1) man page? 1) " The process file system (see procfs(5)) should be mounted when ps is exe- cuted, otherwise not all information will be available. " and 2) " SEE ALSO kill(1), pgrep(1), pkill(1), procstat(1), w(1), kvm(3), strftime(3), mac(4), procfs(5), pstat(8), sysctl(8), mutex(9) " ? cheers. alex > .El > .Sh SEE ALSO > .Xr kill 1 , > > Modified: head/bin/ps/ps.c > == > --- head/bin/ps/ps.c Tue Nov 22 21:12:28 2011(r227839) > +++ head/bin/ps/ps.c Tue Nov 22 21:14:46 2011(r227840) > @@ -130,7 +130,6 @@ struct listinfo { > } l; > }; > > -static intcheck_procfs(void); > static intaddelem_gid(struct listinfo *, const char *); > static intaddelem_pid(struct listinfo *, const char *); > static intaddelem_tty(struct listinfo *, const char *); > @@ -411,14 +410,6 @@ main(int argc, char *argv[]) > argv += optind; > > /* > - * If the user specified ps -e then they want a copy of the process > - * environment kvm_getenvv(3) attempts to open /proc//mem. > - * Check to make sure that procfs is mounted on /proc, otherwise > - * print a warning informing the user that output will be incomplete. > - */ > - if (needenv == 1 && check_procfs() == 0) > - warnx("Process environment requires procfs(5)"); > - /* >* If there arguments after processing all the options, attempt >* to treat them as a list of process ids. >*/ > @@ -1360,18 +1351,6 @@ kludge_oldps_options(const char *optlist > return (newopts); > } > > -static int > -check_procfs(void) > -{ > - struct statfs mnt; > - > - if (statfs("/proc", &mnt) < 0) > - return (0); > - if (strcmp(mnt.f_fstypename, "procfs") != 0) > - return (0); > - return (1); > -} > - > static void > usage(void) > { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227843 - in head/sys: amd64/amd64 arm/econa arm/mv arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 dev/aac dev/acpi_support dev/acpica dev/amr dev/arcmsr dev/bce dev/bfe dev/bge ...
Author: marius Date: Tue Nov 22 21:28:20 2011 New Revision: 227843 URL: http://svn.freebsd.org/changeset/base/227843 Log: - There's no need to overwrite the default device method with the default one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID. Modified: head/sys/amd64/amd64/legacy.c head/sys/arm/econa/ehci_ebus.c head/sys/arm/econa/ohci_ec.c head/sys/arm/mv/mv_pci.c head/sys/arm/xscale/i80321/i80321_pci.c head/sys/arm/xscale/i8134x/i81342_pci.c head/sys/arm/xscale/ixp425/ixp425_pci.c head/sys/dev/aac/aac_pci.c head/sys/dev/acpi_support/acpi_wmi.c head/sys/dev/acpica/acpi_cpu.c head/sys/dev/acpica/acpi_isab.c head/sys/dev/acpica/acpi_pcib_acpi.c head/sys/dev/amr/amr_pci.c head/sys/dev/arcmsr/arcmsr.c head/sys/dev/bce/if_bce.c head/sys/dev/bfe/if_bfe.c head/sys/dev/bge/if_bge.c head/sys/dev/bm/if_bm.c head/sys/dev/bxe/if_bxe.c head/sys/dev/cas/if_cas.c head/sys/dev/cesa/cesa.c head/sys/dev/cxgb/cxgb_main.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/dc/if_dc.c head/sys/dev/eisa/eisaconf.c head/sys/dev/et/if_et.c head/sys/dev/fb/fb.c head/sys/dev/firewire/firewire.c head/sys/dev/firewire/fwohci_pci.c head/sys/dev/gem/if_gem_pci.c head/sys/dev/gem/if_gem_sbus.c head/sys/dev/gpio/gpiobus.c head/sys/dev/hifn/hifn7751.c head/sys/dev/hme/if_hme_pci.c head/sys/dev/hme/if_hme_sbus.c head/sys/dev/ichsmb/ichsmb_pci.c head/sys/dev/ida/ida_pci.c head/sys/dev/if_ndis/if_ndis_usb.c head/sys/dev/iicbus/iicbus.c head/sys/dev/iicbus/iicsmb.c head/sys/dev/lge/if_lge.c head/sys/dev/mca/mca_bus.c head/sys/dev/mfi/mfi_pci.c head/sys/dev/mii/mii.c head/sys/dev/mlx/mlx_pci.c head/sys/dev/mps/mps_pci.c head/sys/dev/msk/if_msk.c head/sys/dev/nfe/if_nfe.c head/sys/dev/nge/if_nge.c head/sys/dev/nve/if_nve.c head/sys/dev/pccbb/pccbb_isa.c head/sys/dev/pccbb/pccbb_pci.c head/sys/dev/pci/eisa_pci.c head/sys/dev/pci/isa_pci.c head/sys/dev/pci/pci_pci.c head/sys/dev/pcn/if_pcn.c head/sys/dev/ppbus/lpbb.c head/sys/dev/puc/puc_pccard.c head/sys/dev/puc/puc_pci.c head/sys/dev/quicc/quicc_bfe_fdt.c head/sys/dev/re/if_re.c head/sys/dev/rt/if_rt.c head/sys/dev/safe/safe.c head/sys/dev/scc/scc_bfe_ebus.c head/sys/dev/scc/scc_bfe_macio.c head/sys/dev/scc/scc_bfe_quicc.c head/sys/dev/scc/scc_bfe_sbus.c head/sys/dev/sec/sec.c head/sys/dev/sf/if_sf.c head/sys/dev/sfxge/sfxge.c head/sys/dev/sge/if_sge.c head/sys/dev/siba/siba_pcib.c head/sys/dev/sis/if_sis.c head/sys/dev/sk/if_sk.c head/sys/dev/smbus/smbus.c head/sys/dev/sound/isa/gusc.c head/sys/dev/sound/isa/sbc.c head/sys/dev/sound/pci/csa.c head/sys/dev/sound/pci/fm801.c head/sys/dev/sound/usb/uaudio.c head/sys/dev/spibus/spibus.c head/sys/dev/ste/if_ste.c head/sys/dev/tl/if_tl.c head/sys/dev/tsec/if_tsec_fdt.c head/sys/dev/twa/tw_osl_freebsd.c head/sys/dev/twe/twe_freebsd.c head/sys/dev/tws/tws.c head/sys/dev/ubsec/ubsec.c head/sys/dev/usb/controller/at91dci_atmelarm.c head/sys/dev/usb/controller/atmegadci_atmelarm.c head/sys/dev/usb/controller/ehci_ixp4xx.c head/sys/dev/usb/controller/ehci_mv.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/musb_otg_atmelarm.c head/sys/dev/usb/controller/ohci_atmelarm.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/ohci_s3c24x0.c head/sys/dev/usb/controller/uhci_pci.c head/sys/dev/usb/controller/uss820dci_atmelarm.c head/sys/dev/usb/controller/xhci_pci.c head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_mos.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_udav.c head/sys/dev/vge/if_vge.c head/sys/dev/vr/if_vr.c head/sys/dev/wb/if_wb.c head/sys/dev/xen/pcifront/pcifront.c head/sys/dev/xl/if_xl.c head/sys/i386/i386/legacy.c head/sys/isa/vga_isa.c head/sys/mips/adm5120/admpci.c head/sys/mips/atheros/apb.c head/sys/mips/atheros/ar71xx_ehci.c head/sys/mips/atheros/ar71xx_ohci.c head/sys/mips/atheros/ar71xx_pci.c head/sys/mips/atheros/ar724x_pci.c head/sys/mips/atheros/if_arge.c head/sys/mips/cavium/octopci.c head/sys/mips/cavium/usb/octusb_octeon.c head/sys/mips/idt/idtpci.c head/sys/mips/idt/if_kr.c head/sys/mips/malta/gt.c head/sys/mips/malta/gt_pci.c head/sys/mips/nlm/xlp_pci.c head/sys/mips/rmi/dev/nlge/if_nlge.c head/sys/mips/rmi/dev/sec/rmisec.c head/sys/mips/rmi/xlr_pci.c head/sys/mips/rmi/xls_ehci.c head/sys/mips/rt305x/rt305x_dotg.c head/sys/pci/if_rl.c head/sys/pci/intpm.c head/sys/pci/viapm.c head/sys/powerpc/aim/nexus.c head/sys/powerpc/mambo/mambo.c head/sys/powerpc/mpc85xx/nexus.c head/sys/powe
Re: svn commit: r227797 - head/share/mk
Rui Paulo writes: > With this change, I can no longer update a FreeBSD 9.0-current system > from June 2010 to FreeBSD 10.0. I suspect I'm not the only one. Sorry, my mind reader is broken at the moment, so you'll have to provide more information than that. DES -- Dag-Erling Smørgrav - d...@des.no ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227798 - in head: . lib/libpam lib/libpam/modules
Jilles Tjoelker writes: > Although this will work, I think it trades the quality of the binaries > for a cleaner build system. It is better to pass all libraries to ld(1) > even though a .so may have unresolved references: the NEEDED entry > serves as an additional protection against version mismatches and symbol > versioning (if you ever add it) requires ld(1) to have access to the .so > containing the definition so it knows the version name to store in the > output file. These are plugins. The names and prototypes of the functions they export were set in stone 15 years ago. DES -- Dag-Erling Smørgrav - d...@des.no ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227798 - in head: . lib/libpam lib/libpam/modules
Dag-Erling Smørgrav writes: > Jilles Tjoelker writes: > > Although this will work, I think it trades the quality of the binaries > > for a cleaner build system. It is better to pass all libraries to ld(1) > > even though a .so may have unresolved references: the NEEDED entry > > serves as an additional protection against version mismatches and symbol > > versioning (if you ever add it) requires ld(1) to have access to the .so > > containing the definition so it knows the version name to store in the > > output file. > These are plugins. The names and prototypes of the functions they > export were set in stone 15 years ago. Sorry, that was a bit unclear. What I was trying to say is that symbol versioning is not and will never be an issue. DES -- Dag-Erling Smørgrav - d...@des.no ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227840 - head/bin/ps
On Tue, 22 Nov 2011 21:24:13 + Alexander Best wrote: AB> On Tue Nov 22 11, Mikolaj Golub wrote: >> Author: trociny >> Date: Tue Nov 22 21:14:46 2011 >> New Revision: 227840 >> URL: http://svn.freebsd.org/changeset/base/227840 >> >> Log: >> No need in procfs(5). >> >> MFC after:2 weeks >> >> Modified: >> head/bin/ps/ps.1 >> head/bin/ps/ps.c >> >> Modified: head/bin/ps/ps.1 >> == >> --- head/bin/ps/ps.1Tue Nov 22 21:12:28 2011(r227839) >> +++ head/bin/ps/ps.1Tue Nov 22 21:14:46 2011(r227840) >> @@ -29,7 +29,7 @@ >> .\" @(#)ps.18.3 (Berkeley) 4/18/94 >> .\" $FreeBSD$ >> .\" >> -.Dd October 30, 2011 >> +.Dd November 22, 2011 >> .Dt PS 1 >> .Os >> .Sh NAME >> @@ -686,9 +686,6 @@ attempts to automatically determine the >> .Bl -tag -width ".Pa /boot/kernel/kernel" -compact >> .It Pa /boot/kernel/kernel >> default system namelist >> -.It Pa /proc >> -the mount point of >> -.Xr procfs 5 AB> are these references to procfs still necessary in the ps(1) man page? AB> 1) AB> " AB> The process file system (see procfs(5)) should be mounted when ps is exe- AB> cuted, otherwise not all information will be available. AB> " Thanks, I will remove this. AB> and 2) AB> " AB> SEE ALSO AB> kill(1), pgrep(1), pkill(1), procstat(1), w(1), kvm(3), strftime(3), AB> mac(4), procfs(5), pstat(8), sysctl(8), mutex(9) AB> " AB> ? I think this reference to procfs(5) should remain. It is here as yet another way to get process statistics. >> .El >> .Sh SEE ALSO >> .Xr kill 1 , >> >> Modified: head/bin/ps/ps.c >> == >> --- head/bin/ps/ps.cTue Nov 22 21:12:28 2011(r227839) >> +++ head/bin/ps/ps.cTue Nov 22 21:14:46 2011(r227840) >> @@ -130,7 +130,6 @@ struct listinfo { >> } l; >> }; >> >> -static int check_procfs(void); >> static int addelem_gid(struct listinfo *, const char *); >> static int addelem_pid(struct listinfo *, const char *); >> static int addelem_tty(struct listinfo *, const char *); >> @@ -411,14 +410,6 @@ main(int argc, char *argv[]) >> argv += optind; >> >> /* >> - * If the user specified ps -e then they want a copy of the process >> - * environment kvm_getenvv(3) attempts to open /proc//mem. >> - * Check to make sure that procfs is mounted on /proc, otherwise >> - * print a warning informing the user that output will be >> incomplete. >> - */ >> -if (needenv == 1 && check_procfs() == 0) >> -warnx("Process environment requires procfs(5)"); >> -/* >> * If there arguments after processing all the options, attempt >> * to treat them as a list of process ids. >> */ >> @@ -1360,18 +1351,6 @@ kludge_oldps_options(const char *optlist >> return (newopts); >> } >> >> -static int >> -check_procfs(void) >> -{ >> -struct statfs mnt; >> - >> -if (statfs("/proc", &mnt) < 0) >> -return (0); >> -if (strcmp(mnt.f_fstypename, "procfs") != 0) >> -return (0); >> -return (1); >> -} >> - >> static void >> usage(void) >> { -- Mikolaj Golub ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On 11/22/2011 12:27 PM, David Schultz wrote: > On Tue, Nov 22, 2011, Eitan Adler wrote: >> The problem with profiling this type of change is that it is hard to >> find a good representative benchmark. I could easily write code that >> will show you that adding the equality check is a good idea or that it >> is a horrible idea. IMHO it saves enough time when they are equal, but >> loses almost no time when the strings are not equal. > > Benchmark or not, I think you'll have a very hard time finding a > single real program that routinely calls strcasecmp() with > identical pointers! Agreed. Also, these changes seem to violate the general rule of "Don't call a change an optimization unless you have benchmarks that demonstrate that it actually is." The more critical the piece of code you are modifying, the more important this rule is. >> Is this the right course of action? Or should I just revert both >> commits entirely? Sorry to say, my vote would be to back them out. OTOH, I agree with David that you should try not to let it discourage you. Doug -- "We could put the whole Internet into a book." "Too practical." Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227844 - head/share/examples/drivers
Author: marius Date: Tue Nov 22 21:49:29 2011 New Revision: 227844 URL: http://svn.freebsd.org/changeset/base/227844 Log: Update to use DEVMETHOD_END. Modified: head/share/examples/drivers/make_device_driver.sh Modified: head/share/examples/drivers/make_device_driver.sh == --- head/share/examples/drivers/make_device_driver.sh Tue Nov 22 21:28:20 2011(r227843) +++ head/share/examples/drivers/make_device_driver.sh Tue Nov 22 21:49:29 2011(r227844) @@ -261,7 +261,7 @@ static device_method_t ${1}_methods[] = DEVMETHOD(device_probe, ${1}_isa_probe), DEVMETHOD(device_attach,${1}_isa_attach), DEVMETHOD(device_detach,${1}_isa_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t ${1}_isa_driver = { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227845 - head/sys/conf
Author: luigi Date: Tue Nov 22 21:50:38 2011 New Revision: 227845 URL: http://svn.freebsd.org/changeset/base/227845 Log: forgot to merge NETMAP entries in sys/conf ! Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Tue Nov 22 21:49:29 2011(r227844) +++ head/sys/conf/NOTES Tue Nov 22 21:50:38 2011(r227845) @@ -799,6 +799,12 @@ device sppp # option. DHCP requires bpf. device bpf +# The `netmap' device implements memory-mapped access to network +# devices from userspace, enabling wire-speed packet capture and +# generation even at 10Gbit/s. Requires support in the device +# driver. Supported drivers are ixgbe, e1000, re. +device netmap + # The `disc' device implements a minimal network interface, # which throws away all packets sent and never receives any. It is # included for testing and benchmarking purposes. Modified: head/sys/conf/files == --- head/sys/conf/files Tue Nov 22 21:49:29 2011(r227844) +++ head/sys/conf/files Tue Nov 22 21:50:38 2011(r227845) @@ -1507,6 +1507,7 @@ dev/mxge/mxge_rss_ethp_z8e.c optional mx dev/my/if_my.c optional my dev/ncv/ncr53c500.coptional ncv dev/ncv/ncr53c500_pccard.c optional ncv pccard +dev/netmap/netmap.coptional netmap dev/nge/if_nge.c optional nge dev/nxge/if_nxge.c optional nxge dev/nxge/xgehal/xgehal-device.coptional nxge Modified: head/sys/conf/options == --- head/sys/conf/options Tue Nov 22 21:49:29 2011(r227844) +++ head/sys/conf/options Tue Nov 22 21:50:38 2011(r227845) @@ -690,6 +690,7 @@ ISAPNP opt_isa.h # various 'device presence' options. DEV_BPFopt_bpf.h +DEV_NETMAP opt_global.h DEV_MCAopt_mca.h DEV_CARP opt_carp.h DEV_SPLASH opt_splash.h ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227846 - head/bin/ps
Author: trociny Date: Tue Nov 22 21:53:06 2011 New Revision: 227846 URL: http://svn.freebsd.org/changeset/base/227846 Log: Remove yet another outdated note about procfs(5) being required. Spotted by: arundel Modified: head/bin/ps/ps.1 Modified: head/bin/ps/ps.1 == --- head/bin/ps/ps.1Tue Nov 22 21:50:38 2011(r227845) +++ head/bin/ps/ps.1Tue Nov 22 21:53:06 2011(r227846) @@ -98,12 +98,6 @@ The default output format includes, for controlling terminal, state, CPU time (including both user and system time) and associated command. .Pp -The process file system (see -.Xr procfs 5 ) -should be mounted when -.Nm -is executed, otherwise not all information will be available. -.Pp The options are as follows: .Bl -tag -width indent .It Fl a ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227847 - head/sys/kern
Author: hselasky Date: Tue Nov 22 21:53:19 2011 New Revision: 227847 URL: http://svn.freebsd.org/changeset/base/227847 Log: Style change. Suggested by: jhb @ and marius @ MFC after:1 week Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c == --- head/sys/kern/subr_bus.cTue Nov 22 21:53:06 2011(r227846) +++ head/sys/kern/subr_bus.cTue Nov 22 21:53:19 2011(r227847) @@ -1862,7 +1862,7 @@ device_delete_child(device_t dev, device PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev))); /* remove children first */ - while ( (grandchild = TAILQ_FIRST(&child->children)) ) { + while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { error = device_delete_child(child, grandchild); if (error) return (error); @@ -1903,7 +1903,7 @@ device_delete_all_children(device_t dev) error = 0; - while ( (child = TAILQ_FIRST(&dev->children)) ) { + while ((child = TAILQ_FIRST(&dev->children)) != NULL) { error = device_delete_child(dev, child); if (error) { PDEBUG(("Failed deleting %s", DEVICENAME(child))); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227843 - in head/sys: amd64/amd64 arm/econa arm/mv arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 dev/aac dev/acpi_support dev/acpica dev/amr dev/arcmsr dev/bce dev/bfe dev/bge
on 22/11/2011 23:28 Marius Strobl said the following: > Author: marius > Date: Tue Nov 22 21:28:20 2011 > New Revision: 227843 > URL: http://svn.freebsd.org/changeset/base/227843 > > Log: > - There's no need to overwrite the default device method with the default > one. Interestingly, these are actually the default for quite some time > (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) > since r52045) but even recently added device drivers do this > unnecessarily. Maybe because it is not immediately obvious which methods do have sensible defaults and which do not (and why). Thus, copy+paste. E.g. bus_add_child vs bus_print_child below. > Modified: head/sys/dev/acpi_support/acpi_wmi.c > == > --- head/sys/dev/acpi_support/acpi_wmi.c Tue Nov 22 21:22:06 2011 > (r227842) > +++ head/sys/dev/acpi_support/acpi_wmi.c Tue Nov 22 21:28:20 2011 > (r227843) > @@ -175,7 +175,6 @@ static device_method_t acpi_wmi_methods[ > > /* bus interface */ > DEVMETHOD(bus_add_child,bus_generic_add_child), > - DEVMETHOD(bus_print_child, bus_generic_print_child), > > /* acpi_wmi interface */ > DEVMETHOD(acpi_wmi_provides_guid_string, -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227848 - in head/sys: dev/bwn dev/esp dev/mii dev/ofw dev/siba dev/stge dev/vte sparc64/central sparc64/ebus sparc64/fhc sparc64/pci sparc64/sbus sparc64/sparc64
Author: marius Date: Tue Nov 22 21:55:40 2011 New Revision: 227848 URL: http://svn.freebsd.org/changeset/base/227848 Log: s,KOBJMETHOD_END,DEVMETHOD_END,g in order to fully hide the explicit mention of kobj(9) from device drivers. Modified: head/sys/dev/bwn/if_bwn.c head/sys/dev/esp/esp_pci.c head/sys/dev/esp/esp_sbus.c head/sys/dev/mii/rdcphy.c head/sys/dev/ofw/ofw_iicbus.c head/sys/dev/siba/siba.c head/sys/dev/siba/siba_bwn.c head/sys/dev/siba/siba_cc.c head/sys/dev/stge/if_stge.c head/sys/dev/vte/if_vte.c head/sys/sparc64/central/central.c head/sys/sparc64/ebus/ebus.c head/sys/sparc64/ebus/epic.c head/sys/sparc64/fhc/fhc.c head/sys/sparc64/pci/apb.c head/sys/sparc64/pci/ofw_pcib.c head/sys/sparc64/pci/ofw_pcibus.c head/sys/sparc64/sbus/dma_sbus.c head/sys/sparc64/sbus/sbus.c head/sys/sparc64/sparc64/eeprom.c head/sys/sparc64/sparc64/jbusppm.c head/sys/sparc64/sparc64/nexus.c head/sys/sparc64/sparc64/rtc.c head/sys/sparc64/sparc64/sc_machdep.c head/sys/sparc64/sparc64/schppm.c head/sys/sparc64/sparc64/ssm.c head/sys/sparc64/sparc64/upa.c Modified: head/sys/dev/bwn/if_bwn.c == --- head/sys/dev/bwn/if_bwn.c Tue Nov 22 21:53:19 2011(r227847) +++ head/sys/dev/bwn/if_bwn.c Tue Nov 22 21:55:40 2011(r227848) @@ -14226,7 +14226,7 @@ static device_method_t bwn_methods[] = { DEVMETHOD(device_detach,bwn_detach), DEVMETHOD(device_suspend, bwn_suspend), DEVMETHOD(device_resume,bwn_resume), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t bwn_driver = { "bwn", Modified: head/sys/dev/esp/esp_pci.c == --- head/sys/dev/esp/esp_pci.c Tue Nov 22 21:53:19 2011(r227847) +++ head/sys/dev/esp/esp_pci.c Tue Nov 22 21:55:40 2011(r227848) @@ -146,7 +146,7 @@ static device_method_t esp_pci_methods[] DEVMETHOD(device_suspend, esp_pci_suspend), DEVMETHOD(device_resume,esp_pci_resume), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t esp_pci_driver = { Modified: head/sys/dev/esp/esp_sbus.c == --- head/sys/dev/esp/esp_sbus.c Tue Nov 22 21:53:19 2011(r227847) +++ head/sys/dev/esp/esp_sbus.c Tue Nov 22 21:55:40 2011(r227848) @@ -117,7 +117,7 @@ static device_method_t esp_dma_methods[] DEVMETHOD(device_suspend, esp_suspend), DEVMETHOD(device_resume,esp_resume), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t esp_dma_driver = { @@ -136,7 +136,7 @@ static device_method_t esp_sbus_methods[ DEVMETHOD(device_suspend, esp_suspend), DEVMETHOD(device_resume,esp_resume), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t esp_sbus_driver = { Modified: head/sys/dev/mii/rdcphy.c == --- head/sys/dev/mii/rdcphy.c Tue Nov 22 21:53:19 2011(r227847) +++ head/sys/dev/mii/rdcphy.c Tue Nov 22 21:55:40 2011(r227848) @@ -65,7 +65,7 @@ static device_method_t rdcphy_methods[] DEVMETHOD(device_attach,rdcphy_attach), DEVMETHOD(device_detach,mii_phy_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - KOBJMETHOD_END + DEVMETHOD_END }; static devclass_t rdcphy_devclass; Modified: head/sys/dev/ofw/ofw_iicbus.c == --- head/sys/dev/ofw/ofw_iicbus.c Tue Nov 22 21:53:19 2011 (r227847) +++ head/sys/dev/ofw/ofw_iicbus.c Tue Nov 22 21:55:40 2011 (r227848) @@ -68,7 +68,7 @@ static device_method_t ofw_iicbus_method DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - KOBJMETHOD_END + DEVMETHOD_END }; struct ofw_iicbus_devinfo { Modified: head/sys/dev/siba/siba.c == --- head/sys/dev/siba/siba.cTue Nov 22 21:53:19 2011(r227847) +++ head/sys/dev/siba/siba.cTue Nov 22 21:55:40 2011(r227848) @@ -632,7 +632,7 @@ static device_method_t siba_methods[] = DEVMETHOD(bus_teardown_intr,bus_generic_teardown_intr), DEVMETHOD(bus_write_ivar, siba_write_ivar), - KOBJMETHOD_END + DEVMETHOD_END }; static driver_t siba_driver = { Modified: head/sys/dev/siba/siba_bwn.c == --- head/sys/dev/siba/siba_bwn.cTue Nov 22 21:53:19 2011 (r227847) +++ head/sys/dev/siba/siba_bwn.cTue Nov 22 21:55:40 2011 (r227848) @@ -410,7 +410,7 @@ stati
svn commit: r227849 - in head/sys: arm/econa arm/xscale/ixp425 dev/ahci dev/ata dev/gpio dev/mvs dev/ppbus dev/ppc dev/siba dev/siis dev/usb/controller kern mips/atheros mips/cavium/usb mips/rmi mi...
Author: hselasky Date: Tue Nov 22 21:56:55 2011 New Revision: 227849 URL: http://svn.freebsd.org/changeset/base/227849 Log: Rename device_delete_all_children() into device_delete_children(). Suggested by: jhb @ and marius @ MFC after:1 week Modified: head/sys/arm/econa/ehci_ebus.c head/sys/arm/econa/ohci_ec.c head/sys/arm/xscale/ixp425/avila_ata.c head/sys/dev/ahci/ahci.c head/sys/dev/ata/ata-disk.c head/sys/dev/ata/ata-pci.c head/sys/dev/gpio/gpiobus.c head/sys/dev/mvs/mvs_pci.c head/sys/dev/mvs/mvs_soc.c head/sys/dev/ppbus/ppbconf.c head/sys/dev/ppc/ppc.c head/sys/dev/siba/siba_core.c head/sys/dev/siis/siis.c head/sys/dev/usb/controller/at91dci_atmelarm.c head/sys/dev/usb/controller/atmegadci_atmelarm.c head/sys/dev/usb/controller/ehci_ixp4xx.c head/sys/dev/usb/controller/ehci_mv.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/musb_otg_atmelarm.c head/sys/dev/usb/controller/ohci_atmelarm.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/ohci_s3c24x0.c head/sys/dev/usb/controller/uhci_pci.c head/sys/dev/usb/controller/uss820dci_atmelarm.c head/sys/dev/usb/controller/xhci_pci.c head/sys/kern/subr_bus.c head/sys/mips/atheros/ar71xx_ehci.c head/sys/mips/atheros/ar71xx_ohci.c head/sys/mips/cavium/usb/octusb_octeon.c head/sys/mips/rmi/xls_ehci.c head/sys/mips/rt305x/rt305x_dotg.c head/sys/sys/bus.h Modified: head/sys/arm/econa/ehci_ebus.c == --- head/sys/arm/econa/ehci_ebus.c Tue Nov 22 21:55:40 2011 (r227848) +++ head/sys/arm/econa/ehci_ebus.c Tue Nov 22 21:56:55 2011 (r227849) @@ -235,7 +235,7 @@ ehci_ebus_detach(device_t self) device_delete_child(self, bdev); } /* during module unload there are lots of children leftover */ - device_delete_all_children(self); + device_delete_children(self); /* * disable interrupts that might have been switched on in Modified: head/sys/arm/econa/ohci_ec.c == --- head/sys/arm/econa/ohci_ec.cTue Nov 22 21:55:40 2011 (r227848) +++ head/sys/arm/econa/ohci_ec.cTue Nov 22 21:56:55 2011 (r227849) @@ -185,7 +185,7 @@ ohci_ec_detach(device_t dev) device_delete_child(dev, bdev); } /* during module unload there are lots of children leftover */ - device_delete_all_children(dev); + device_delete_children(dev); bus_space_write_4(sc->sc_ohci.sc_io_tag, sc->sc_ohci.sc_io_hdl, OHCI_CONTROL, 0); Modified: head/sys/arm/xscale/ixp425/avila_ata.c == --- head/sys/arm/xscale/ixp425/avila_ata.c Tue Nov 22 21:55:40 2011 (r227848) +++ head/sys/arm/xscale/ixp425/avila_ata.c Tue Nov 22 21:56:55 2011 (r227849) @@ -263,7 +263,7 @@ ata_avila_detach(device_t dev) /* XXX quiesce gpio? */ /* detach & delete all children */ - device_delete_all_children(dev); + device_delete_children(dev); bus_teardown_intr(dev, sc->sc_irq, sc->sc_ih); bus_release_resource(dev, SYS_RES_IRQ, sc->sc_rid, sc->sc_irq); Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cTue Nov 22 21:55:40 2011(r227848) +++ head/sys/dev/ahci/ahci.cTue Nov 22 21:56:55 2011(r227849) @@ -518,7 +518,7 @@ ahci_detach(device_t dev) int i; /* Detach & delete all children */ - device_delete_all_children(dev); + device_delete_children(dev); /* Free interrupts. */ for (i = 0; i < ctlr->numirqs; i++) { Modified: head/sys/dev/ata/ata-disk.c == --- head/sys/dev/ata/ata-disk.c Tue Nov 22 21:55:40 2011(r227848) +++ head/sys/dev/ata/ata-disk.c Tue Nov 22 21:56:55 2011(r227849) @@ -181,7 +181,7 @@ ad_detach(device_t dev) callout_drain(&atadev->spindown_timer); /* detach & delete all children */ -device_delete_all_children(dev); +device_delete_children(dev); /* destroy disk from the system so we don't get any further requests */ disk_destroy(adp->disk); Modified: head/sys/dev/ata/ata-pci.c == --- head/sys/dev/ata/ata-pci.c Tue Nov 22 21:55:40 2011(r227848) +++ head/sys/dev/ata/ata-pci.c Tue Nov 22 21:56:55 2011(r227849) @@ -138,7 +138,7 @@ ata_pci_detach(device_t dev) struct ata_pci_controller *ctlr = device_get_softc(dev); /* detach & delete all children */ -device_delete_all_children(dev); +device_delete_children(dev); if (ctlr->r_irq) { bus_teardown_intr
Re: svn commit: r227797 - head/share/mk
On 2011/11/22, at 21:33, Dag-Erling Smørgrav wrote: > Rui Paulo writes: >> With this change, I can no longer update a FreeBSD 9.0-current system >> from June 2010 to FreeBSD 10.0. I suspect I'm not the only one. > > Sorry, my mind reader is broken at the moment, so you'll have to provide > more information than that. If I had more information, I would have provided it. I'm still diagnosing the problem someone else created. Regards, -- Rui Paulo ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227797 - head/share/mk
2011/11/22 Rui Paulo : > On 2011/11/22, at 21:33, Dag-Erling Smørgrav wrote: > >> Rui Paulo writes: >>> With this change, I can no longer update a FreeBSD 9.0-current system >>> from June 2010 to FreeBSD 10.0. I suspect I'm not the only one. >> >> Sorry, my mind reader is broken at the moment, so you'll have to provide >> more information than that. > > > If I had more information, I would have provided it. I'm still diagnosing the > problem someone else created. That is to say ... "take a machine running 9-current from june 2010 which has no issues. Fetch a HEAD source tree and try the usual buildworld process, and watch it explode." Right? -Ben ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227797 - head/share/mk
On 11/22/2011 2:26 PM, Ben Kaduk wrote: > 2011/11/22 Rui Paulo : >> On 2011/11/22, at 21:33, Dag-Erling Smørgrav wrote: >> >>> Rui Paulo writes: With this change, I can no longer update a FreeBSD 9.0-current system from June 2010 to FreeBSD 10.0. I suspect I'm not the only one. >>> >>> Sorry, my mind reader is broken at the moment, so you'll have to provide >>> more information than that. >> >> >> If I had more information, I would have provided it. I'm still diagnosing >> the problem someone else created. > > That is to say ... "take a machine running 9-current from june 2010 > which has no issues. Fetch a HEAD source tree and try the usual > buildworld process, and watch it explode." > Right? I'm not sure that's an interesting test case, since we don't "Officially" support major version upgrades other than from the latest -stable version of the branch immediately before the one you're trying to upgrade to. IOW, the interesting question is, does it work if you upgrade to stable/9 first? Doug -- "We could put the whole Internet into a book." "Too practical." Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227850 - head/sys/dev/re
Author: yongari Date: Tue Nov 22 23:19:49 2011 New Revision: 227850 URL: http://svn.freebsd.org/changeset/base/227850 Log: Writing access to RL_CFG5 register also requires EEPROM write access. While I'm here, enable WOL through magic packet but disable waking up system via unicast, multicast and broadcast frames. Otherwise, multicast or unicast frame(e.g. ICMP echo request) can wake up system which is not probably wanted behavior on most environments. This was not known as problem because RL_CFG5 register access had not effect until this change. The capability to wake up system with unicast/multicast frames are still set in driver, default off, so users who need that feature can still activate it with ifconfig(8). Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c == --- head/sys/dev/re/if_re.c Tue Nov 22 21:56:55 2011(r227849) +++ head/sys/dev/re/if_re.c Tue Nov 22 23:19:49 2011(r227850) @@ -1590,6 +1590,7 @@ re_attach(device_t dev) if (pci_find_cap(sc->rl_dev, PCIY_PMG, ®) == 0) ifp->if_capabilities |= IFCAP_WOL; ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST); /* * Don't enable TSO by default. It is known to generate * corrupted TCP segments(bad TCP options) under certain @@ -3622,12 +3623,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG3_WOL_MAGIC; CSR_WRITE_1(sc, RL_CFG3, v); - /* Config register write done. */ - CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - v = CSR_READ_1(sc, RL_CFG5); - v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); - v &= ~RL_CFG5_WOL_LANWAKE; + v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST | + RL_CFG5_WOL_LANWAKE); if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) v |= RL_CFG5_WOL_UCAST; if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) @@ -3636,6 +3634,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG5_WOL_LANWAKE; CSR_WRITE_1(sc, RL_CFG5, v); + /* Config register write done. */ + CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); + if ((ifp->if_capenable & IFCAP_WOL) != 0 && (sc->rl_flags & RL_FLAG_PHYWAKE_PM) != 0) CSR_WRITE_1(sc, RL_PMCH, CSR_READ_1(sc, RL_PMCH) & ~0x80); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227851 - head/sys/dev/re
Author: yongari Date: Tue Nov 22 23:27:59 2011 New Revision: 227851 URL: http://svn.freebsd.org/changeset/base/227851 Log: Perform media change after setting IFF_DRV_RUNNING flag. Without it, driver would ignore the first link state update if controller already established a link such that it would have to take additional link state handling in re_tick(). Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c == --- head/sys/dev/re/if_re.c Tue Nov 22 23:19:49 2011(r227850) +++ head/sys/dev/re/if_re.c Tue Nov 22 23:27:59 2011(r227851) @@ -3194,14 +3194,14 @@ re_init_locked(struct rl_softc *sc) if (sc->rl_testmode) return; - mii_mediachg(mii); - CSR_WRITE_1(sc, RL_CFG1, CSR_READ_1(sc, RL_CFG1) | RL_CFG1_DRVLOAD); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->rl_flags &= ~RL_FLAG_LINK; + mii_mediachg(mii); + sc->rl_watchdog_timer = 0; callout_reset(&sc->rl_stat_callout, hz, re_tick, sc); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227797 - head/share/mk
On Tue, Nov 22, 2011 at 3:15 PM, Doug Barton wrote: > On 11/22/2011 2:26 PM, Ben Kaduk wrote: >> 2011/11/22 Rui Paulo : >>> On 2011/11/22, at 21:33, Dag-Erling Smørgrav wrote: >>> Rui Paulo writes: > With this change, I can no longer update a FreeBSD 9.0-current system > from June 2010 to FreeBSD 10.0. I suspect I'm not the only one. Sorry, my mind reader is broken at the moment, so you'll have to provide more information than that. >>> >>> >>> If I had more information, I would have provided it. I'm still diagnosing >>> the problem someone else created. >> >> That is to say ... "take a machine running 9-current from june 2010 >> which has no issues. Fetch a HEAD source tree and try the usual >> buildworld process, and watch it explode." >> Right? > > I'm not sure that's an interesting test case, since we don't > "Officially" support major version upgrades other than from the latest > -stable version of the branch immediately before the one you're trying > to upgrade to. IOW, the interesting question is, does it work if you > upgrade to stable/9 first? > Rui said he was researching why. However.. the first thing I noticed was this commit *adds* a .c.o: rule in bsd.lib.mk, which replaces the default in sys.mk. The one in sys.mk has ctfconvert rules and the new one does not. At face value, this alone looks suspicious. -- Peter Wemm - pe...@wemm.org; pe...@freebsd.org; pe...@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227852 - head/lib/libc/gen
Author: jilles Date: Tue Nov 22 23:46:56 2011 New Revision: 227852 URL: http://svn.freebsd.org/changeset/base/227852 Log: fdopendir(): Do not close the passed file descriptor on failure. Reviewed by: delphij Modified: head/lib/libc/gen/opendir.c Modified: head/lib/libc/gen/opendir.c == --- head/lib/libc/gen/opendir.c Tue Nov 22 23:27:59 2011(r227851) +++ head/lib/libc/gen/opendir.c Tue Nov 22 23:46:56 2011(r227852) @@ -75,6 +75,8 @@ __opendir2(const char *name, int flags) { int fd; struct stat statb; + DIR *dir; + int saved_errno; /* * stat() before _open() because opening of special files may be @@ -89,7 +91,13 @@ __opendir2(const char *name, int flags) if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY)) == -1) return (NULL); - return __opendir_common(fd, name, flags); + dir = __opendir_common(fd, name, flags); + if (dir == NULL) { + saved_errno = errno; + _close(fd); + errno = saved_errno; + } + return (dir); } static int @@ -110,6 +118,7 @@ __opendir_common(int fd, const char *nam int incr; int saved_errno; int unionstack; + int fd2; struct stat statb; dirp = NULL; @@ -199,14 +208,15 @@ __opendir_common(int fd, const char *nam * which has also been read -- see fts.c. */ if (flags & DTF_REWIND) { - (void)_close(fd); - if ((fd = _open(name, O_RDONLY | O_DIRECTORY)) == -1) { + if ((fd2 = _open(name, O_RDONLY | O_DIRECTORY)) == -1) { saved_errno = errno; free(buf); free(dirp); errno = saved_errno; return (NULL); } + (void)_dup2(fd2, fd); + _close(fd2); } /* @@ -309,7 +319,6 @@ __opendir_common(int fd, const char *nam fail: saved_errno = errno; free(dirp); - (void)_close(fd); errno = saved_errno; return (NULL); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On Tue, Nov 22, 2011 at 12:27 PM, David Schultz wrote: > On Tue, Nov 22, 2011, Eitan Adler wrote: >> The problem with profiling this type of change is that it is hard to >> find a good representative benchmark. I could easily write code that >> will show you that adding the equality check is a good idea or that it >> is a horrible idea. IMHO it saves enough time when they are equal, but >> loses almost no time when the strings are not equal. > > Benchmark or not, I think you'll have a very hard time finding a > single real program that routinely calls strcasecmp() with > identical pointers! At this point I'd like to mention ministat(1). What you do is generate a series of timed runs, both with and without a given change. Record the times in two files. Then have ministat show you an analysis to give you an overview to show if you are really onto something or if you're just messing around in statistical noise. ministat(1) is far from the last word, but it gives valuable clues whenever somebody wants to talk about an "optimization". -- Peter Wemm - pe...@wemm.org; pe...@freebsd.org; pe...@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r227812 - head/lib/libc/string
On Tue, Nov 22, 2011 at 6:56 PM, Peter Wemm wrote: > On Tue, Nov 22, 2011 at 12:27 PM, David Schultz wrote: >> On Tue, Nov 22, 2011, Eitan Adler wrote: >>> The problem with profiling this type of change is that it is hard to >>> find a good representative benchmark. I could easily write code that >>> will show you that adding the equality check is a good idea or that it >>> is a horrible idea. IMHO it saves enough time when they are equal, but >>> loses almost no time when the strings are not equal. >> >> Benchmark or not, I think you'll have a very hard time finding a >> single real program that routinely calls strcasecmp() with >> identical pointers! > > At this point I'd like to mention ministat(1). I know how to use ministat ;) The problem is that I could, with some effort, write a program which will show that this change is significant, and a second program which shows you this change is not. The issue here is find a good representative benchmark upon which to use ministat. I was unable to find any "standard" string manipulation benchmark to test. When I first thought of this change I (a) asked people on C mailing lists and IRC channels (b) looked to see if anyone else did it (glibc does, netbsd and avr-libc don't). In either case I should have posted the patch to -hackers prior to committing. -- Eitan Adler Ports committer X11, Bugbusting teams ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r227854 - head/sys/dev/re
Author: yongari Date: Wed Nov 23 02:08:05 2011 New Revision: 227854 URL: http://svn.freebsd.org/changeset/base/227854 Log: Disable accepting frames in re_stop() to put RX MAC into idle state. Because there is no reliable way to know whether RX MAC is in stopped state, rejecting all frames would be the only way to minimize possible races. Otherwise it's possible to receive frames while stop command execution is in progress and controller can DMA the frame to freed RX buffer during that period. This was observed on recent PCIe controllers(i.e. RTL8111F). While this change may not be required on old controllers it wouldn't make negative effects on old controllers. One side effect of this change is disabling receive so driver reprograms RL_RXCFG to receive WOL frames when it is put into suspend or shutdown. This should address occasional 'memory modified free' errors seen on recent RealTek controllers. Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c == --- head/sys/dev/re/if_re.c Wed Nov 23 00:01:45 2011(r227853) +++ head/sys/dev/re/if_re.c Wed Nov 23 02:08:05 2011(r227854) @@ -3456,6 +3456,16 @@ re_stop(struct rl_softc *sc) callout_stop(&sc->rl_stat_callout); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + /* +* Disable accepting frames to put RX MAC into idle state. +* Otherwise it's possible to get frames while stop command +* execution is in progress and controller can DMA the frame +* to already freed RX buffer during that period. +*/ + CSR_WRITE_4(sc, RL_RXCFG, CSR_READ_4(sc, RL_RXCFG) & + ~(RL_RXCFG_RX_ALLPHYS | RL_RXCFG_RX_INDIV | RL_RXCFG_RX_MULTI | + RL_RXCFG_RX_BROAD)); + if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_STOPREQ | RL_CMD_TX_ENB | RL_CMD_RX_ENB); @@ -3604,9 +3614,11 @@ re_setwol(struct rl_softc *sc) CSR_WRITE_1(sc, RL_GPIO, CSR_READ_1(sc, RL_GPIO) & ~0x01); } - if ((ifp->if_capenable & IFCAP_WOL) != 0 && - (sc->rl_flags & RL_FLAG_WOLRXENB) != 0) - CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + if ((ifp->if_capenable & IFCAP_WOL) != 0) { + re_set_rxmode(sc); + if ((sc->rl_flags & RL_FLAG_WOLRXENB) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + } /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"