kdump -m 0
Hi, kdump -m 0 does not do what you'd expect. Fix that, and do not print for empty strings. -Otto Index: kdump.c === RCS file: /cvs/src/usr.bin/kdump/kdump.c,v retrieving revision 1.57 diff -u -p -r1.57 kdump.c --- kdump.c 9 Jul 2011 07:22:05 - 1.57 +++ kdump.c 9 Jul 2011 07:48:59 - @@ -63,7 +63,7 @@ #include kdump_subr.h #include extern.h -int timestamp, decimal, iohex, fancy = 1, tail, maxdata, resolv; +int timestamp, decimal, iohex, fancy = 1, tail, maxdata = INT_MAX, resolv; char *tracefile = DEF_TRACEFILE; struct ktr_header ktr_header; pid_t pid = -1; @@ -774,9 +774,9 @@ ktrgenio(struct ktr_genio *ktr, size_t l } printf(fd %d %s %zu bytes\n, ktr-ktr_fd, ktr-ktr_rw == UIO_READ ? read : wrote, datalen); - if (maxdata datalen maxdata) + if (datalen maxdata) datalen = maxdata; - if (iohex !datalen) + if (datalen == 0) return; if (iohex == 1) { putchar('\t');
-n lines support for syslogc(8)
I often find I want to see more than the default 10 lines of output with syslogc -f. This diff adds support for -n, like in tail. It works both with and without -f. e.g.: # syslogc -n 5 ospfd Jul 9 08:28:43 gr1-pl7 last message repeated 3 times Jul 9 08:29:18 gr1-pl7 ospfd[26625]: recv_packet: authentication error, interface em3 Jul 9 08:29:20 gr1-pl7 ospfd[13829]: reloading interface list and routing table Jul 9 08:29:35 gr1-pl7 last message repeated 7 times Jul 9 09:08:32 gr1-pl7 ospfd[13829]: reloading interface list and routing table Any comments? OK? Index: syslogc/syslogc.8 === RCS file: /cvs/src/usr.sbin/syslogc/syslogc.8,v retrieving revision 1.8 diff -u -p -r1.8 syslogc.8 --- syslogc/syslogc.8 10 Sep 2008 22:17:33 - 1.8 +++ syslogc/syslogc.8 9 Jul 2011 09:07:23 - @@ -48,7 +48,7 @@ option to .Pp By default, .Nm -will query the specified log and return it to standard output. +will query the specified log and return all entries to standard output. .Pp The options are as follows: .Bl -tag -width Ds @@ -57,11 +57,14 @@ Request that the log buffer be cleared w .It Fl c Request that the log buffer be cleared once it has been read. .It Fl f -Print out the last 10 lines and read from the buffer continuously. +Print out the last lines and read from the buffer continuously. Like the .Fl f option in .Xr tail 1 . +Defaults to 10 lines. +.It Fl n Ar lines +Print the specified number of lines from the buffer. .It Fl o Check whether the specified log has overflowed. If the log has overflowed, then a message will be printed to Index: syslogc/syslogc.c === RCS file: /cvs/src/usr.sbin/syslogc/syslogc.c,v retrieving revision 1.15 diff -u -p -r1.15 syslogc.c --- syslogc/syslogc.c 4 Jul 2011 20:23:09 - 1.15 +++ syslogc/syslogc.c 9 Jul 2011 09:07:23 - @@ -22,6 +22,7 @@ #include err.h #include stdio.h +#include stdint.h #include stdlib.h #include string.h #include unistd.h @@ -33,7 +34,7 @@ /* * Client protocol NB. all numeric fields in network byte order */ -#define CTL_VERSION1 +#define CTL_VERSION2 /* Request */ struct ctl_cmd { @@ -45,6 +46,7 @@ struct ctl_cmd { #define CMD_FLAGS 5 /* Query flags only */ #define CMD_READ_CONT 6 /* Read out log continuously */ u_int32_t cmd; + u_int32_t lines; charlogname[MAX_MEMBUF_NAME]; }; @@ -61,7 +63,8 @@ usage(void) { extern char *__progname; - fprintf(stderr, usage: %s [-Ccfo] [-s reporting_socket] logname\n + fprintf(stderr, + usage: %s [-Ccfo] [-n lines] [-s reporting_socket] logname\n %s -q\n, __progname, __progname); exit(1); } @@ -78,12 +81,13 @@ main(int argc, char **argv) extern int optind; struct ctl_cmd cc; struct ctl_reply_hdr rr; + const char *errstr; memset(cc, '\0', sizeof(cc)); ctlsock_path = DEFAULT_CTLSOCK; rval = oflag = 0; - while ((ch = getopt(argc, argv, Ccfhoqs:)) != -1) { + while ((ch = getopt(argc, argv, Ccfhon:qs:)) != -1) { switch (ch) { case 'C': cc.cmd = CMD_CLEAR; @@ -96,6 +100,12 @@ main(int argc, char **argv) break; case 'f': cc.cmd = CMD_READ_CONT; + break; + case 'n': + cc.lines = strtonum(optarg, 1, UINT32_MAX, errstr); + if (errstr) + errx(1, number of lines is %s: %s, + errstr, optarg); break; case 'o': cc.cmd = CMD_FLAGS; Index: syslogd/syslogd.c === RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v retrieving revision 1.103 diff -u -p -r1.103 syslogd.c --- syslogd/syslogd.c 27 Oct 2009 23:59:54 - 1.103 +++ syslogd/syslogd.c 9 Jul 2011 09:07:23 - @@ -207,7 +207,7 @@ int membuf_drop = 0;/* logs were droppe /* * Client protocol NB. all numeric fields in network byte order */ -#define CTL_VERSION1 +#define CTL_VERSION2 /* Request */ struct { @@ -219,6 +219,7 @@ struct { #define CMD_FLAGS 5 /* Query flags only */ #define CMD_READ_CONT 6 /* Read out log continuously */ u_int32_t cmd; + u_int32_t lines; charlogname[MAX_MEMBUF_NAME]; } ctl_cmd; @@ -1910,7 +1911,10 @@ ctlconn_read_handler(void) } if (ctl_cmd.cmd == CMD_READ_CONT) { f-f_un.f_mb.f_attached = 1; - tailify_replytext(reply_text, 10); +
Re: wcsdup
On Wed, 06 Jul 2011 18:03:18 +0200, Todd C. Miller wrote: On Tue, 05 Jul 2011 20:03:14 BST, Nicholas Marriott wrote: I think they would be better as separate pages but I'm not volunteering to do it, at least not right now ;-). FreeBSD and NetBSD look to have a few split out. Me neither :-) This would be a easy project for someone with a little bit of time on their hands. - todd Here is a diff for that. The new manual pages are based on their single-byte counterparts. Regards, Tim Index: Makefile.inc === RCS file: /cvs/src/lib/libc/string/Makefile.inc,v retrieving revision 1.26 diff -N -u Makefile.inc --- Makefile.inc4 Jul 2011 04:37:34 - 1.26 +++ Makefile.inc9 Jul 2011 11:05:09 - @@ -144,7 +144,9 @@ strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strerror.3 \ string.3 strlen.3 strmode.3 strdup.3 strpbrk.3 strrchr.3 strsep.3 \ strsignal.3 strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 strlcpy.3 \ - wcstok.3 wmemchr.3 wcswidth.3 wcsdup.3 + wcscasecmp.3 wcscat.3 wcschr.3 wcscmp.3 wcscpy.3 wcscspn.3 wcsdup.3 \ + wcslcpy.3 wcslen.3 wcspbrk.3 wcsrchr.3 wcsspn.3 wcsstr.3 wcstok.3 \ + wcswidth.3 wmemchr.3 wmemcmp.3 wmemcpy.3 wmemmove.3 wmemset.3 MLINKS+=bm.3 bm_comp.3 bm.3 bm_exec.3 bm.3 bm_free.3 MLINKS+=memchr.3 memrchr.3 @@ -160,25 +162,9 @@ MLINKS+=strstr.3 strcasestr.3 MLINKS+=strtok.3 strtok_r.3 MLINKS+=strerror.3 strerror_r.3 -MLINKS+=wmemchr.3 wmemcmp.3 -MLINKS+=wmemchr.3 wmemcpy.3 -MLINKS+=wmemchr.3 wmemmove.3 -MLINKS+=wmemchr.3 wmemset.3 -MLINKS+=wmemchr.3 wcscat.3 -MLINKS+=wmemchr.3 wcschr.3 -MLINKS+=wmemchr.3 wcscmp.3 -MLINKS+=wmemchr.3 wcscasecmp.3 -MLINKS+=wmemchr.3 wcscpy.3 -MLINKS+=wmemchr.3 wcscspn.3 -MLINKS+=wmemchr.3 wcslcat.3 -MLINKS+=wmemchr.3 wcslcpy.3 -MLINKS+=wmemchr.3 wcslen.3 -MLINKS+=wmemchr.3 wcsncat.3 -MLINKS+=wmemchr.3 wcsncmp.3 -MLINKS+=wmemchr.3 wcsncasecmp.3 -MLINKS+=wmemchr.3 wcsncpy.3 -MLINKS+=wmemchr.3 wcspbrk.3 -MLINKS+=wmemchr.3 wcsrchr.3 -MLINKS+=wmemchr.3 wcsspn.3 -MLINKS+=wmemchr.3 wcsstr.3 +MLINKS+=wcscasecmp.3 wcsncasecmp.3 +MLINKS+=wcscat.3 wcsncat.3 +MLINKS+=wcscmp.3 wcsncmp.3 +MLINKS+=wcscpy.3 wcsncpy.3 +MLINKS+=wcslcpy.3 wcslcat.3 MLINKS+=bcmp.3 timingsafe_bcmp.3 Index: wcscasecmp.3 === RCS file: wcscasecmp.3 diff -N -u wcscasecmp.3 --- /dev/null 9 Jul 2011 05:05:10 - +++ wcscasecmp.39 Jul 2011 11:05:09 - @@ -0,0 +1,77 @@ +.\ $OpenBSD: strcasecmp.3,v 1.10 2007/05/31 19:19:32 jmc Exp $ +.\ +.\ Copyright (c) 1990, 1991, 1993 +.\The Regents of the University of California. All rights reserved. +.\ +.\ This code is derived from software contributed to Berkeley by +.\ Chris Torek. +.\ 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, 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. +.\ 3. Neither the name of the University nor the names of its contributors +.\may be used to endorse or promote products derived from this software +.\without specific prior written permission. +.\ +.\ THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. +.\ +.\ @(#)strcasecmp.3 8.1 (Berkeley) 6/9/93 +.\ +.Dd $Mdocdate$ +.Dt WCSCASECMP 3 +.Os +.Sh NAME +.Nm wcscasecmp , +.Nm wcsncasecmp +.Nd compare wide strings, ignoring case +.Sh SYNOPSIS +.Fd #include wchar.h +.Ft int +.Fn wcscasecmp const wchar_t *s1 const wchar_t *s2 +.Ft int +.Fn wcsncasecmp const wchar_t *s1 const wchar_t *s2 size_t len +.Sh DESCRIPTION +The +.Fn wcscasecmp +and +.Fn wcsncasecmp +functions compare the wide strings +.Fa s1 +and +.Fa s2 +and return an integer greater than, equal to, or less than 0, +according to whether +.Fa s1 +is lexicographically greater than, equal to, or less than +.Fa s2 +after translation of each corresponding
Re: small fix in ehci
On Sat, Jul 09, 2011 at 06:44:26AM +0200, Eric Faurot wrote: So, there is actually another bug in that chunk of code. This diff fixes them: - Read the register from the correct location: HCSPARAMS is a capability register. - Construct the resulting mask correctly by adding parenthesis where needed: '|' takes precedence over '?' so currently the expression evaluates as EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PORT_IND where v is not even the correct value. This should let the ehci driver correctly report the characteristics of the controller's root hub. ok krw@ Ken Index: ehci.c === RCS file: /cvs/src/sys/dev/usb/ehci.c,v retrieving revision 1.117 diff -u -r1.117 ehci.c --- ehci.c3 Jul 2011 15:47:17 - 1.117 +++ ehci.c9 Jul 2011 00:52:49 - @@ -2148,11 +2148,10 @@ } hubd = ehci_hubd; hubd.bNbrPorts = sc-sc_noport; - v = EOREAD4(sc, EHCI_HCSPARAMS); + v = EREAD4(sc, EHCI_HCSPARAMS); USETW(hubd.wHubCharacteristics, - EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PWR_NO_SWITCH | - EHCI_HCS_P_INDICATOR(EREAD4(sc, EHCI_HCSPARAMS)) - ? UHD_PORT_IND : 0); + (EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PWR_NO_SWITCH) | + (EHCI_HCS_P_INDICATOR(v) ? UHD_PORT_IND : 0)); hubd.bPwrOn2PwrGood = 200; /* XXX can't find out? */ for (i = 0, l = sc-sc_noport; l 0; i++, l -= 8, v = 8) hubd.DeviceRemovable[i++] = 0; /* XXX can't find out? */
Re: kdump -m 0
On Sat, Jul 09, 2011 at 09:49:47AM +0200, Otto Moerbeek wrote: Hi, kdump -m 0 does not do what you'd expect. Fix that, and do not print for empty strings. -Otto On second thought I think this diff is better. It'll still print for an empty string if maxdata 0. -Otto Index: kdump.c === RCS file: /cvs/src/usr.bin/kdump/kdump.c,v retrieving revision 1.57 diff -u -p -r1.57 kdump.c --- kdump.c 9 Jul 2011 07:22:05 - 1.57 +++ kdump.c 9 Jul 2011 14:59:03 - @@ -63,7 +63,7 @@ #include kdump_subr.h #include extern.h -int timestamp, decimal, iohex, fancy = 1, tail, maxdata, resolv; +int timestamp, decimal, iohex, fancy = 1, tail, maxdata = INT_MAX, resolv; char *tracefile = DEF_TRACEFILE; struct ktr_header ktr_header; pid_t pid = -1; @@ -774,7 +774,9 @@ ktrgenio(struct ktr_genio *ktr, size_t l } printf(fd %d %s %zu bytes\n, ktr-ktr_fd, ktr-ktr_rw == UIO_READ ? read : wrote, datalen); - if (maxdata datalen maxdata) + if (maxdata == 0) + return; + if (datalen maxdata) datalen = maxdata; if (iohex !datalen) return;
Re: wol for xl(4)
On Sat, Jul 09, 2011 at 04:54:56PM +0200, Thomas Gerlach wrote: hi stefan, /etc/hostname.xl0: inet 192.168.0.2 255.255.255.0 192.168.0.255 wol (without ) What happens if you put wol on a separate line, like this? inet 192.168.0.2 255.255.255.0 192.168.0.255 wol ok, i don't know how you got this idea, but it's indeed working!!! thanksfor this...easy solution. :D This means there is a problem with timing somewhere. I'll try to figure out a fix.
Re: wol for xl(4)
* Stefan Sperling s...@stsp.name [2011-07-09 17:44]: On Sat, Jul 09, 2011 at 04:54:56PM +0200, Thomas Gerlach wrote: hi stefan, /etc/hostname.xl0: inet 192.168.0.2 255.255.255.0 192.168.0.255 wol (without ) What happens if you put wol on a separate line, like this? inet 192.168.0.2 255.255.255.0 192.168.0.255 wol ok, i don't know how you got this idea, but it's indeed working!!! thanksfor this...easy solution. :D that is no solution. it barely qualifies as workaround. This means there is a problem indeed! I'll try to figure out a fix. :) -- Henning Brauer, h...@bsws.de, henn...@openbsd.org BS Web Services, http://bsws.de Full-Service ISP - Secure Hosting, Mail and DNS Services Dedicated Servers, Rootservers, Application Hosting
Re: wol for xl(4)
On Sat, Jul 09, 2011 at 05:41:56PM +0200, Stefan Sperling wrote: On Sat, Jul 09, 2011 at 04:54:56PM +0200, Thomas Gerlach wrote: hi stefan, /etc/hostname.xl0: inet 192.168.0.2 255.255.255.0 192.168.0.255 wol (without ) What happens if you put wol on a separate line, like this? inet 192.168.0.2 255.255.255.0 192.168.0.255 wol ok, i don't know how you got this idea, but it's indeed working!!! thanksfor this...easy solution. :D This means there is a problem with timing somewhere. I'll try to figure out a fix. It could very well be that the wol ioctl is issued before the card is up. ifconfig is strange when flags are set while configuring address. -- :wq Claudio
Re: Testers needed for sdmmc_scsi.c diff
On 07/08/11 17:52, Matthew Dempsky wrote: Please check that SD cards still work with this diff. Index: sdmmc_scsi.c === RCS file: /cvs/src/sys/dev/sdmmc/sdmmc_scsi.c,v retrieving revision 1.28 diff -u -p -r1.28 sdmmc_scsi.c --- sdmmc_scsi.c9 Jul 2011 00:39:29 - 1.28 +++ sdmmc_scsi.c9 Jul 2011 00:51:34 - Hi, Just tested with i386 current using msdosfs and ffs and all is well. 4gb microsd card in a sd card adapter. Brett.
Re: wol for xl(4)
On Sat, Jul 09, 2011 at 07:57:19PM +0200, Claudio Jeker wrote: I'll try to figure out a fix. It could very well be that the wol ioctl is issued before the card is up. ifconfig is strange when flags are set while configuring address. We must not call xl_wol_power() from xl_stop(). If we do the device can be set into D3 sleep state at the wrong time. It's only safe to call xl_wol_power() from xl_activate(). We already call it for DVACT_QUIESCE, now also call it for DVACT_SUSPEND. This fixes the 'xl0: transmission error: ff and xl0: command never completed' lockup issue (which I could reproduce). Also, the interface needs to be running for WOL to work, so set it up from within xl_wol() if it's not running yet. This makes a hostname.xl0 file that contains just the keyword wol work correctly, without the need to up the interface just for WOL. Note that as written this depends on xl_init() to reselect register window 7 before return, which it currently does. ok? Index: xl.c === RCS file: /cvs/src/sys/dev/ic/xl.c,v retrieving revision 1.103 diff -u -p -r1.103 xl.c --- xl.c8 Jul 2011 18:56:47 - 1.103 +++ xl.c9 Jul 2011 23:49:00 - @@ -215,6 +215,9 @@ xl_activate(struct device *self, int act xl_reset(sc); xl_stop(sc); } +#ifndef SMALL_KERNEL + xl_wol_power(sc); +#endif rv = config_activate_children(self, act); break; case DVACT_RESUME: @@ -2373,10 +2376,6 @@ xl_stop(struct xl_softc *sc) ifp-if_flags = ~(IFF_RUNNING | IFF_OACTIVE); xl_freetxrx(sc); - -#ifndef SMALL_KERNEL - xl_wol_power(sc); -#endif } #ifndef SMALL_KERNEL @@ -2708,6 +2707,8 @@ xl_wol(struct ifnet *ifp, int enable) XL_SEL_WIN(7); if (enable) { + if (!(ifp-if_flags IFF_RUNNING)) + xl_init(sc); CSR_WRITE_2(sc, XL_W7_BM_PME, XL_BM_PME_MAGIC); sc-xl_flags |= XL_FLAG_WOL; } else {