Re: Thread-safe libcrypto by using weak symbols to pthread
On Sat, 28 Mar 2015, Carlos Mart?n Nieto wrote: > I?ve been looking into making libcrypto automatically thread-safe. The > obvious solution is to use pthread to perform the locking instead of > relying on the user to set locking callbacks, as the final user > shouldn?t need to care that LibreSSL is involved in the dependencies at > some level. Well. How far is our reach on this? Solving this just for LibreSSL on OpenBSD? I guess you diff works, though it doesn't work when libpthread can be loaded after startup as the bindings won't be updated. If the goal is just this, then application writers in the wider software ecosystem won't even notice and will have to continue to use the callbacks, etc. Solving this LibreSSL on all ported to platforms? Much harder: have to solve the late-loaded libpthread problem immediately, figure out what works elsewhere, etc. This goal might at least start to make a dent in developer conciousness, but unless/until OpenSSL does something similar developers will still be doing the work. LibreSSL doesn't "own" the API presented by libcrypto and libssl; we aren't the 600lb gorilla there. (So why haven't they solved it? Just an overriding desire to reduce unnecessary overhead? They have enough compile-time options, so platforms without threads won't have stopped them...) Maybe where we should fix this is libtls, which we *do* control: have libtls do the necessary callbacks... Philip
Re: UPDATE: xkeyboard-config 2.14
On Sun, Feb 08, 2015 at 03:10:45PM +0500, Alexandr Shadchin wrote: > Hi, > > This diff updates xkeyboard-config to the latest release. > Tested on amd64. > > Comments ? OK ? > > -- > Alexandr Shadchin > Ping. -- Alexandr Shadchin
Re: [PATCH] #include in parse.y when calloc is used
On Sat, Mar 28, 2015 at 5:38 PM, Ted Unangst wrote: > Renato Westphal wrote: >> > +#include >> > #include > >> "#include ", >> "#include ", > >> If you include the stdlib header in the .y file you will end up with >> two includes for the same header in the .c file. > > Looks like we're already including string.h twice. Probably makes sense > to reverse the diff and delete the extra. Disagree, particularly for the programs that have -portable variants. As Joerg notes, there's no guarantee that yacc will pull in any particular headers before the user code's position in the generated .c file. Let's not make these less portable for no gain. Philip Guenther
mg(1) sysdef.h cleanning
Hello Brian, Thank you for erasing sysdef.h and pushing the task even further. It will make life easier to deal with it in a modern environment. Good work.
Re: let vlan(4) mtu be limited by the parents hardmtu instead of current mtu
> On 20 Aug 2014, at 9:54 am, David Gwynne wrote: > > this lets you have networks on the "native" vlan on an interface > at 1500, while setting a child vlan interfaces mtu to jumbos. > > ok? how about now? i believe both ix and oce unconditionally set their mru now, and it's the start of the cycle. ok? > > Index: if_vlan.c > === > RCS file: /cvs/src/sys/net/if_vlan.c,v > retrieving revision 1.108 > diff -u -p -r1.108 if_vlan.c > --- if_vlan.c 12 Jul 2014 18:44:22 - 1.108 > +++ if_vlan.c 19 Aug 2014 23:52:15 - > @@ -528,9 +528,9 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd > case SIOCSIFMTU: > if (ifv->ifv_p != NULL) { > if (ifv->ifv_p->if_capabilities & IFCAP_VLAN_MTU) > - p_mtu = ifv->ifv_p->if_mtu; > + p_mtu = ifv->ifv_p->if_hardmtu; > else > - p_mtu = ifv->ifv_p->if_mtu - EVL_ENCAPLEN; > + p_mtu = ifv->ifv_p->if_hardmtu - EVL_ENCAPLEN; > > if (ifr->ifr_mtu > p_mtu || ifr->ifr_mtu < ETHERMIN) > error = EINVAL;
Re: [PATCH] #include in parse.y when calloc is used
Renato Westphal wrote: > > +#include > > #include > "#include ", > "#include ", > If you include the stdlib header in the .y file you will end up with > two includes for the same header in the .c file. Looks like we're already including string.h twice. Probably makes sense to reverse the diff and delete the extra.
Re: [PATCH] #include in parse.y when calloc is used
On Sat, Mar 28, 2015 at 09:42:00AM -0300, Renato Westphal wrote: > I don't think that this is necessary. Yacc includes a skeleton C code > when generating a parser from a grammar specification file (.y) and > the stdlib header is in there: > > char *banner[] = > { > "#include ", > "#include ", > "#define YYBYACC 1", > "#define YYMAJOR 1", > "#define YYMINOR 9", > "#define YYLEX yylex()", > "#define YYEMPTY -1", > "#define yyclearin (yychar=(YYEMPTY))", > "#define yyerrok (yyerrflag=0)", > "#define YYRECOVERING() (yyerrflag!=0)", > NULL > }; > > If you include the stdlib header in the .y file you will end up with > two includes for the same header in the .c file. You would be right for whatever version you are looking at, but newer versions stopped doing that. They no longer include either header in the banner. Joerg
Re: ssh-add.1 / ssh-askpass clarification
On Sat, Mar 28, 2015 at 07:19:13AM +, Jason McIntyre wrote: > > > maybe this is clearer: > > > > > > Index: ssh-add.1 > > > === > > > RCS file: /cvs/src/usr.bin/ssh/ssh-add.1,v > > > retrieving revision 1.61 > > > diff -u -r1.61 ssh-add.1 > > > --- ssh-add.1 21 Dec 2014 22:27:56 - 1.61 > > > +++ ssh-add.1 27 Mar 2015 23:21:34 - > > > @@ -88,12 +88,11 @@ > > > .It Fl c > > > Indicates that added identities should be subject to confirmation before > > > being used for authentication. > > > -Confirmation is performed by the > > > -.Ev SSH_ASKPASS > > > -program mentioned below. > > > -Successful confirmation is signaled by a zero exit status from the > > > -.Ev SSH_ASKPASS > > > -program, rather than text entered into the requester. > > > +Confirmation is performed by > > > +.Xr ssh-askpass 1 . > > > +Successful confirmation is signaled by a zero exit status from > > > +.Xr ssh-askpass 1 , > > > +rather than text entered into the requester. > > > .It Fl D > > > Deletes all identities from the agent. > > > .It Fl d > > > @@ -156,6 +155,8 @@ > > > .Ev SSH_ASKPASS > > > are set, it will execute the program specified by > > > .Ev SSH_ASKPASS > > > +(by default > > > +.Dq ssh-askpass ) > > > and open an X11 window to read the passphrase. > > > This is particularly useful when calling > > > .Nm > > > @@ -197,6 +198,7 @@ > > > .Sh SEE ALSO > > > .Xr ssh 1 , > > > .Xr ssh-agent 1 , > > > +.Xr ssh-askpass 1 , > > > .Xr ssh-keygen 1 , > > > .Xr sshd 8 > > > .Sh AUTHORS > > > > [...] > > currently the doc (specifically -c) refers to SSH_ASKPASS. i understand > you want to be clear that SSH_ASKPASS does not need to be set, so you > added some text to say that explicitly. > > my diff takes a different approach - it is actually not that common to > talk about the environment variable when a sane default exists. usually > we document the usual case and in ENVIRONMENT we document the variable > that can override defualt behaviour. my diff does that. I'm OK with this. j.
unifdef fun with vi
Hi again tech@ -- Some more unifdef fun with vi: 1. SA_INTERRUPT is a SunOS extension. I don't think we need to care if vi is portable there anymore. vi doesn't build if defined the other way. 2. There is a HISTORIC_PRACTICE and a HISTORICAL_PRACTICE define. We don't appear to be using either so get rid of them. 3. We have mvchgat via so don't need to check for it. The declarations within that #ifndef block weren't being used. OK? ~Brian Index: cl/cl_funcs.c === RCS file: /cvs/src/usr.bin/vi/cl/cl_funcs.c,v retrieving revision 1.17 diff -u -p -r1.17 cl_funcs.c --- cl/cl_funcs.c 12 Nov 2014 16:29:04 - 1.17 +++ cl/cl_funcs.c 28 Mar 2015 18:35:43 - @@ -261,10 +261,6 @@ cl_cursor(SCR *sp, size_t *yp, size_t *x int cl_deleteln(SCR *sp) { -#ifndef mvchgat - CHAR_T ch; - size_t col, lno, spcnt; -#endif size_t oldy, oldx; /* Index: cl/cl_main.c === RCS file: /cvs/src/usr.bin/vi/cl/cl_main.c,v retrieving revision 1.25 diff -u -p -r1.25 cl_main.c --- cl/cl_main.c19 Nov 2014 03:42:40 - 1.25 +++ cl/cl_main.c28 Mar 2015 18:35:43 - @@ -319,21 +319,12 @@ setsig(int signo, struct sigaction *oact * Use sigaction(2), not signal(3), since we don't always want to * restart system calls. The example is when waiting for a command * mode keystroke and SIGWINCH arrives. Besides, you can't portably -* restart system calls (thanks, POSIX!). On the other hand, you -* can't portably NOT restart system calls (thanks, Sun!). SunOS -* used SA_INTERRUPT as their extension to NOT restart read calls. -* We sure hope nobody else used it for anything else. Mom told me -* there'd be days like this. She just never told me that there'd -* be so many. +* restart system calls (thanks, POSIX!). */ act.sa_handler = handler; sigemptyset(&act.sa_mask); -#ifdef SA_INTERRUPT - act.sa_flags = SA_INTERRUPT; -#else act.sa_flags = 0; -#endif return (sigaction(signo, &act, oactp)); } Index: ex/ex_z.c === RCS file: /cvs/src/usr.bin/vi/ex/ex_z.c,v retrieving revision 1.7 diff -u -p -r1.7 ex_z.c --- ex/ex_z.c 12 Nov 2014 04:28:41 - 1.7 +++ ex/ex_z.c 28 Mar 2015 18:35:43 - @@ -51,11 +51,7 @@ ex_z(SCR *sp, EXCMD *cmdp) if (FL_ISSET(cmdp->iflags, E_C_COUNT)) cnt = cmdp->count; else -#ifdef HISTORIC_PRACTICE - cnt = O_VAL(sp, O_SCROLL) * 2; -#else cnt = O_VAL(sp, O_WINDOW) - 1; -#endif equals = 0; eofcheck = 0; Index: vi/v_mark.c === RCS file: /cvs/src/usr.bin/vi/vi/v_mark.c,v retrieving revision 1.9 diff -u -p -r1.9 v_mark.c --- vi/v_mark.c 12 Nov 2014 04:28:41 - 1.9 +++ vi/v_mark.c 28 Mar 2015 18:35:43 - @@ -170,22 +170,7 @@ mark(SCR *sp, VICMD *vp, enum which cmd) * Delete cursor motion was always to the start of the text region, * regardless. Ignore other motion commands. */ -#ifdef HISTORICAL_PRACTICE - if (ISCMD(vp->rkp, 'y')) { - if ((cmd == BQMARK || - cmd == FQMARK && vp->m_start.lno != vp->m_stop.lno) && - (vp->m_start.lno > vp->m_stop.lno || - vp->m_start.lno == vp->m_stop.lno && - vp->m_start.cno > vp->m_stop.cno)) - vp->m_final = vp->m_stop; - } else if (ISCMD(vp->rkp, 'd')) - if (vp->m_start.lno > vp->m_stop.lno || - vp->m_start.lno == vp->m_stop.lno && - vp->m_start.cno > vp->m_stop.cno) - vp->m_final = vp->m_stop; -#else vp->m_final = vp->m_start; -#endif /* * Forward marks are always line oriented, and it's set in the
Re: [UPDATE] xcb-util-cursor-0.1.2
On Fri, Mar 27, 2015 at 01:55:56PM +0100, David Coppa wrote: > > Minor update, no important stuff for us. > > Comments? > > Index: Makefile.in > === > RCS file: /cvs/xenocara/lib/xcb-util-cursor/Makefile.in,v > retrieving revision 1.1.1.1 > diff -u -p -u -p -r1.1.1.1 Makefile.in > --- Makefile.in 14 Apr 2014 19:28:48 - 1.1.1.1 > +++ Makefile.in 27 Mar 2015 12:51:21 - > @@ -1,7 +1,7 @@ > -# Makefile.in generated by automake 1.12.6 from Makefile.am. > +# Makefile.in generated by automake 1.14.1 from Makefile.am. Hi, You have not regenrated the autotools files using the tools in ports. It may look pointless, but we have a number of patches to automake/autoconf that are needed for some stuff. So I prefer to always regenerate the build system with our tools (ie ENV_XENOCARA_RERUN_AUTOCONF=yes make -f Makefile.bsd-wrapper). -- Matthieu Herrb
unix domain pcb slist macro
Hi, I would like to replace the manual list in unix domain sockets with a SLIST. That makes the code easier to read. ok? bluhm Index: sys/kern/kern_sysctl.c === RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_sysctl.c,v retrieving revision 1.283 diff -u -p -r1.283 kern_sysctl.c --- sys/kern/kern_sysctl.c 11 Feb 2015 05:09:33 - 1.283 +++ sys/kern/kern_sysctl.c 28 Mar 2015 11:48:10 - @@ -1146,8 +1146,10 @@ fill_file(struct kinfo_file *kf, struct if (show_pointers) { kf->unp_conn= PTRTOINT64(unpcb->unp_conn); - kf->unp_refs= PTRTOINT64(unpcb->unp_refs); - kf->unp_nextref = PTRTOINT64(unpcb->unp_nextref); + kf->unp_refs= PTRTOINT64( + SLIST_FIRST(&unpcb->unp_refs)); + kf->unp_nextref = PTRTOINT64( + SLIST_NEXT(unpcb, unp_nextref)); kf->v_un= PTRTOINT64(unpcb->unp_vnode); kf->unp_addr= PTRTOINT64(unpcb->unp_addr); } Index: sys/kern/uipc_usrreq.c === RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_usrreq.c,v retrieving revision 1.79 diff -u -p -r1.79 uipc_usrreq.c --- sys/kern/uipc_usrreq.c 11 Dec 2014 19:21:57 - 1.79 +++ sys/kern/uipc_usrreq.c 28 Mar 2015 11:48:10 - @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -380,8 +381,8 @@ unp_detach(struct unpcb *unp) } if (unp->unp_conn) unp_disconnect(unp); - while (unp->unp_refs) - unp_drop(unp->unp_refs, ECONNRESET); + while (!SLIST_EMPTY(&unp->unp_refs)) + unp_drop(SLIST_FIRST(&unp->unp_refs), ECONNRESET); soisdisconnected(unp->unp_socket); unp->unp_socket->so_pcb = NULL; m_freem(unp->unp_addr); @@ -554,8 +555,7 @@ unp_connect2(struct socket *so, struct s switch (so->so_type) { case SOCK_DGRAM: - unp->unp_nextref = unp2->unp_refs; - unp2->unp_refs = unp; + SLIST_INSERT_HEAD(&unp2->unp_refs, unp, unp_nextref); soisconnected(so); break; @@ -583,20 +583,7 @@ unp_disconnect(struct unpcb *unp) switch (unp->unp_socket->so_type) { case SOCK_DGRAM: - if (unp2->unp_refs == unp) - unp2->unp_refs = unp->unp_nextref; - else { - unp2 = unp2->unp_refs; - for (;;) { - if (unp2 == NULL) - panic("unp_disconnect"); - if (unp2->unp_nextref == unp) - break; - unp2 = unp2->unp_nextref; - } - unp2->unp_nextref = unp->unp_nextref; - } - unp->unp_nextref = NULL; + SLIST_REMOVE(&unp2->unp_refs, unp, unpcb, unp_nextref); unp->unp_socket->so_state &= ~SS_ISCONNECTED; break; Index: sys/sys/unpcb.h === RCS file: /data/mirror/openbsd/cvs/src/sys/sys/unpcb.h,v retrieving revision 1.8 diff -u -p -r1.8 unpcb.h --- sys/sys/unpcb.h 30 Jun 2010 19:57:05 - 1.8 +++ sys/sys/unpcb.h 28 Mar 2015 11:48:10 - @@ -63,8 +63,8 @@ structunpcb { struct vnode *unp_vnode; /* if associated with file */ ino_t unp_ino;/* fake inode number */ struct unpcb *unp_conn;/* control block of connected socket */ - struct unpcb *unp_refs;/* referencing socket linked list */ - struct unpcb *unp_nextref; /* link in unp_refs list */ + SLIST_HEAD(,unpcb) unp_refs;/* referencing socket linked list */ + SLIST_ENTRY(unpcb) unp_nextref; /* link in unp_refs list */ struct mbuf *unp_addr; /* bound address of socket */ int unp_flags; /* this unpcb contains peer eids */ struct sockpeercred unp_connid;/* id of peer process */ Index: lib/libkvm/kvm_file2.c === RCS file: /data/mirror/openbsd/cvs/src/lib/libkvm/kvm_file2.c,v retrieving revision 1.44 diff -u -p -r1.44 kvm_file2.c --- lib/libkvm/kvm_file2.c 11 Feb 2015 05:11:04 - 1.44 +++ lib/libkvm/kvm_file2.c 28 Mar 2015 12:30:34 - @@ -656,8 +656,10 @@ fill_file(kvm_t *kd, struct kinfo_file * return (-1); } kf->unp_conn= P
[GSOC] Hammer2 for openbsd
Hi, i've submitted a proposal for gsoc on melange, but i'm reposting it here since it looks easier to get feedback than on the web interface. HAMMER2 --- HAMMER2 is a file system developed by Matthew Dillon for DragonFlyBSD. The main purpose of this new filesystem is to support replication clustering and the core design is heavily influenced by this goal, but the filesystem does support a lot of features which are useful in a single node context. The goal of this proposal is to port a *subset* of HAMMER2 to OpenBSD and stabilize the port in a single node context. Supporting clustering is out of scope of this project. Its primary features are copy on write writable snapshots, on-the-fly compression (currently only LZ4 and zeros suppression). The data integrity is checked with per block CRC. Offline (safe) and online (subject to hash collision issues) block de-duplication and multiple disks support are planned but not yet implemented. One of the strength of this filesystem is that despite the huge number of features it implements the code is still comparatively simple with regards to the others existing filesystem in the segment (the number of lines of code is in the same order than UFS at this time) About porting - One might consider that it is too early to port the filesystem now and it is better to wait for it to be finished. But porting early before the filesystem is used in production can be a win too because it is still possible to make architectural changes to improve portability. Moreover, porting the filesystem to another operating system might help to attract new developers to work on specific part of the filesystem like deduplication or the copy mechanism and speed up its development. The core filesystem is here and mostly done. There is something to work on which is not subject to change drastically and void the porting work. Goals - The goal is to have a working filesystem at the end of the summer, and be able to create, mount, read/write without panic on a single master filesystem. Non goals --- * boot loader support * clustering support. This is a major task on its own, and needs porting of more subsystems in the kernel. It is also the less advanced part of the filesystem, currently in development. Planned work * Weeks 1-2 Port the core of the filesystem. The chain API is the main in-memory data structure of HAMMER2. It is a COW tree of chains representing the toplogical structure of the files in the filesystem. A chain can represent an inode, a directory entry, or an indirect block. This is the most portable part of the filesystem since it doesn't depend on any external API. The main task is converting the locking directives from DragonFly to OpenBSD and deal with the slight kernel API differences, like malloc. * Weeks 3 Hammer2 has an abstraction on top of the kernel block io layer. Alongside of the chain API, the block io abstraction is another major part of the filesystem. It is responsible to handle buffer mapping from the buffer cache and read/write data to disk at the request of the chain frontend code. The third week would be dedicated to the porting of the io layer and the io clustering layer. Like with most kernel code, there is no test suite, but spending the time to write a few tests and get this code and the chain API build and run standalone might worth it for the next part of the project. Together they are the most complex code in the filesystem and if it works, then remaining bugs will be easier to track down. * Weeks 4 Port the ioctl api, and the bulkfree scan. The bulkfree scan is the code responsible to garbage collect the un-referenced blocks. * Week 5 Port the userspace tools. At this point, it should be possible to create a filesystem * Week 6-7-8 Convert the frontend to the openBSD vfs API. DragonFly VFS has diverged a lot from earlier BSD VFS, with substantial changes in the locking and semantic of the namecache/vnode locking and interactions. The frontend code which contains the vnode operations and the vfs operations is about 5kloc. This is a major task. At this point, it should be possible to use the filesystem. * Remaining time I'm not sure i'm able to plan this long. The first thing to do is to test the filesystem in depth, and fix the issues which arise. It's not possible to plan the time it'll need but i suspect it will be quite some work. After that, if i have more time, there are some possibility. Probably the best think is to track down one of the known bug of hammer2 and try to solve it, for instance the issue with hardlink (if matt dillon has not solved it at this point). Another possibility is working on a small feature for hammer2, like deduplication, but i'd like to be have a usable filesystem before trying to add something new. Thanks for reading, Joris
bounds checks in aml_rwgas
The diff below fixes a uvm fault I'm seeing when booting an MP kernel on a hp bc2500 blade, somewhere during acpi attach. SP kernels don't crash, but I think that's down to luck. It looks like this: ioapic0 at mainbus0: apid 2 pa 0xfec0, version 21, 24 pins acpimcfg0 at acpi0 addr 0xe000, bus 0-64 acpihpet0 at acpi0: 14318180 Hz uvm_fault(0x818c5860, 0x80063000, 0, 1) -> e kernel: page fault trap, code=0 Stopped at memcpy+0xa: repe movsq (%rsi),%es:(%rdi) memcpy() at memcpy+0xa aml_rwfield() at aml_rwfield+0x205 aml_store() at aml_store+0x1eb aml_parse() at aml_parse+0xf4c aml_eval() at aml_eval+0x1c8 aml_parse() at aml_parse+0x183d aml_eval() at aml_eval+0x1c8 aml_evalnode() at aml_evalnode+0x74 acpi_inidev() at acpi_inidev+0x57 aml_find_node() at aml_find_node+0x92 end trace frame: 0x81a1eab0, count: 0 This turns out to be because aml_rwgas doesn't do bounds checking on source buffers. _SB.PCI0._INI (evaluated in acpi_inidev) tries to figure out what OS is running. The method it calls to do this creates a temporary buffer: Name (STR0, Buffer (0x50) {}) that it copies some lies into, like "Microsoft Windows Vista", then copies that somewhere else: WMIB = STR0 /* \OSFG.STR0 */ where WMIB is: OperationRegion (HABS, SystemMemory, HBIO, HBSZ) Field (HABS, AnyAcc, NoLock, Preserve) { WMIB, 33280, which is a fair bit bigger than the STR0 buffer. aml_rwgas tries to read all 33280 bits from STR0 anyway, which obviously leads to crashes. I've tested the fix on several machines running amd64 and i386 and nothing breaks as far as I can tell. oks, more tests, etc.? Index: dsdt.c === RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v retrieving revision 1.216 diff -u -p -u -p -r1.216 dsdt.c --- dsdt.c 16 Mar 2015 20:31:46 - 1.216 +++ dsdt.c 28 Mar 2015 11:57:07 - @@ -2286,6 +2286,9 @@ aml_rwgas(struct aml_value *rgn, int bpo } else { /* Write to a large field.. create or convert buffer */ val = aml_convert(val, AML_OBJTYPE_BUFFER, -1); + + if (blen > (val->length << 3)) + blen = val->length << 3; } vbit = val->v_buffer; } else {
Re: [PATCH] #include in parse.y when calloc is used
2015-03-28 8:56 GMT-03:00 Fabian Raetz : > Hi tech@, > > should the stdlib.h header be included in parse.y files when calloc(3) > is used? > > Regards, > Fabian > > > From ce8307e0bc7541b88a9a9bf949f6585adef46bb6 Mon Sep 17 00:00:00 2001 > From: Fabian Raetz > Date: Sat, 28 Mar 2015 12:44:32 +0100 > Subject: [PATCH] include stdlib.h because of calloc(3) usage > > --- > bin/chio/parse.y | 1 + > sbin/ipsecctl/parse.y | 1 + > usr.sbin/bgpd/parse.y | 1 + > usr.sbin/dvmrpd/parse.y | 1 + > usr.sbin/httpd/parse.y| 1 + > usr.sbin/ifstated/parse.y | 1 + > usr.sbin/iscsictl/parse.y | 1 + > usr.sbin/ldpd/parse.y | 1 + > usr.sbin/ospf6d/parse.y | 1 + > usr.sbin/ospfd/parse.y| 1 + > usr.sbin/relayd/parse.y | 1 + > usr.sbin/ripd/parse.y | 1 + > usr.sbin/snmpd/parse.y| 1 + > 13 files changed, 13 insertions(+) > > diff --git bin/chio/parse.y bin/chio/parse.y > index 0d086c9..279d08f 100644 > --- bin/chio/parse.y > +++ bin/chio/parse.y > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > #include > > TAILQ_HEAD(files, file) files = > TAILQ_HEAD_INITIALIZER(files); > diff --git sbin/ipsecctl/parse.y sbin/ipsecctl/parse.y > index 63d2796..f04ff88 100644 > --- sbin/ipsecctl/parse.y > +++ sbin/ipsecctl/parse.y > @@ -40,6 +40,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git usr.sbin/bgpd/parse.y usr.sbin/bgpd/parse.y > index 2021fbd..769f6e4 100644 > --- usr.sbin/bgpd/parse.y > +++ usr.sbin/bgpd/parse.y > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > #include > #include > > diff --git usr.sbin/dvmrpd/parse.y usr.sbin/dvmrpd/parse.y > index fabc9cc..56fcac7 100644 > --- usr.sbin/dvmrpd/parse.y > +++ usr.sbin/dvmrpd/parse.y > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > #include > #include > > diff --git usr.sbin/httpd/parse.y usr.sbin/httpd/parse.y > index 006cf4e..ce1e060 100644 > --- usr.sbin/httpd/parse.y > +++ usr.sbin/httpd/parse.y > @@ -46,6 +46,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git usr.sbin/ifstated/parse.y usr.sbin/ifstated/parse.y > index a010f8c..c1f721e 100644 > --- usr.sbin/ifstated/parse.y > +++ usr.sbin/ifstated/parse.y > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git usr.sbin/iscsictl/parse.y usr.sbin/iscsictl/parse.y > index d199c81..fecde41 100644 > --- usr.sbin/iscsictl/parse.y > +++ usr.sbin/iscsictl/parse.y > @@ -38,6 +38,7 @@ > #include > #include > #include > +#include > #include > #include > > diff --git usr.sbin/ldpd/parse.y usr.sbin/ldpd/parse.y > index ee070ca..4821d51 100644 > --- usr.sbin/ldpd/parse.y > +++ usr.sbin/ldpd/parse.y > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > #include > #include > > diff --git usr.sbin/ospf6d/parse.y usr.sbin/ospf6d/parse.y > index 01a2731..1ba57c9 100644 > --- usr.sbin/ospf6d/parse.y > +++ usr.sbin/ospf6d/parse.y > @@ -37,6 +37,7 @@ > #include > #include > #include > +#include > #include > #include > > diff --git usr.sbin/ospfd/parse.y usr.sbin/ospfd/parse.y > index 09e6922..1909fa3 100644 > --- usr.sbin/ospfd/parse.y > +++ usr.sbin/ospfd/parse.y > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include > #include > > diff --git usr.sbin/relayd/parse.y usr.sbin/relayd/parse.y > index 6bd980b..4092cd6 100644 > --- usr.sbin/relayd/parse.y > +++ usr.sbin/relayd/parse.y > @@ -42,6 +42,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git usr.sbin/ripd/parse.y usr.sbin/ripd/parse.y > index dacb201..0d224c9 100644 > --- usr.sbin/ripd/parse.y > +++ usr.sbin/ripd/parse.y > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > #include > #include > > diff --git usr.sbin/snmpd/parse.y usr.sbin/snmpd/parse.y > index cea9194..72f020f 100644 > --- usr.sbin/snmpd/parse.y > +++ usr.sbin/snmpd/parse.y > @@ -44,6 +44,7 @@ > #include > #include > #include > +#include > #include > #include > #include > -- > 2.3.3 Hi, I don't think that this is necessary. Yacc includes a skeleton C code when generating a parser from a grammar specification file (.y) and the stdlib header is in there: char *banner[] = { "#include ", "#include ", "#define YYBYACC 1", "#define YYMAJOR 1", "#define YYMINOR 9", "#define YYLEX yylex()", "#define YYEMPTY -1", "#define yyclearin (yychar=(YYEMPTY))", "#define yyerrok (yyerrflag=0)", "#define YYRECOVERING() (yyerrflag!=0)", NULL }; If you include the stdlib header in the .y file you will end up with two includes for the same header in the .c file. -- Renato Westphal
softraid slist macro
Hi, The SLIST_REMOVE within a SLIST_FOREACH loop without SAFE looks scary. The old code removed the entries from the root link ony by one. This can be done in a single step. Replace some manual loops with SLIST macros and remove unnecessary code. I am running this with softraid crypto, could someone with raid 0 or 1 try it? ok? bluhm Index: dev/softraid.c === RCS file: /data/mirror/openbsd/cvs/src/sys/dev/softraid.c,v retrieving revision 1.350 diff -u -p -r1.350 softraid.c --- dev/softraid.c 14 Mar 2015 03:38:46 - 1.350 +++ dev/softraid.c 28 Mar 2015 10:30:55 - @@ -263,8 +263,7 @@ sr_meta_attach(struct sr_discipline *sd, goto bad; /* Force chunks into correct order now that metadata is attached. */ - SLIST_FOREACH(ch_entry, cl, src_link) - SLIST_REMOVE(cl, ch_entry, sr_chunk, src_link); + SLIST_INIT(cl); for (i = 0; i < chunk_no; i++) { ch_entry = sd->sd_vol.sv_chunks[i]; chunk2 = NULL; @@ -1137,7 +1136,7 @@ sr_boot_assembly(struct sr_softc *sc) struct sr_boot_volume_head bvh; struct sr_boot_chunk_head bch, kdh; struct sr_boot_volume *bv, *bv1, *bv2; - struct sr_boot_chunk*bc, *bcnext, *bc1, *bc2; + struct sr_boot_chunk*bc, *bc1, *bc2; struct sr_disk_head sdklist; struct sr_disk *sdk; struct disk *dk; @@ -1201,10 +1200,9 @@ sr_boot_assembly(struct sr_softc *sc) /* * Create a list of volumes and associate chunks with each volume. */ - for (bc = SLIST_FIRST(&bch); bc != NULL; bc = bcnext) { - - bcnext = SLIST_NEXT(bc, sbc_link); - SLIST_REMOVE(&bch, bc, sr_boot_chunk, sbc_link); + while (!SLIST_EMPTY(&bch)) { + bc = SLIST_FIRST(&bch); + SLIST_REMOVE_HEAD(&bch, sbc_link); bc->sbc_chunk_id = bc->sbc_metadata->ssdi.ssd_chunk_id; /* Handle key disks separately. */ @@ -1456,11 +1454,8 @@ sr_boot_assembly(struct sr_softc *sc) /* done with metadata */ unwind: /* Free boot volumes and associated chunks. */ - for (bv1 = SLIST_FIRST(&bvh); bv1 != NULL; bv1 = bv2) { - bv2 = SLIST_NEXT(bv1, sbv_link); - for (bc1 = SLIST_FIRST(&bv1->sbv_chunks); bc1 != NULL; - bc1 = bc2) { - bc2 = SLIST_NEXT(bc1, sbc_link); + SLIST_FOREACH_SAFE(bv1, &bvh, sbv_link, bv2) { + SLIST_FOREACH_SAFE(bc1, &bv1->sbv_chunks, sbc_link, bc2) { if (bc1->sbc_metadata) free(bc1->sbc_metadata, M_DEVBUF, 0); free(bc1, M_DEVBUF, 0); @@ -1468,15 +1463,13 @@ unwind: free(bv1, M_DEVBUF, 0); } /* Free keydisks chunks. */ - for (bc1 = SLIST_FIRST(&kdh); bc1 != NULL; bc1 = bc2) { - bc2 = SLIST_NEXT(bc1, sbc_link); + SLIST_FOREACH_SAFE(bc1, &kdh, sbc_link, bc2) { if (bc1->sbc_metadata) free(bc1->sbc_metadata, M_DEVBUF, 0); free(bc1, M_DEVBUF, 0); } /* Free unallocated chunks. */ - for (bc1 = SLIST_FIRST(&bch); bc1 != NULL; bc1 = bc2) { - bc2 = SLIST_NEXT(bc1, sbc_link); + SLIST_FOREACH_SAFE(bc1, &bch, sbc_link, bc2) { if (bc1->sbc_metadata) free(bc1->sbc_metadata, M_DEVBUF, 0); free(bc1, M_DEVBUF, 0); @@ -1662,10 +1655,7 @@ sr_meta_native_attach(struct sr_discipli /* mixed metadata versions; mark bad disks offline */ if (old_meta) { d = 0; - for (ch_entry = SLIST_FIRST(cl); ch_entry != NULL; - ch_entry = ch_next, d++) { - ch_next = SLIST_NEXT(ch_entry, src_link); - + SLIST_FOREACH_SAFE(ch_entry, cl, src_link, ch_next) { /* XXX do we want to read this again? */ if (ch_entry->src_dev_mm == NODEV) panic("src_dev_mm == NODEV"); @@ -1675,6 +1665,7 @@ sr_meta_native_attach(struct sr_discipli if (md->ssd_ondisk != version) sd->sd_vol.sv_chunks[d]->src_meta.scm_status = BIOC_SDOFFLINE; + d++; } } @@ -1751,8 +1742,6 @@ sr_hotplug_unregister(struct sr_discipli SLIST_REMOVE(&sr_hotplug_callbacks, mhe, sr_hotplug_list, shl_link); free(mhe, M_DEVBUF, 0); - if (SLIST_EMPTY(&sr_hotplug_callbacks)) - SLIST_INIT(&sr_hotplug_callbacks); return; } } @@ -3769,9 +3758,7 @@ sr_chunks_unwind(struct sr_softc
[PATCH] #include in parse.y when calloc is used
Hi tech@, should the stdlib.h header be included in parse.y files when calloc(3) is used? Regards, Fabian >From ce8307e0bc7541b88a9a9bf949f6585adef46bb6 Mon Sep 17 00:00:00 2001 From: Fabian Raetz Date: Sat, 28 Mar 2015 12:44:32 +0100 Subject: [PATCH] include stdlib.h because of calloc(3) usage --- bin/chio/parse.y | 1 + sbin/ipsecctl/parse.y | 1 + usr.sbin/bgpd/parse.y | 1 + usr.sbin/dvmrpd/parse.y | 1 + usr.sbin/httpd/parse.y| 1 + usr.sbin/ifstated/parse.y | 1 + usr.sbin/iscsictl/parse.y | 1 + usr.sbin/ldpd/parse.y | 1 + usr.sbin/ospf6d/parse.y | 1 + usr.sbin/ospfd/parse.y| 1 + usr.sbin/relayd/parse.y | 1 + usr.sbin/ripd/parse.y | 1 + usr.sbin/snmpd/parse.y| 1 + 13 files changed, 13 insertions(+) diff --git bin/chio/parse.y bin/chio/parse.y index 0d086c9..279d08f 100644 --- bin/chio/parse.y +++ bin/chio/parse.y @@ -31,6 +31,7 @@ #include #include #include +#include #include TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files); diff --git sbin/ipsecctl/parse.y sbin/ipsecctl/parse.y index 63d2796..f04ff88 100644 --- sbin/ipsecctl/parse.y +++ sbin/ipsecctl/parse.y @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include diff --git usr.sbin/bgpd/parse.y usr.sbin/bgpd/parse.y index 2021fbd..769f6e4 100644 --- usr.sbin/bgpd/parse.y +++ usr.sbin/bgpd/parse.y @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git usr.sbin/dvmrpd/parse.y usr.sbin/dvmrpd/parse.y index fabc9cc..56fcac7 100644 --- usr.sbin/dvmrpd/parse.y +++ usr.sbin/dvmrpd/parse.y @@ -36,6 +36,7 @@ #include #include #include +#include #include #include diff --git usr.sbin/httpd/parse.y usr.sbin/httpd/parse.y index 006cf4e..ce1e060 100644 --- usr.sbin/httpd/parse.y +++ usr.sbin/httpd/parse.y @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include diff --git usr.sbin/ifstated/parse.y usr.sbin/ifstated/parse.y index a010f8c..c1f721e 100644 --- usr.sbin/ifstated/parse.y +++ usr.sbin/ifstated/parse.y @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git usr.sbin/iscsictl/parse.y usr.sbin/iscsictl/parse.y index d199c81..fecde41 100644 --- usr.sbin/iscsictl/parse.y +++ usr.sbin/iscsictl/parse.y @@ -38,6 +38,7 @@ #include #include #include +#include #include #include diff --git usr.sbin/ldpd/parse.y usr.sbin/ldpd/parse.y index ee070ca..4821d51 100644 --- usr.sbin/ldpd/parse.y +++ usr.sbin/ldpd/parse.y @@ -36,6 +36,7 @@ #include #include #include +#include #include #include diff --git usr.sbin/ospf6d/parse.y usr.sbin/ospf6d/parse.y index 01a2731..1ba57c9 100644 --- usr.sbin/ospf6d/parse.y +++ usr.sbin/ospf6d/parse.y @@ -37,6 +37,7 @@ #include #include #include +#include #include #include diff --git usr.sbin/ospfd/parse.y usr.sbin/ospfd/parse.y index 09e6922..1909fa3 100644 --- usr.sbin/ospfd/parse.y +++ usr.sbin/ospfd/parse.y @@ -35,6 +35,7 @@ #include #include #include +#include #include #include diff --git usr.sbin/relayd/parse.y usr.sbin/relayd/parse.y index 6bd980b..4092cd6 100644 --- usr.sbin/relayd/parse.y +++ usr.sbin/relayd/parse.y @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git usr.sbin/ripd/parse.y usr.sbin/ripd/parse.y index dacb201..0d224c9 100644 --- usr.sbin/ripd/parse.y +++ usr.sbin/ripd/parse.y @@ -36,6 +36,7 @@ #include #include #include +#include #include #include diff --git usr.sbin/snmpd/parse.y usr.sbin/snmpd/parse.y index cea9194..72f020f 100644 --- usr.sbin/snmpd/parse.y +++ usr.sbin/snmpd/parse.y @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include -- 2.3.3
ehci(4) Full-speed isochronous transfers support
With the increasing number of machines shipping with rate-matching hubs instead of companion controllers to support USB Full and Low- speed devices, a number of people asked me if it was possible to add support for Full-speed isochronous transfers in order to use USB1.1 uaudio(4) devices with ehci(4)-only systems. The diff below does that. It also contain some cleanups for the High-speed isochronous code and plug some memory leaks for free. Please let me know how it goes with 1.1 and 2.0 devices. Index: ehci.c === RCS file: /cvs/src/sys/dev/usb/ehci.c,v retrieving revision 1.182 diff -u -p -r1.182 ehci.c --- ehci.c 25 Mar 2015 13:23:05 - 1.182 +++ ehci.c 28 Mar 2015 10:23:48 - @@ -106,6 +106,7 @@ voidehci_check_intr(struct ehci_softc void ehci_check_qh_intr(struct ehci_softc *, struct usbd_xfer *); void ehci_check_itd_intr(struct ehci_softc *, struct usbd_xfer *); void ehci_idone(struct usbd_xfer *); +void ehci_isoc_idone(struct usbd_xfer *); void ehci_timeout(void *); void ehci_timeout_task(void *); void ehci_intrlist_timeout(void *); @@ -163,10 +164,12 @@ usbd_status ehci_alloc_sqtd_chain(struct struct usbd_xfer *, struct ehci_soft_qtd **, struct ehci_soft_qtd **); void ehci_free_sqtd_chain(struct ehci_softc *, struct ehci_xfer *); -struct ehci_soft_itd *ehci_alloc_itd(struct ehci_softc *sc); -void ehci_free_itd(struct ehci_softc *sc, struct ehci_soft_itd *itd); -void ehci_rem_free_itd_chain(struct ehci_softc *sc, - struct ehci_xfer *); +struct ehci_soft_itd *ehci_alloc_itd(struct ehci_softc *); +void ehci_free_itd(struct ehci_softc *, struct ehci_soft_itd *); +void ehci_rem_itd_chain(struct ehci_softc *, struct ehci_xfer *); +void ehci_free_itd_chain(struct ehci_softc *, struct ehci_xfer *); +intehci_alloc_itd_chain(struct ehci_softc *, struct usbd_xfer *); +intehci_alloc_sitd_chain(struct ehci_softc *, struct usbd_xfer *); void ehci_abort_isoc_xfer(struct usbd_xfer *xfer, usbd_status status); @@ -191,7 +194,6 @@ voidehci_dump_sqtd(struct ehci_soft_qt void ehci_dump_qtd(struct ehci_qtd *); void ehci_dump_sqh(struct ehci_soft_qh *); #if notyet -void ehci_dump_sitd(struct ehci_soft_itd *itd); void ehci_dump_itd(struct ehci_soft_itd *); #endif #ifdef DIAGNOSTIC @@ -353,8 +355,10 @@ ehci_init(struct ehci_softc *sc) sc->sc_softitds = mallocarray(sc->sc_flsize, sizeof(struct ehci_soft_itd *), M_USB, M_NOWAIT | M_ZERO); - if (sc->sc_softitds == NULL) + if (sc->sc_softitds == NULL) { + usb_freemem(&sc->sc_bus, &sc->sc_fldma); return (ENOMEM); + } LIST_INIT(&sc->sc_freeitds); TAILQ_INIT(&sc->sc_intrhead); @@ -469,6 +473,7 @@ ehci_init(struct ehci_softc *sc) ehci_free_sqh(sc, sc->sc_async_head); #endif bad1: + free(sc->sc_softitds, M_USB, sc->sc_flsize); usb_freemem(&sc->sc_bus, &sc->sc_fldma); return (err); } @@ -650,49 +655,36 @@ ehci_softintr(void *v) sc->sc_bus.intr_context--; } -/* Check for an interrupt. */ void ehci_check_intr(struct ehci_softc *sc, struct usbd_xfer *xfer) { - int attr; + int attr = xfer->pipe->endpoint->edesc->bmAttributes; - attr = xfer->pipe->endpoint->edesc->bmAttributes; if (UE_GET_XFERTYPE(attr) == UE_ISOCHRONOUS) ehci_check_itd_intr(sc, xfer); else ehci_check_qh_intr(sc, xfer); - - return; } void ehci_check_qh_intr(struct ehci_softc *sc, struct usbd_xfer *xfer) { struct ehci_xfer *ex = (struct ehci_xfer *)xfer; - struct ehci_soft_qtd *sqtd, *lsqtd; + struct ehci_soft_qtd *sqtd, *lsqtd = ex->sqtdend; uint32_t status; - if (ex->sqtdstart == NULL) { - printf("ehci_check_qh_intr: not valid sqtd\n"); - return; - } + KASSERT(ex->sqtdstart != NULL && ex->sqtdend != NULL); + + usb_syncmem(&lsqtd->dma, + lsqtd->offs + offsetof(struct ehci_qtd, qtd_status), + sizeof(lsqtd->qtd.qtd_status), + BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); - lsqtd = ex->sqtdend; -#ifdef DIAGNOSTIC - if (lsqtd == NULL) { - printf("ehci_check_qh_intr: lsqtd==0\n"); - return; - } -#endif /* * If the last TD is still active we need to check whether there * is a an error somewhere in the middle, or whether there was a * short packet (SPD and not ACTIVE). */ - usb_syncmem(&lsqtd->dma, - lsqtd->offs + offsetof(struct ehci_qtd, qtd_status), - sizeof(lsqtd->qtd.qtd_status), -
Re: ssh-add.1 / ssh-askpass clarification
On Fri, Mar 27, 2015 at 08:04:08PM -0400, Jiri B wrote: > On Fri, Mar 27, 2015 at 11:22:07PM +, Jason McIntyre wrote: > > On Fri, Mar 27, 2015 at 07:07:04PM -0400, Jiri B wrote: > > > Mentioning 'ssh-askpass' is used when SSH_ASKPASS > > > is not set. > > > > > > j. > > > > > > Index: ssh-add.1 > > > === > > > RCS file: /cvs/src/usr.bin/ssh/ssh-add.1,v > > > retrieving revision 1.61 > > > diff -u -p -u -p -r1.61 ssh-add.1 > > > --- ssh-add.1 21 Dec 2014 22:27:56 - 1.61 > > > +++ ssh-add.1 27 Mar 2015 23:04:27 - > > > @@ -152,11 +152,11 @@ If > > > .Nm > > > does not have a terminal associated with it but > > > .Ev DISPLAY > > > -and > > > +is set, it will execute the program specified by > > > .Ev SSH_ASKPASS > > > -are set, it will execute the program specified by > > > -.Ev SSH_ASKPASS > > > -and open an X11 window to read the passphrase. > > > +if not set, by default > > > +.Pa ssh-askpass > > > +, and open an X11 window to read the passphrase. > > > This is particularly useful when calling > > > .Nm > > > from a > > > > > > > maybe this is clearer: > > > > Index: ssh-add.1 > > === > > RCS file: /cvs/src/usr.bin/ssh/ssh-add.1,v > > retrieving revision 1.61 > > diff -u -r1.61 ssh-add.1 > > --- ssh-add.1 21 Dec 2014 22:27:56 - 1.61 > > +++ ssh-add.1 27 Mar 2015 23:21:34 - > > @@ -88,12 +88,11 @@ > > .It Fl c > > Indicates that added identities should be subject to confirmation before > > being used for authentication. > > -Confirmation is performed by the > > -.Ev SSH_ASKPASS > > -program mentioned below. > > -Successful confirmation is signaled by a zero exit status from the > > -.Ev SSH_ASKPASS > > -program, rather than text entered into the requester. > > +Confirmation is performed by > > +.Xr ssh-askpass 1 . > > +Successful confirmation is signaled by a zero exit status from > > +.Xr ssh-askpass 1 , > > +rather than text entered into the requester. > > .It Fl D > > Deletes all identities from the agent. > > .It Fl d > > @@ -156,6 +155,8 @@ > > .Ev SSH_ASKPASS > > are set, it will execute the program specified by > > .Ev SSH_ASKPASS > > +(by default > > +.Dq ssh-askpass ) > > and open an X11 window to read the passphrase. > > This is particularly useful when calling > > .Nm > > @@ -197,6 +198,7 @@ > > .Sh SEE ALSO > > .Xr ssh 1 , > > .Xr ssh-agent 1 , > > +.Xr ssh-askpass 1 , > > .Xr ssh-keygen 1 , > > .Xr sshd 8 > > .Sh AUTHORS > > IIUC the point is SSH_ASKPASS does not need to be set, if not set > it falls back to /usr/X11R6/bin/ssh-askpass. But I can be wrong. > > j. > i'm sorry, but i don;t see exactly the issue. currently the doc (specifically -c) refers to SSH_ASKPASS. i understand you want to be clear that SSH_ASKPASS does not need to be set, so you added some text to say that explicitly. my diff takes a different approach - it is actually not that common to talk about the environment variable when a sane default exists. usually we document the usual case and in ENVIRONMENT we document the variable that can override defualt behaviour. my diff does that. have i misunderstood something? jmc