svn commit: r223927 - in head/sys: conf dev/rt

2011-07-11 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul 11 08:23:59 2011
New Revision: 223927
URL: http://svn.freebsd.org/changeset/base/223927

Log:
  Support of Ralink Ethernet MAC, used in RT3050F/RT3052F and I belive in other 
Ralink SoCs.
  
  Approved by: adrian (mentor)

Added:
  head/sys/dev/rt/
  head/sys/dev/rt/if_rt.c   (contents, props changed)
  head/sys/dev/rt/if_rtreg.h   (contents, props changed)
  head/sys/dev/rt/if_rtvar.h   (contents, props changed)
Modified:
  head/sys/conf/files.mips
  head/sys/conf/options.mips

Modified: head/sys/conf/files.mips
==
--- head/sys/conf/files.mipsMon Jul 11 05:57:49 2011(r223926)
+++ head/sys/conf/files.mipsMon Jul 11 08:23:59 2011(r223927)
@@ -106,4 +106,5 @@ dev/siba/siba_pcib.coptionalsiba pci
 dev/hwpmc/hwpmc_mips.c optional hwpmc
 dev/hwpmc/hwpmc_mips24k.c  optional hwpmc
 
+dev/rt/if_rt.c optionalrt
 dev/nvram2env/nvram2env.c  optionalnvram2env

Modified: head/sys/conf/options.mips
==
--- head/sys/conf/options.mips  Mon Jul 11 05:57:49 2011(r223926)
+++ head/sys/conf/options.mips  Mon Jul 11 08:23:59 2011(r223927)
@@ -70,3 +70,11 @@ OCTEON_BOARD_CAPK_0100ND opt_cvmx.h
 # Options that control the Atheros SoC peripherals
 #
 ARGE_DEBUG opt_global.h
+
+#
+# Options that control the Ralink RT305xF Etherenet MAC.
+#
+IF_RT_DEBUGopt_if_rt.h
+IF_RT_PHY_SUPPORT  opt_if_rt.h
+IF_RT_RING_DATA_COUNT  opt_if_rt.h
+

Added: head/sys/dev/rt/if_rt.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/rt/if_rt.c Mon Jul 11 08:23:59 2011(r223927)
@@ -0,0 +1,2616 @@
+/*-
+ * Copyright (c) 2011, Aleksandr Rybalko
+ * based on hard work
+ * by Alexander Egorenkov egore...@gmail.com
+ * and by Damien Bergamini damien.bergam...@free.fr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include if_rtvar.h
+#include if_rtreg.h
+
+#include net/if.h
+#include net/if_arp.h
+#include net/ethernet.h
+#include net/if_dl.h
+#include net/if_media.h
+#include net/if_types.h
+#include net/if_vlan_var.h
+
+#include net/bpf.h
+
+#include machine/bus.h
+#include machine/cache.h
+#include machine/cpufunc.h
+#include machine/resource.h
+#include vm/vm_param.h
+#include vm/vm.h
+#include vm/pmap.h
+#include machine/pmap.h
+#include sys/bus.h
+#include sys/rman.h
+
+#include dev/mii/mii.h
+#include dev/mii/miivar.h
+
+#include mips/rt305x/rt305x_sysctlvar.h
+#include mips/rt305x/rt305xreg.h
+
+#ifdef IF_RT_PHY_SUPPORT
+#include miibus_if.h
+#endif
+
+/*
+ * Defines and macros
+ */
+#defineRT_MAX_AGG_SIZE 3840
+
+#defineRT_TX_DATA_SEG0_SIZEMJUMPAGESIZE
+
+#defineRT_MS(_v, _f)   (((_v)  _f)  _f##_S)
+#defineRT_SM(_v, _f)   (((_v)  _f##_S)  _f)
+
+#defineRT_TX_WATCHDOG_TIMEOUT  5
+
+/*
+ * Static function prototypes
+ */
+static int rt_probe(device_t dev);
+static int rt_attach(device_t dev);
+static int rt_detach(device_t dev);
+static int rt_shutdown(device_t dev);
+static int rt_suspend(device_t dev);
+static int rt_resume(device_t dev);
+static voidrt_init_locked(void *priv);
+static voidrt_init(void *priv);
+static voidrt_stop_locked(void *priv);
+static voidrt_stop(void *priv);
+static void

svn commit: r223928 - head/usr.bin/calendar

2011-07-11 Thread Edwin Groothuis
Author: edwin
Date: Mon Jul 11 08:24:36 2011
New Revision: 223928
URL: http://svn.freebsd.org/changeset/base/223928

Log:
  Fix the interpreter for:
  
  Jul/Sat+3   Every third saturday of July - Jul/Sat+3
  
  which was able to be done via:
  
  Jul/SatThird  Every third saturday of July - Jul/SatThird
  
  Add interpreters for:
  
  SatFourth Every third saturday of each month - SatFourth
  Sat+4   Every third saturday of each month - Sat+4
  Sat   Every saturday of each month - Sat
  
  MFC after:2 weeks

Modified:
  head/usr.bin/calendar/parsedata.c

Modified: head/usr.bin/calendar/parsedata.c
==
--- head/usr.bin/calendar/parsedata.c   Mon Jul 11 08:23:59 2011
(r223927)
+++ head/usr.bin/calendar/parsedata.c   Mon Jul 11 08:24:36 2011
(r223928)
@@ -548,6 +548,24 @@ parsedaymonth(char *date, int *yearp, in
continue;
}
 
+   /* Every so-manied dayofweek of every month of the year */
+   if (lflags == (F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
+   offset = indextooffset(modifierindex);
+
+   for (m = 0; m  12; m++) {
+   dow = first_dayofweek_of_month(year, m);
+   d = (idayofweek - dow + 8) % 7;
+   d += (offset - 1) * 7;
+   if (remember_ymd(year, m, d)) {
+   remember(remindex,
+   yearp, monthp, dayp, edp,
+   year, m, d, NULL);
+   continue;
+   }
+   }
+   continue;
+   }
+
/* A certain dayofweek of a month */
if (lflags ==
(F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
@@ -918,6 +936,16 @@ indextooffset(char *s)
int i;
struct fixs *n;
 
+   if (s[0] == '+' || s[0] == '-') {
+   char ss[9];
+   for (i = -100; i  100; i++) {
+   sprintf(ss, %s%d, (i  0) ? + : , i);
+   if (strcmp(ss, s) == 0)
+   return (i);
+   }
+   return (0);
+   }
+
for (i = 0; i  6; i++) {
if (strcasecmp(s, sequences[i]) == 0) {
if (i == 5)
___
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: r223929 - head/sys/dev/rt

2011-07-11 Thread Aleksandr Rybalko
Author: ray
Date: Mon Jul 11 08:42:09 2011
New Revision: 223929
URL: http://svn.freebsd.org/changeset/base/223929

Log:
  Fix typo, lost 0 in SYSCTL_ADD_INT usage.

Modified:
  head/sys/dev/rt/if_rt.c

Modified: head/sys/dev/rt/if_rt.c
==
--- head/sys/dev/rt/if_rt.c Mon Jul 11 08:24:36 2011(r223928)
+++ head/sys/dev/rt/if_rt.c Mon Jul 11 08:42:09 2011(r223929)
@@ -2390,7 +2390,7 @@ rt_sysctl_attach(struct rt_softc *sc)
 
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO,
TXQ3_data_queued, CTLFLAG_RD, sc-tx_ring[3].data_queued,
-   Tx AC3 data queued);
+   0, Tx AC3 data queued);
 
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(stats), OID_AUTO,
TXQ2_desc_queued, CTLFLAG_RD, sc-tx_ring[2].desc_queued,
___
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: r223930 - head/sys/geom

2011-07-11 Thread Andrey V. Elsukov
Author: ae
Date: Mon Jul 11 10:02:27 2011
New Revision: 223930
URL: http://svn.freebsd.org/changeset/base/223930

Log:
  Remove include of sys/sbuf.h from geom/geom.h.
  sbuf support is not always required for geom/geom.h users, and no need to
  depend from it.
  
  PR:   kern/158398

Modified:
  head/sys/geom/geom.h

Modified: head/sys/geom/geom.h
==
--- head/sys/geom/geom.hMon Jul 11 08:42:09 2011(r223929)
+++ head/sys/geom/geom.hMon Jul 11 10:02:27 2011(r223930)
@@ -44,7 +44,6 @@
 #include sys/queue.h
 #include sys/ioccom.h
 #include sys/conf.h
-#include sys/sbuf.h
 #include sys/module.h
 
 struct g_class;
___
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: r223931 - head/usr.bin/ncal

2011-07-11 Thread Edwin Groothuis
Author: edwin
Date: Mon Jul 11 10:41:08 2011
New Revision: 223931
URL: http://svn.freebsd.org/changeset/base/223931

Log:
  ncal(1) highlights the current date (or a date provided via parameter)
  even if stdout is not a tty. If stdout is not a tty the data is
  normally processed by other tools and no control sequences are
  expected.
  
  PR:   bin/158580
  MFC after:1 week

Modified:
  head/usr.bin/ncal/ncal.1
  head/usr.bin/ncal/ncal.c

Modified: head/usr.bin/ncal/ncal.1
==
--- head/usr.bin/ncal/ncal.1Mon Jul 11 10:02:27 2011(r223930)
+++ head/usr.bin/ncal/ncal.1Mon Jul 11 10:41:08 2011(r223931)
@@ -171,6 +171,8 @@ that, two after that and the whole year.
 will warn about these combinations.
 .Pp
 A year starts on January 1.
+.P
+Highlighting of dates is disabled if stdout is not a tty.
 .Sh SEE ALSO
 .Xr calendar 3 ,
 .Xr strftime 3

Modified: head/usr.bin/ncal/ncal.c
==
--- head/usr.bin/ncal/ncal.cMon Jul 11 10:02:27 2011(r223930)
+++ head/usr.bin/ncal/ncal.cMon Jul 11 10:41:08 2011(r223931)
@@ -822,7 +822,8 @@ mkmonthr(int y, int m, int jd_flag, stru
dt.d = j - jan1 + 1;
else
sdater(j, dt);
-   if (j == highlightdate  !flag_nohighlight)
+   if (j == highlightdate  !flag_nohighlight
+ isatty(STDOUT_FILENO))
highlight(mlines-lines[i] + k,
ds + dt.d * dw, dw, l);
else
___
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: r223932 - head/usr.bin/ncal

2011-07-11 Thread Edwin Groothuis
Author: edwin
Date: Mon Jul 11 10:42:36 2011
New Revision: 223932
URL: http://svn.freebsd.org/changeset/base/223932

Log:
  Fix typo in order of markup and text.

Modified:
  head/usr.bin/ncal/ncal.1

Modified: head/usr.bin/ncal/ncal.1
==
--- head/usr.bin/ncal/ncal.1Mon Jul 11 10:41:08 2011(r223931)
+++ head/usr.bin/ncal/ncal.1Mon Jul 11 10:42:36 2011(r223932)
@@ -171,7 +171,7 @@ that, two after that and the whole year.
 will warn about these combinations.
 .Pp
 A year starts on January 1.
-.P
+.Pp
 Highlighting of dates is disabled if stdout is not a tty.
 .Sh SEE ALSO
 .Xr calendar 3 ,
___
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: r223933 - head/usr.sbin/bsnmpd/modules/snmp_hostres

2011-07-11 Thread Andrey V. Elsukov
Author: ae
Date: Mon Jul 11 12:51:35 2011
New Revision: 223933
URL: http://svn.freebsd.org/changeset/base/223933

Log:
  Use full buffer size in read(2) call, there is no need to preserve the
  last byte of the buffer.
  
  Since we call refresh_device_tbl() for any devctl event types - no need
  to check the first byte of buffer. Remove these checks.
  
  Also remove logging for the case of unknown devd message. It incorrectly
  triggers when all devctl events are not fit into one buffer and part of
  unread data will be read in the next pass.
  
  When length of data readed from devctl is equal to sizeof(buf), then try
  to read from socket again, to read full data.
  
  MFC after:2 weeks

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c  Mon Jul 
11 10:42:36 2011(r223932)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c  Mon Jul 
11 12:51:35 2011(r223933)
@@ -449,7 +449,8 @@ devd_socket_callback(int fd, void *arg _
 
HRDBG(called);
 
-   read_len = read(fd, buf, sizeof(buf) - 1);
+again:
+   read_len = read(fd, buf, sizeof(buf));
if (read_len  0) {
if (errno == EBADF) {
devd_sock = -1;
@@ -476,16 +477,9 @@ devd_socket_callback(int fd, void *arg _
syslog(LOG_ERR, Closing devd_fd, revert to devinfo polling);
 
} else {
-   switch (buf[0]) {
-   case '+':
-   case '-':
-   case '?':
-   case '!':
-   refresh_device_tbl(1);
-   return;
-   default:
-   syslog(LOG_ERR, unknown message from devd socket);
-   }
+   if (read_len == sizeof(buf))
+   goto again;
+   refresh_device_tbl(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


svn commit: r223935 - in head: contrib/xz contrib/xz/po contrib/xz/src/common contrib/xz/src/liblzma/api/lzma contrib/xz/src/liblzma/common contrib/xz/src/liblzma/delta contrib/xz/src/liblzma/lz co...

2011-07-11 Thread Martin Matuska
Author: mm
Date: Mon Jul 11 14:15:27 2011
New Revision: 223935
URL: http://svn.freebsd.org/changeset/base/223935

Log:
  Update xz to git snapshot of v5.0 branch as of 20110711 (post-5.0.3)
  
  For architectures with __NO_STRICT_ALIGNMENT
  define TUKLIB_FAST_UNALIGNED_ACCESS
  
  MFC after:2 weeks

Added:
  head/contrib/xz/po/fr.po
 - copied unchanged from r223934, vendor/xz/dist/po/fr.po
  head/contrib/xz/po/pl.po
 - copied unchanged from r223934, vendor/xz/dist/po/pl.po
Modified:
  head/contrib/xz/ChangeLog
  head/contrib/xz/FREEBSD-Xlist
  head/contrib/xz/FREEBSD-upgrade
  head/contrib/xz/THANKS
  head/contrib/xz/po/LINGUAS
  head/contrib/xz/po/it.po
  head/contrib/xz/src/common/tuklib_open_stdxxx.c
  head/contrib/xz/src/liblzma/api/lzma/block.h
  head/contrib/xz/src/liblzma/api/lzma/container.h
  head/contrib/xz/src/liblzma/api/lzma/filter.h
  head/contrib/xz/src/liblzma/api/lzma/version.h
  head/contrib/xz/src/liblzma/common/alone_decoder.c
  head/contrib/xz/src/liblzma/common/alone_encoder.c
  head/contrib/xz/src/liblzma/common/block_buffer_encoder.c
  head/contrib/xz/src/liblzma/common/block_encoder.c
  head/contrib/xz/src/liblzma/common/common.c
  head/contrib/xz/src/liblzma/common/common.h
  head/contrib/xz/src/liblzma/common/filter_common.c
  head/contrib/xz/src/liblzma/common/index.c
  head/contrib/xz/src/liblzma/common/index_decoder.c
  head/contrib/xz/src/liblzma/common/index_encoder.c
  head/contrib/xz/src/liblzma/common/stream_buffer_encoder.c
  head/contrib/xz/src/liblzma/common/stream_encoder.c
  head/contrib/xz/src/liblzma/delta/delta_encoder.c
  head/contrib/xz/src/liblzma/lz/lz_decoder.c
  head/contrib/xz/src/liblzma/lz/lz_encoder.c
  head/contrib/xz/src/liblzma/lz/lz_encoder_hash.h
  head/contrib/xz/src/liblzma/lzma/lzma2_decoder.c
  head/contrib/xz/src/liblzma/lzma/lzma2_encoder.c
  head/contrib/xz/src/liblzma/simple/arm.c
  head/contrib/xz/src/liblzma/simple/armthumb.c
  head/contrib/xz/src/liblzma/simple/ia64.c
  head/contrib/xz/src/liblzma/simple/powerpc.c
  head/contrib/xz/src/liblzma/simple/simple_coder.c
  head/contrib/xz/src/liblzma/simple/sparc.c
  head/contrib/xz/src/lzmainfo/lzmainfo.c
  head/contrib/xz/src/xz/coder.c
  head/contrib/xz/src/xz/file_io.c
  head/contrib/xz/src/xz/hardware.h
  head/contrib/xz/src/xz/list.c
  head/contrib/xz/src/xz/message.c
  head/contrib/xz/src/xz/message.h
  head/contrib/xz/src/xz/options.c
  head/contrib/xz/src/xz/signals.c
  head/contrib/xz/src/xz/suffix.c
  head/contrib/xz/src/xz/util.h
  head/contrib/xz/src/xz/xz.1
  head/contrib/xz/src/xzdec/xzdec.c
  head/lib/liblzma/config.h
Directory Properties:
  head/contrib/xz/   (props changed)

Modified: head/contrib/xz/ChangeLog
==
--- head/contrib/xz/ChangeLog   Mon Jul 11 13:10:34 2011(r223934)
+++ head/contrib/xz/ChangeLog   Mon Jul 11 14:15:27 2011(r223935)
@@ -1,3 +1,328 @@
+commit edf339227a966f24aebe1845fcca9429b8f6e318
+Author: Anders F Bjorklund a...@users.sourceforge.net
+Date:   Fri Nov 5 12:56:11 2010 +0100
+
+add build script for macosx universal
+
+commit 7fcc6334ea8923550ba6b5347ff99dc8432234b0
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Thu Jun 16 12:15:29 2011 +0300
+
+liblzma: Remove unneeded semicolon.
+
+commit 631f4d3ae6adfda84d1a110781d9402c12e16cfc
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Sat May 28 16:43:26 2011 +0300
+
+Don't call close(-1) in tuklib_open_stdxxx() on error.
+
+Thanks to Jim Meyering.
+
+commit c89faf4c9e5970e7f7f8a25521ed9aa62d1a2d9a
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Sat May 28 09:47:56 2011 +0300
+
+Translations: Update Italian translation.
+
+Thanks to Milo Casagrande.
+
+commit 6fe2fc9b6ab5bf6848140823e9536370834f42fb
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Sat May 28 08:46:04 2011 +0300
+
+Tests: Add a test file for the bug in the previous commit.
+
+commit 6c4d4db2bc8d8b682bd927144d37daa2ab21a6d6
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Fri May 27 22:25:44 2011 +0300
+
+xz: Fix error handling in xz -lvv.
+
+It could do an invalid free() and read past the end
+of the uninitialized filters array.
+
+commit 844f84fcad9670c543550edf7c7e42630c8f7715
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Fri May 27 22:09:49 2011 +0300
+
+liblzma: Handle allocation failures correctly in lzma_index_init().
+
+Thanks to Jim Meyering.
+
+commit 240e8b9791df597063a3b68d04ffcb3aa4f2de6a
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Mon May 23 18:30:30 2011 +0300
+
+Build: Set GZIP_ENV=-9n in top-level Makefile.am.
+
+commit e32cb264ea72a4459810f30abad70dae5a4fa17d
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Sat May 21 16:59:22 2011 +0300
+
+Bump version and soname for 5.0.3.
+
+commit 65cff45f8fd1c250491557157cce0f5f38481082
+Author: Lasse Collin lasse.col...@tukaani.org
+Date:   Sat

Re: svn commit: r223928 - head/usr.bin/calendar

2011-07-11 Thread John Baldwin
On Monday, July 11, 2011 4:24:36 am Edwin Groothuis wrote:
 Author: edwin
 Date: Mon Jul 11 08:24:36 2011
 New Revision: 223928
 URL: http://svn.freebsd.org/changeset/base/223928
 
 Log:
   Fix the interpreter for:
   
   Jul/Sat+3   Every third saturday of July - Jul/Sat+3
   
   which was able to be done via:
   
   Jul/SatThirdEvery third saturday of July - Jul/SatThird
   
   Add interpreters for:
   
   SatFourth   Every third saturday of each month - SatFourth
   Sat+4   Every third saturday of each month - Sat+4
   Sat Every saturday of each month - Sat
   
   MFC after:  2 weeks
 
 Modified:
   head/usr.bin/calendar/parsedata.c
 
 Modified: head/usr.bin/calendar/parsedata.c
 ==
 --- head/usr.bin/calendar/parsedata.c Mon Jul 11 08:23:59 2011
 (r223927)
 +++ head/usr.bin/calendar/parsedata.c Mon Jul 11 08:24:36 2011
 (r223928)
 @@ -548,6 +548,24 @@ parsedaymonth(char *date, int *yearp, in
 @@ -918,6 +936,16 @@ indextooffset(char *s)
   int i;
   struct fixs *n;
  
 + if (s[0] == '+' || s[0] == '-') {
 + char ss[9];
 + for (i = -100; i  100; i++) {
 + sprintf(ss, %s%d, (i  0) ? + : , i);
 + if (strcmp(ss, s) == 0)
 + return (i);
 + }
 + return (0);
 + }
 +

Hmm, did you consider using something like strtol instead?

-- 
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: r223936 - in head: contrib/top usr.bin/top

2011-07-11 Thread John Baldwin
Author: jhb
Date: Mon Jul 11 16:48:52 2011
New Revision: 223936
URL: http://svn.freebsd.org/changeset/base/223936

Log:
  Allow per-CPU statistics to be toggled at runtime via the 'P' key.
  While here, make -P a toggle similar to other options such as -I.
  
  Reviewed by:  arundel
  MFC after:1 week

Modified:
  head/contrib/top/commands.c
  head/contrib/top/display.c
  head/contrib/top/top.X
  head/contrib/top/top.c
  head/usr.bin/top/machine.c

Modified: head/contrib/top/commands.c
==
--- head/contrib/top/commands.c Mon Jul 11 14:15:27 2011(r223935)
+++ head/contrib/top/commands.c Mon Jul 11 16:48:52 2011(r223936)
@@ -88,6 +88,7 @@ o   - specify sort order (vcsw, ivcs
stdout);
 #endif
fputs(\
+P   - toggle the displaying of per-CPU statistics\n\
 r   - renice a process\n\
 s   - change number of seconds to delay between updates\n\
 S   - toggle the displaying of system processes\n\

Modified: head/contrib/top/display.c
==
--- head/contrib/top/display.c  Mon Jul 11 14:15:27 2011(r223935)
+++ head/contrib/top/display.c  Mon Jul 11 16:48:52 2011(r223936)
@@ -151,16 +151,14 @@ int display_resize()
 return(smart_terminal ? lines : Largest);
 }
 
-int display_init(statics)
+int display_updatecpus(statics)
 
 struct statics *statics;
 
 {
 register int lines;
-register char **pp;
-register int *ip;
 register int i;
-
+
 /* call resize to do the dirty work */
 lines = display_resize();
 num_cpus = statics-ncpus;
@@ -170,6 +168,21 @@ struct statics *statics;
 for (i = num_cpus; i  9; i /= 10)
cpustates_column++;
 
+return(lines);
+}
+
+int display_init(statics)
+
+struct statics *statics;
+
+{
+register int lines;
+register char **pp;
+register int *ip;
+register int i;
+
+lines = display_updatecpus(statics);
+
 /* only do the rest if we need to */
 if (lines  -1)
 {

Modified: head/contrib/top/top.X
==
--- head/contrib/top/top.X  Mon Jul 11 14:15:27 2011(r223935)
+++ head/contrib/top/top.X  Mon Jul 11 16:48:52 2011(r223936)
@@ -205,6 +205,7 @@ The options
 .BR \-H ,
 .BR \-I ,
 .BR \-j ,
+.BR \-P ,
 .BR \-S ,
 .BR \-t ,
 .BR \-u ,
@@ -314,6 +315,9 @@ Toggle the display of
 .IR jail (8)
 ID.
 .TP
+.B P
+Toggle the display of per-CPU statistics.
+.TP
 .B t
 Toggle the display of the
 .I top

Modified: head/contrib/top/top.c
==
--- head/contrib/top/top.c  Mon Jul 11 14:15:27 2011(r223935)
+++ head/contrib/top/top.c  Mon Jul 11 16:48:52 2011(r223936)
@@ -196,9 +196,9 @@ char *argv[];
 fd_set readfds;
 
 #ifdef ORDER
-static char command_chars[] = \f qh?en#sdkriIutHmSCajzo;
+static char command_chars[] = \f qh?en#sdkriIutHmSCajzPo;
 #else
-static char command_chars[] = \f qh?en#sdkriIutHmSCajz;
+static char command_chars[] = \f qh?en#sdkriIutHmSCajzP;
 #endif
 /* these defines enumerate the strchrs of the commands in command_chars */
 #define CMD_redraw 0
@@ -225,8 +225,9 @@ char *argv[];
 #defineCMD_showargs20
 #defineCMD_jidtog  21
 #define CMD_kidletog   22
+#define CMD_pcputog23
 #ifdef ORDER
-#define CMD_order   23
+#define CMD_order   24
 #endif
 
 /* set the buffer for stdout */
@@ -411,7 +412,7 @@ char *argv[];
break;
 
  case 'P':
-   pcpu_stats = Yes;
+   pcpu_stats = !pcpu_stats;
break;
 
  case 'z':
@@ -1088,6 +1089,16 @@ restart:
ps.kidle ? D : Not d);
putchar('\r');
break;
+   case CMD_pcputog:
+   pcpu_stats = !pcpu_stats;
+   new_message(MT_standout | MT_delayed,
+Displaying %sCPU statistics.,
+   pcpu_stats ? per- : global );
+   toggle_pcpustats(statics);
+   max_topn = display_updatecpus(statics);
+   reset_display();
+   putchar('\r');
+   break;
default:
new_message(MT_standout,  BAD CASE IN 
SWITCH!);
putchar('\r');

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Mon Jul 11 14:15:27 2011(r223935)
+++ head/usr.bin/top/machine.c  Mon Jul 11 16:48:52 2011

svn commit: r223937 - head/contrib/top

2011-07-11 Thread John Baldwin
Author: jhb
Date: Mon Jul 11 16:51:29 2011
New Revision: 223937
URL: http://svn.freebsd.org/changeset/base/223937

Log:
  Add a leading space to the status messages output after toggling the
  'C' and 'H' flags at runtime.  This matches messages output for other
  toggles which leave the first column in the message blank to hold the
  cursor.
  
  PR:   bin/158775
  Submitted by: arundel
  MFC after:3 days

Modified:
  head/contrib/top/top.c

Modified: head/contrib/top/top.c
==
--- head/contrib/top/top.c  Mon Jul 11 16:48:52 2011(r223936)
+++ head/contrib/top/top.c  Mon Jul 11 16:51:29 2011(r223937)
@@ -1020,7 +1020,7 @@ restart:
case CMD_thrtog:
ps.thread = !ps.thread;
new_message(MT_standout | MT_delayed,
-   Displaying threads %s,
+Displaying threads %s,
ps.thread ? separately : as a count);
header_text = format_header(uname_field);
reset_display();
@@ -1029,7 +1029,7 @@ restart:
case CMD_wcputog:
ps.wcpu = !ps.wcpu;
new_message(MT_standout | MT_delayed,
-   Displaying %sCPU,
+Displaying %sCPU,
ps.wcpu ? W : );
header_text = format_header(uname_field);
reset_display();
___
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: r223938 - head/sys/boot/common

2011-07-11 Thread Marius Strobl
Author: marius
Date: Mon Jul 11 20:43:59 2011
New Revision: 223938
URL: http://svn.freebsd.org/changeset/base/223938

Log:
  Since r219452 the alignment of __dmadat has changed, revealing that fsread()
  bogusly casts its contents around causing alignment faults on sparc64 and
  most likely also on at least powerpc. Fix this by copying the contents
  bytewise instead as partly already done here. Solving this the right way
  costs some space, i.e. 148 bytes with GCC and 16 bytes with clang on x86
  there are still some bytes left there though, and an acceptable hack which
  tricks the compiler into only using a 2-byte alignment instead of the native
  one when accessing the contents turned out to even take up more space that.

Modified:
  head/sys/boot/common/ufsread.c

Modified: head/sys/boot/common/ufsread.c
==
--- head/sys/boot/common/ufsread.c  Mon Jul 11 16:51:29 2011
(r223937)
+++ head/sys/boot/common/ufsread.c  Mon Jul 11 20:43:59 2011
(r223938)
@@ -49,6 +49,7 @@ __FBSDID($FreeBSD$);
 #include ufs/ufs/dinode.h
 #include ufs/ufs/dir.h
 #include ufs/ffs/fs.h
+
 #ifdef UFS_SMALL_CGBASE
 /* XXX: Revert to old (broken for over 1.5Tb filesystems) version of cgbase
(see sys/ufs/ffs/fs.h rev 1.39) so that small boot loaders (e.g. boot2) can
@@ -90,7 +91,7 @@ static ssize_t fsread(ino_t, void *, siz
 static uint8_t ls, dsk_meta;
 static uint32_t fs_off;
 
-static __inline int
+static __inline uint8_t
 fsfind(const char *name, ino_t * ino)
 {
char buf[DEV_BSIZE];
@@ -158,7 +159,7 @@ static int sblock_try[] = SBLOCKSEARCH;
 #elif defined(UFS1_ONLY)
 #define DIP(field) dp1.field
 #else
-#define DIP(field) fs-fs_magic == FS_UFS1_MAGIC ? dp1.field : dp2.field
+#define DIP(field) fs.fs_magic == FS_UFS1_MAGIC ? dp1.field : dp2.field
 #endif
 
 static ssize_t
@@ -173,7 +174,7 @@ fsread(ino_t inode, void *buf, size_t nb
static ino_t inomap;
char *blkbuf;
void *indbuf;
-   struct fs *fs;
+   struct fs fs;
char *s;
size_t n, nb, size, off, vboff;
ufs_lbn_t lbn;
@@ -181,30 +182,29 @@ fsread(ino_t inode, void *buf, size_t nb
static ufs2_daddr_t blkmap, indmap;
u_int u;
 
-
blkbuf = dmadat-blkbuf;
indbuf = dmadat-indbuf;
-   fs = (struct fs *)dmadat-sbbuf;
if (!dsk_meta) {
inomap = 0;
for (n = 0; sblock_try[n] != -1; n++) {
-   if (dskread(fs, sblock_try[n] / DEV_BSIZE,
+   if (dskread(dmadat-sbbuf, sblock_try[n] / DEV_BSIZE,
SBLOCKSIZE / DEV_BSIZE))
return -1;
+   memcpy(fs, dmadat-sbbuf, sizeof(struct fs));
if ((
 #if defined(UFS1_ONLY)
-fs-fs_magic == FS_UFS1_MAGIC
+   fs.fs_magic == FS_UFS1_MAGIC
 #elif defined(UFS2_ONLY)
-   (fs-fs_magic == FS_UFS2_MAGIC 
-   fs-fs_sblockloc == sblock_try[n])
+   (fs.fs_magic == FS_UFS2_MAGIC 
+   fs.fs_sblockloc == sblock_try[n])
 #else
-fs-fs_magic == FS_UFS1_MAGIC ||
-   (fs-fs_magic == FS_UFS2_MAGIC 
-   fs-fs_sblockloc == sblock_try[n])
+   fs.fs_magic == FS_UFS1_MAGIC ||
+   (fs.fs_magic == FS_UFS2_MAGIC 
+   fs.fs_sblockloc == sblock_try[n])
 #endif
) 
-   fs-fs_bsize = MAXBSIZE 
-   fs-fs_bsize = sizeof(struct fs))
+   fs.fs_bsize = MAXBSIZE 
+   fs.fs_bsize = sizeof(struct fs))
break;
}
if (sblock_try[n] == -1) {
@@ -212,12 +212,13 @@ fsread(ino_t inode, void *buf, size_t nb
return -1;
}
dsk_meta++;
-   }
+   } else
+   memcpy(fs, dmadat-sbbuf, sizeof(struct fs));
if (!inode)
return 0;
if (inomap != inode) {
-   n = IPERVBLK(fs);
-   if (dskread(blkbuf, INO_TO_VBA(fs, n, inode), DBPERVBLK))
+   n = IPERVBLK(fs);
+   if (dskread(blkbuf, INO_TO_VBA(fs, n, inode), DBPERVBLK))
return -1;
n = INO_TO_VBO(n, inode);
 #if defined(UFS1_ONLY)
@@ -227,13 +228,12 @@ fsread(ino_t inode, void *buf, size_t nb
memcpy(dp2, (struct ufs2_dinode *)blkbuf + n,
sizeof(struct ufs2_dinode));
 #else
-   if (fs-fs_magic == FS_UFS1_MAGIC)
+   if (fs.fs_magic == FS_UFS1_MAGIC)
memcpy(dp1, (struct ufs1_dinode *)blkbuf + n,
sizeof(struct 

svn commit: r223939 - head/usr.bin/calendar

2011-07-11 Thread Edwin Groothuis
Author: edwin
Date: Mon Jul 11 22:01:39 2011
New Revision: 223939
URL: http://svn.freebsd.org/changeset/base/223939

Log:
  Fix run-time breakage when encoutering invalid input-data.
  
  PR:   bin/157718

Modified:
  head/usr.bin/calendar/parsedata.c

Modified: head/usr.bin/calendar/parsedata.c
==
--- head/usr.bin/calendar/parsedata.c   Mon Jul 11 20:43:59 2011
(r223938)
+++ head/usr.bin/calendar/parsedata.c   Mon Jul 11 22:01:39 2011
(r223939)
@@ -818,6 +818,8 @@ showflags(int flags)
 static const char *
 getmonthname(int i)
 {
+   if (i = 0 || i  12)
+   return ();
if (nmonths[i - 1].len != 0  nmonths[i - 1].name != NULL)
return (nmonths[i - 1].name);
return (months[i - 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: r223931 - head/usr.bin/ncal

2011-07-11 Thread Pan Tsu
Edwin Groothuis ed...@freebsd.org writes:

 Author: edwin
 Date: Mon Jul 11 10:41:08 2011
 New Revision: 223931
 URL: http://svn.freebsd.org/changeset/base/223931

 Log:
   ncal(1) highlights the current date (or a date provided via parameter)
   even if stdout is not a tty. If stdout is not a tty the data is
   normally processed by other tools and no control sequences are
   expected.

   PR: bin/158580
   MFC after:  1 week

What about cal mode?

  $ cal | vis
   July 2011
  Su Mo Tu We Th Fr Sa
  1  2
   3  4  5  6  7  8  9
  10 _\^H1_\^H1 12 13 14 15 16
  17 18 19 20 21 22 23
  24 25 26 27 28 29 30
  31
___
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: r223917 - head/etc/rc.d

2011-07-11 Thread Doug Barton
On 07/11/2011 08:14, John Baldwin wrote:
 On Sunday, July 10, 2011 8:53:31 pm Doug Barton wrote:
 On 07/10/2011 17:42, Pan Tsu wrote:
 Doug Barton do...@freebsd.org writes:

 Doesn't /boot/support.4th already populates kern.module_path with
 the path of successfully booted kernel? How is this different?

 When you test it, what happens?
 
 If you do 'boot foo' at the loader prompt you get 
 /boot/foo;/boot/kernel;/boot/modules.

No, I don't actually, which was my point to Pan:

sysctl kern.bootfile
kern.bootfile: /boot/kernel.patched/kernel

sysctl kern.module_path
kern.module_path: /boot/kernel;/boot/modules;/usr/local/modules

That was after hitting 2. Escape to the loader prompt at the beastie
menu, and typing 'boot kernel.patched'. The fact that it did not work as
one might expect was the reason I wrote the code that I did.

 It is arguably broken that the old /boot/kernel is still in the list, but 
 that 
 bug should be fixed in the loader, not here.

I think that given the fact that we seem to have multiple broken
versions (as in, my version is broken one way, yours seems to be broken
a different way), it's hard for me to imagine removing the belt and
suspenders that I've already added. Not to mention the need to support
RELENG[78].

 However, I've never had a 
 problem with kldload doing the wrong thing when using 'boot foo'.  Do you 
 have 
 an actual use case that is broken?

I was initially hoping to avoid the gymnastics, but given that
module_path wasn't doing TRT I thought it safe to err on the side of
caution.

 Oh, and if you use 'nextboot -k foo' or set 'kernel=foo' in loader.conf then 
 it will DTRT.  However, I would expect this script to be equivalent to a for 
 loop of 'kldload foo', but now it isn't since you are using a divergent 
 algorithm.  That violates POLA IMO.

It's not clear to me how what I'm doing is different than what _should_
be happening. If you can spell that out to me I'd really appreciate it.


Doug

-- 

Nothin' ever doesn't change, but nothin' changes much.
-- OK Go

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: r223940 - head/usr.bin/wall

2011-07-11 Thread David E. O'Brien
Author: obrien
Date: Tue Jul 12 00:31:11 2011
New Revision: 223940
URL: http://svn.freebsd.org/changeset/base/223940

Log:
  If one's message is longer than the buffer size, then we reset 'cnt' at the
  wrong point and the actual column # get out of sync across the buffer size.

Modified:
  head/usr.bin/wall/wall.c

Modified: head/usr.bin/wall/wall.c
==
--- head/usr.bin/wall/wall.cMon Jul 11 22:01:39 2011(r223939)
+++ head/usr.bin/wall/wall.cTue Jul 12 00:31:11 2011(r223940)
@@ -239,8 +239,9 @@ makemsg(char *fname)
err(1, can't read %s, fname);
setegid(egid);
}
+   cnt = 0;
while (fgets(lbuf, sizeof(lbuf), stdin)) {
-   for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) {
+   for (p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) {
if (ch == '\r') {
putc('\r', fp);
cnt = 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