D-Link DSR octeon-based models
Hi there, I just updated the hardware section for the octeon port and added the DSR-500 model to the supported list. I was wondering if similar models might also work with what's in-tree. Could people NFS-boot or at least try the ramdisk kernel on similar models (e.g. DSR-500N, DSR-1000, DSR-1000N) and report back so we can expand the supported list? Thank you, Paul
Re: netstat strtonum
I agree. ok krw@ Ken On 13 February 2014 11:54, Ted Unangst t...@tedunangst.com wrote: replace some calls to atoi with strtonum so that netstat -w 0 doesn't do weird stuff. Index: main.c === RCS file: /cvs/src/usr.bin/netstat/main.c,v retrieving revision 1.99 diff -u -p -r1.99 main.c --- main.c 10 Jan 2014 04:54:35 - 1.99 +++ main.c 13 Feb 2014 16:13:38 - @@ -182,6 +182,8 @@ main(int argc, char *argv[]) break; case 'c': repeatcount = strtonum(optarg, 1, INT_MAX, errstr); + if (errstr) + errx(1, count is %s, errstr); break; case 'd': dflag = 1; @@ -289,7 +291,9 @@ main(int argc, char *argv[]) interface = optarg; break; case 'w': - interval = atoi(optarg); + interval = strtonum(optarg, 1, INT_MAX, errstr); + if (errstr) + errx(1, interval is %s, errstr); iflag = 1; break; case '?': @@ -314,9 +318,9 @@ main(int argc, char *argv[]) #ifdef BACKWARD_COMPATIBILITY if (*argv) { if (isdigit((unsigned char)**argv)) { - interval = atoi(*argv); - if (interval = 0) - usage(); + interval = strtonum(*argv, 1, INT_MAX, errstr); + if (errstr) + errx(1, interval is %s, errstr); ++argv; iflag = 1; }
strptime() fix
As of lib/libc/time/strptime.c r1.15, certain conversions will perform calculations using the provided tm_mday value, which will frequently produce incorrect values for tm_mday and tm_yday. Apologies in advance for the mangled patch. Thanks. --david Compare runs of the test program below: /* strptime_test */ #include stdio.h #include string.h #include time.h int main(int argc, char **argv) { struct tm tm; memset(tm, 0xff, sizeof(tm)); if (argc 2 strptime(argv[1], argv[2], tm) != NULL) printf((%d,%d)\n, tm.tm_yday, tm.tm_mday); else printf(arg/parse error\n); return 0; } # the two examples below should both produce (-1,-1) ./strptime_test '2014-01' '%Y-%m' ./strptime_test '2014-01' '%Y-%d' --- strptime.c.orig 2014-02-13 13:21:12.0 -0500 +++ strptime.c 2014-02-13 13:45:44.0 -0500 @@ -594,7 +594,8 @@ const int year = tm-tm_year + TM_YEAR_BASE; const int *mon_lens = mon_lengths[isleap(year)]; if (!(fields FIELD_TM_YDAY) - (fields (FIELD_TM_MON|FIELD_TM_MDAY))) { + (fields (FIELD_TM_MON|FIELD_TM_MDAY)) == + ((FIELD_TM_MON|FIELD_TM_MDAY)) { tm-tm_yday = tm-tm_mday - 1; for (i = 0; i tm-tm_mon; i++) tm-tm_yday += mon_lens[i];
a nice diff
--- /usr/src/usr.bin/nice/nice.cTue Dec 24 17:13:20 2013 +++ ./nice.cThu Feb 13 21:20:05 2014 @@ -30,7 +30,6 @@ * SUCH DAMAGE. */ -#include sys/time.h #include sys/resource.h #include stdio.h #include stdlib.h @@ -72,7 +71,8 @@ main(int argc, char *argv[]) break; } } - argc -= optind; argv += optind; + argc -= optind; + argv += optind; if (argc == 0) usage();
Running X with machdep.allowaperture=0
Turns out we are pretty close. The only problem is that X still wants to probe the pci bus. We allow access to /dev/pci0 if machdep.allowaperture is 0, but libpciaccess uses O_RDWR to open it. The diff below chages this such that it tries O_RDONLY if O_RDWR fails. Works fine with inteldrm(4), although Xorg will still print a warning telling you to set machdep.allowaperture to 1: [257036.053] (WW) checkDevMem: failed to open /dev/xf86 and /dev/mem (Operation not permitted) Check that you have set 'machdep.allowaperture=1' in /etc/sysctl.conf and reboot your machine refer to xf86(4) for details Haven't tried radeondrm(4) yet. ok? Index: openbsd_pci.c === RCS file: /cvs/xenocara/lib/libpciaccess/src/openbsd_pci.c,v retrieving revision 1.18 diff -u -p -r1.18 openbsd_pci.c --- openbsd_pci.c 13 Aug 2013 17:24:03 - 1.18 +++ openbsd_pci.c 13 Feb 2014 21:42:08 - @@ -599,8 +599,11 @@ pci_system_openbsd_create(void) for (domain = 0; domain sizeof(pcifd) / sizeof(pcifd[0]); domain++) { snprintf(path, sizeof(path), /dev/pci%d, domain); pcifd[domain] = open(path, O_RDWR | O_CLOEXEC); - if (pcifd[domain] == -1) - break; + if (pcifd[domain] == -1) { + pcifd[domain] = open(path, O_RDONLY | O_CLOEXEC); + if (pcifd[domain] == -1) + break; + } ndomains++; }
Re: Running X with machdep.allowaperture=0
On Thu, Feb 13, 2014 at 22:52, Mark Kettenis wrote: Turns out we are pretty close. The only problem is that X still wants to probe the pci bus. We allow access to /dev/pci0 if machdep.allowaperture is 0, but libpciaccess uses O_RDWR to open it. The diff below chages this such that it tries O_RDONLY if O_RDWR fails. Is there a reason not to use O_RDONLY in the first place? I'm wondering if this will make it harder to diagnose a later failure where some machines have writable fds and some don't.
Re: Running X with machdep.allowaperture=0
Date: Thu, 13 Feb 2014 17:12:09 -0500 From: Ted Unangst t...@tedunangst.com Cc: tech@openbsd.org X-XS4ALL-DNSBL-Checked: mxdrop102.xs4all.nl checked 208.82.130.146 against DNS blacklists X-CNFS-Analysis: v=2.1 cv=Wak1NSRX c=1 sm=0 tr=0 a=iS0VH5W3/nZARN5H4QS42w==:117 a=iS0VH5W3/nZARN5H4QS42w==:17 a=OxEAv6Dl:8 a=_lmKfE_o:8 a=dfy0HCNRudsA:10 a=YPbdu89bTecA:10 a=IkcTkHD0fZMA:10 a=djBvByLjHukA:10 a=8_S25J89exnB1W3R318A:9 a=QEXdDO2ut3YA:10 X-Virus-Scanned: by XS4ALL Virus Scanner X-XS4ALL-Spam-Score: 0.1 () RDNS_NONE, SPF_HELO_PASS, SPF_PASS X-XS4ALL-Spam: NO Envelope-To: mark.kette...@xs4all.nl On Thu, Feb 13, 2014 at 22:52, Mark Kettenis wrote: Turns out we are pretty close. The only problem is that X still wants to probe the pci bus. We allow access to /dev/pci0 if machdep.allowaperture is 0, but libpciaccess uses O_RDWR to open it. The diff below chages this such that it tries O_RDONLY if O_RDWR fails. Is there a reason not to use O_RDONLY in the first place? I'm wondering if this will make it harder to diagnose a later failure where some machines have writable fds and some don't. legacy X drivers need to be able to poke pci config space for which you need write permission.
Re: strptime() fix
On 13 February 2014 17:39, Todd C. Miller todd.mil...@courtesan.com wrote: Correct, though I prefer the following for clarity. - todd Index: lib/libc/time/strptime.c === RCS file: /home/cvs/openbsd/src/lib/libc/time/strptime.c,v retrieving revision 1.15 diff -u -r1.15 strptime.c --- lib/libc/time/strptime.c16 Jan 2012 17:42:45 - 1.15 +++ lib/libc/time/strptime.c13 Feb 2014 22:37:16 - @@ -594,7 +594,7 @@ const int year = tm-tm_year + TM_YEAR_BASE; const int *mon_lens = mon_lengths[isleap(year)]; if (!(fields FIELD_TM_YDAY) - (fields (FIELD_TM_MON|FIELD_TM_MDAY))) { + (fields FIELD_TM_MON) (fields FIELD_TM_MDAY)) { tm-tm_yday = tm-tm_mday - 1; for (i = 0; i tm-tm_mon; i++) tm-tm_yday += mon_lens[i]; I like this version much better. Ken
man.conf mandoc -Tlocale
About 20 years after the invention of utf-8, I've decided to see what all the fuss is about and experiment with uxterm and whatnot. Naturally, this means I want to see sweet fancy quotes in all my man pages instead of the lame ``fake'' quotes. In order to convince mandoc to give me what I want, however, requires a command line option. But what about all those old school ascii only terminals I still sometimes use? mandoc fortunately has an option -Tlocale, which will pick between ascii and utf8 based on environment. Perfect! Let's use it. Tested to work as expected in uxterm. Tested to change nothing in a regular xterm by default (no LC_CTYPE set). Index: man.conf === RCS file: /cvs/src/etc/man.conf,v retrieving revision 1.18 diff -u -p -r1.18 man.conf --- man.conf13 Jul 2013 20:21:52 - 1.18 +++ man.conf14 Feb 2014 02:14:29 - @@ -16,15 +16,15 @@ _subdir {cat,man}1 {cat,man}8 {cat,man} _suffix.0 _build .0.Z/usr/bin/zcat %s _build .0.gz /usr/bin/gzcat %s -_build .[1-9n] /usr/bin/mandoc %s -_build .[1-9n].Z /usr/bin/zcat %s | /usr/bin/mandoc -_build .[1-9n].gz /usr/bin/gzcat %s | /usr/bin/mandoc -_build .[1-9][a-z] /usr/bin/mandoc %s -_build .[1-9][a-z].Z /usr/bin/zcat %s | /usr/bin/mandoc -_build .[1-9][a-z].gz /usr/bin/gzcat %s | /usr/bin/mandoc -_build .tbl/usr/bin/mandoc %s -_build .tbl.Z /usr/bin/zcat %s | /usr/bin/mandoc -_build .tbl.gz /usr/bin/gzcat %s | /usr/bin/mandoc +_build .[1-9n] /usr/bin/mandoc -Tlocale %s +_build .[1-9n].Z /usr/bin/zcat %s | /usr/bin/mandoc -Tlocale +_build .[1-9n].gz /usr/bin/gzcat %s | /usr/bin/mandoc -Tlocale +_build .[1-9][a-z] /usr/bin/mandoc -Tlocale %s +_build .[1-9][a-z].Z /usr/bin/zcat %s | /usr/bin/mandoc -Tlocale +_build .[1-9][a-z].gz /usr/bin/gzcat %s | /usr/bin/mandoc -Tlocale +_build .tbl/usr/bin/mandoc -Tlocale %s +_build .tbl.Z /usr/bin/zcat %s | /usr/bin/mandoc -Tlocale +_build .tbl.gz /usr/bin/gzcat %s | /usr/bin/mandoc -Tlocale # Sections and their directories. # All paths ending in '/' are the equivalent of entries specifying that
Re: exp() / expl() on Linux and OpenBSD (expl() bug?)
A fix has been committed, but there's still a problem on loongson with libm updated: $ ls -l /usr/lib/libm.so.* -r--r--r-- 1 root bin 926033 Feb 12 12:17 /usr/lib/libm.so.9.0 $ cc -o expl expl.c -O2 -pipe -lm $ for in in 1 2 3 4 5 6 ; do ./expl ; done theta == 1, pr == -9.15569e-2474, pr2 == 6.10667e-4944 theta == 1, pr == 0.606531, pr2 == 0.606531 theta == 1, pr == 0.606531, pr2 == 0.606531 theta == 1, pr == 0.606531, pr2 == 0.606531 theta == 1, pr == -9.15569e-2474, pr2 == 6.10667e-4944 theta == 1, pr == 0.606531, pr2 == 0.606531 This is definitely a problem in gdtoa. The values are always computed the same, but do not get printed correctly, as shown by this modified test program. Both lines should print 0.606531 for the long doubles, but don't always; this smells like an uninitialized value somewhere. #include stdio.h #include stdlib.h #include math.h int main(void) { double theta = 1; long double lambda, pr, pr2; static const uint64_t zpr[2] = { #ifdef __MIPSEL__ 0xa000ULL, 0x3ffe368b2fc6f960ULL #else 0x3ffe368b2fc6f960ULL, 0xa000ULL #endif }, zpr2[2] = { #ifdef __MIPSEL__ 0x9fe7aceb46aa619cULL, 0x3ffe368b2fc6f960ULL #else 0x3ffe368b2fc6f960ULL, 0x9fe7aceb46aa619cULL #endif }; lambda = (0.5*theta); pr = exp(-lambda); pr2 = expl(-lambda); printf(theta == %g, pr == %Lg, pr2 == %Lg\n, theta, pr, pr2); printf(theta == %g, pr == %Lg, pr2 == %Lg\n, theta, zpr[0], zpr[1], zpr2[0], zpr2[1]); exit(0); }