USB abort tasks & deadlock

2015-01-11 Thread Martin Pieuchot
If you're detaching a USB device while another thread is still holding
a reference on it (ifconfig/dhclient for example) you might end up in
a deadlock situation and you'll have to reboot* to use your USB ports.

This deadlock is triggered if the thread detaching your device sleeps
in the *_detach() function waiting for all the previously submitted 
USB transfer to finish.  Sleeping in a *_detach() function means that
the USB device has been flagged as `dying'.  But our custom USB task
code prevent any task to be scheduled as soon as the device is dying.

Sadly, if your device has been detached, there's a lot of chances that
its transfers time out.  Since a timed out transfer needs a task to be
properly completed but our stack does not allow tasks to be scheduled
anymore -> deadlock.

If you've ever found yourself with a non working USB, you can use ps(1)
to see if one of your threads is waiting on "usbsync", the symptom of
this deadlock.

# ps axk -Owchan |grep usbsync

Diff below changes the USB task code to allow abort tasks to be scheduled
and executed even if the device is dying.  This should be safe because
aborting the pipe will remove the task if it hasn't been executed.

Comments, ok?

* If you can break into DDB you don't necessarily need to reboot when
such deadlock occurs. First get the xfer address (wait channel) for the
stuck thread:
# ps axk -Onwchan |grep usbsync

Then break into DDB and finish the transfer manually:
ddb> call usb_transfer_comple(0xnwchan_addr)

Index: usb.c
===
RCS file: /cvs/src/sys/dev/usb/usb.c,v
retrieving revision 1.103
diff -u -p -r1.103 usb.c
--- usb.c   18 Dec 2014 10:44:17 -  1.103
+++ usb.c   11 Jan 2015 22:41:14 -
@@ -298,8 +298,13 @@ usb_add_task(struct usbd_device *dev, st
 {
int s;
 
-   /* Don't add task if the device's root hub is dying. */
-   if (usbd_is_dying(dev))
+   /*
+* If the thread detaching ``dev'' is sleeping, waiting
+* for all submitted transfers to finish, we must be able
+* to enqueue abort tasks.  Otherwise timeouts can't give
+* back submitted transfers to the stack.
+*/
+   if (usbd_is_dying(dev) && (task->type != USB_TASK_TYPE_ABORT))
return;
 
DPRINTFN(2,("%s: task=%p state=%d type=%d\n", __func__, task,
@@ -455,12 +460,9 @@ usb_abort_task_thread(void *arg)
 */
task->state |= USB_TASK_STATE_RUN;
task->state &= ~USB_TASK_STATE_ONQ;
-   /* Don't actually execute the task if dying. */
-   if (!usbd_is_dying(task->dev)) {
-   splx(s);
-   task->fun(task->arg);
-   s = splusb();
-   }
+   splx(s);
+   task->fun(task->arg);
+   s = splusb();
task->state &= ~USB_TASK_STATE_RUN;
if (task->state == USB_TASK_STATE_NONE)
wakeup(task);



Re: env fix

2015-01-11 Thread Theo de Raadt
> > On Sun, 11 Jan 2015, Ted Unangst wrote:
> >> Even more awesome.
> >
> > How about enforcing the full rule?
> 
> IIUC the first diff removed '/' from the characters allowed in an
> environment variable, so that one can run env(1) and a program whose
> name contains '='...  I've never seen such a program name.
> 
> I think this is not env(1)'s job to tell which letters can be put in
> a environment variable name; other env(1) implementations don't seem to
> care at all.
> 
> btw, in ksh
> 
>   FOO=bar BAZ=quuz ./your=program
> 
> works around the "no '=' in program name" rule; I seriously doubt this
> is a concern though.

I don't see how this improves env.

Now it has a difference from other systems.  How do you use it
portably?  You can't.  The portable behaviour is that it fails like now.



Re: env fix

2015-01-11 Thread Jérémie Courrèges-Anglas
Philip Guenther  writes:

> On Sun, 11 Jan 2015, Ted Unangst wrote:
>> Even more awesome.
>
> How about enforcing the full rule?

IIUC the first diff removed '/' from the characters allowed in an
environment variable, so that one can run env(1) and a program whose
name contains '='...  I've never seen such a program name.

I think this is not env(1)'s job to tell which letters can be put in
a environment variable name; other env(1) implementations don't seem to
care at all.

btw, in ksh

  FOO=bar BAZ=quuz ./your=program

works around the "no '=' in program name" rule; I seriously doubt this
is a concern though.

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: env fix

2015-01-11 Thread Ted Unangst
On Sun, Jan 11, 2015 at 13:53, Philip Guenther wrote:
> On Sun, 11 Jan 2015, Ted Unangst wrote:
>> Even more awesome.
> 
> How about enforcing the full rule?

And now you've gone full awesome.



Re: env fix

2015-01-11 Thread Philip Guenther
On Sun, 11 Jan 2015, Ted Unangst wrote:
> Even more awesome.

How about enforcing the full rule?

Index: env.c
===
RCS file: /cvs/src/usr.bin/env/env.c,v
retrieving revision 1.15
diff -u -p -r1.15 env.c
--- env.c   8 Mar 2014 00:09:20 -   1.15
+++ env.c   11 Jan 2015 21:52:32 -
@@ -29,6 +29,7 @@
  * SUCH DAMAGE.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -39,12 +40,22 @@
 
 __dead void usage(void);
 
+/*
+ * POSIX XBD definition of 'name':
+ * In the shell command language, a word consisting solely of
+ * underscores, digits, and alphabetics from the portable character
+ * set. The first character of a name is not a digit.
+ */
+static const char varchar[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
+
 int
 main(int argc, char *argv[])
 {
extern char **environ;
extern int optind;
char **ep, *p;
+   size_t n;
int ch;
 
setlocale(LC_ALL, "");
@@ -62,9 +73,14 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
 
-   for (; *argv && (p = strchr(*argv, '=')); ++argv) {
-   *p++ = '\0';
-   if (setenv(*argv, p, 1) == -1) {
+   for (; p = *argv; ++argv) {
+   /* is the argument an assignment to a legal name? */
+   if (isdigit((unsigned char)*p) ||
+   (n = strspn(p, varchar)) == 0 ||
+   p[n] != '=')
+   break;
+   p[n] = '\0';
+   if (setenv(p, p + n + 1, 1) == -1) {
/* reuse 126, it matches the problem most */
err(126, "setenv");
}
Index: env.1
===
RCS file: /cvs/src/usr.bin/env/env.1,v
retrieving revision 1.19
diff -u -p -r1.19 env.1
--- env.1   8 Mar 2014 01:42:17 -   1.19
+++ env.1   11 Jan 2015 21:52:32 -
@@ -68,6 +68,16 @@ Causes
 to completely ignore the environment it inherits.
 .El
 .Pp
+To be treated as an assignment, the
+.Ar name
+before the equals-sign must consist only of underscores, digits, and letters,
+and must not start with a digit.
+The first argument to
+.Nm
+that doesn't meet that criteria will be considered the
+.Ar utility
+to execute.
+.Pp
 If no
 .Ar utility
 is specified,
@@ -119,9 +129,3 @@ specification.
 The historic
 .Fl
 option has been deprecated but is still supported in this implementation.
-.Sh BUGS
-.Nm
-doesn't handle commands with equal
-.Pq Sq =
-signs in their
-names, for obvious reasons.



Re: env fix

2015-01-11 Thread Ted Unangst
On Sun, Jan 11, 2015 at 11:26, Philip Guenther wrote:
> On Sun, Jan 11, 2015 at 9:36 AM, Ted Unangst  wrote:
>> env won't run a command with an = in its name. This is documented as a
>> bug, but it's easily fixed in a backwards compatible way.
> ...
>> +   if (strcmp(*argv, "--") == 0)
>> +   argv++;
> 
> No, "env foo=bar -- baz=qux" really should try to execute "--": the
> enviroment variables aren't an option string being processed with
> getopt().
> 
> What we *can* do is enforce a bit more this requirement on environment names:
> In the shell command language, a word consisting solely of
> underscores, digits, and alphabetics
> from the portable character set. The first character of a name is
> not a digit.
> 
> Slash is not legal in shell variable names, so if we treat an argument
> containing a slash before the = as the command instead of a variable
> assignment, users have an escape hatch a do something like:
> env foo=bar ./my=cool=program
> or
> env foo=bar `which another=test`
> 
> etc.
> 
> Something like this on the code side?

Even more awesome.


> 
> PHilip
> 
> --- env.c   8 Mar 2014 00:09:20 -   1.15
> +++ env.c   11 Jan 2015 19:20:36 -
> @@ -63,6 +63,8 @@ main(int argc, char *argv[])
> argv += optind;
> 
> for (; *argv && (p = strchr(*argv, '=')); ++argv) {
> +   if (memchr(*argv, '/', p - *argv) != NULL)
> +   break;
> *p++ = '\0';
> if (setenv(*argv, p, 1) == -1) {
> /* reuse 126, it matches the problem most */



Re: env fix

2015-01-11 Thread Philip Guenther
On Sun, Jan 11, 2015 at 9:36 AM, Ted Unangst  wrote:
> env won't run a command with an = in its name. This is documented as a
> bug, but it's easily fixed in a backwards compatible way.
...
> +   if (strcmp(*argv, "--") == 0)
> +   argv++;

No, "env foo=bar -- baz=qux" really should try to execute "--": the
enviroment variables aren't an option string being processed with
getopt().

What we *can* do is enforce a bit more this requirement on environment names:
In the shell command language, a word consisting solely of
underscores, digits, and alphabetics
from the portable character set. The first character of a name is
not a digit.

Slash is not legal in shell variable names, so if we treat an argument
containing a slash before the = as the command instead of a variable
assignment, users have an escape hatch a do something like:
env foo=bar ./my=cool=program
or
env foo=bar `which another=test`

etc.

Something like this on the code side?

PHilip

--- env.c   8 Mar 2014 00:09:20 -   1.15
+++ env.c   11 Jan 2015 19:20:36 -
@@ -63,6 +63,8 @@ main(int argc, char *argv[])
argv += optind;

for (; *argv && (p = strchr(*argv, '=')); ++argv) {
+   if (memchr(*argv, '/', p - *argv) != NULL)
+   break;
*p++ = '\0';
if (setenv(*argv, p, 1) == -1) {
/* reuse 126, it matches the problem most */



env fix

2015-01-11 Thread Ted Unangst
env won't run a command with an = in its name. This is documented as a
bug, but it's easily fixed in a backwards compatible way.

Index: env.1
===
RCS file: /cvs/src/usr.bin/env/env.1,v
retrieving revision 1.19
diff -u -p -r1.19 env.1
--- env.1   8 Mar 2014 01:42:17 -   1.19
+++ env.1   11 Jan 2015 17:32:32 -
@@ -119,9 +119,3 @@ specification.
 The historic
 .Fl
 option has been deprecated but is still supported in this implementation.
-.Sh BUGS
-.Nm
-doesn't handle commands with equal
-.Pq Sq =
-signs in their
-names, for obvious reasons.
Index: env.c
===
RCS file: /cvs/src/usr.bin/env/env.c,v
retrieving revision 1.15
diff -u -p -r1.15 env.c
--- env.c   8 Mar 2014 00:09:20 -   1.15
+++ env.c   11 Jan 2015 17:32:07 -
@@ -69,6 +69,8 @@ main(int argc, char *argv[])
err(126, "setenv");
}
}
+   if (strcmp(*argv, "--") == 0)
+   argv++;
 
if (*argv) {
/*



Re: 5.6, IPv6: is autoconf set by default?

2015-01-11 Thread Josh Grosse
On Sat, Jan 10, 2015 at 06:09:21PM +, Stuart Henderson wrote:
> On 2015/01/10 14:54, Florian Obser wrote:
> > I don't think this is entirely correct. eui64 enables IPv6 on an interface
> > by setting a link local address. For lo0 it also sets ::1.
> > I'm unsure what eui64 was supposed to do
> > when IPv6 was on by default and there was no way to disable it.
> 
> Historically eui64 was used like this:
> 
> ifconfig vlan4 inet6 2001:db8:: eui64
> 
> and it would fill in the bottom 64 bits for you, i.e.
> 
> 2001:db8::f2de:f1ff:fea3:bc17/64
> 

And this was the use-case I tried to describe (insufficiently)
in my ifconfig.8 patch.  

> That is still the "normal" use for eui64, prior to it now doing
> double-duty as "re-enable ipv6 on this interface and set things up
> as they used to be".
> 
> > btw. I'm still trying to figure out what setia6eui64() in ifconfig.c
> > is trying to achieve, the code after addaf() looks peculiar. If it's
> > just error checking it looks complicated.
> 
> Related to the above. And oh, that uses the "interface index"
> terminology in a printf...
> 



Re: Kernel does not compile with option LOCKDEBUG

2015-01-11 Thread Alexey Suslikov
Philip Guenther  gmail.com> writes:

> It's dead, Jim, let's bury LOCKDEBUG.

There is an define AZALIA_LOG_MP and accompanying code in
sys/dev/pci/azalia.c which looks like a debug left-over.

azalia(4) is considered MP-safe for over a year from now.



Re: bgpd.conf macros on 5.5 and up

2015-01-11 Thread Claudio Jeker
On Sat, Jan 10, 2015 at 02:21:40PM +, Stuart Henderson wrote:
> moved from misc@ (http://marc.info/?l=openbsd-misc&m=141898047318322&w=2)
> 
> On 2014-12-19, Tony Sarendal  wrote:
> > From 5.5 and up it looks like bgpd macros are broken.
> 
> I suspect this is parse.y r1.268.
> 
> > Also, the example from bgpd.conf man page fails on 5.4-5.6.
> > I haven't tested on 5.3 and lower.
> >
> > On 5.6 snapshot:
> > tonsar@obc1$ uname -mrsv
> > OpenBSD 5.6 GENERIC.MP#701 amd64
> > tonsar@obc1$ cat bgpd.conf-2
> > good="{ 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
> > bad="{ 224.0.0.0/4 prefixlen >= 4, 240.0.0.0/4 prefixlen >= 4 }"
> > ugly="{ 127.0.0.1/8, 169.254.0.0/16 }"
> > # global configuration
> > AS 65001
> > deny from any prefix { $good $bad $ugly }
> > tonsar@obc1$ bgpd -f bgpd.conf-2 -nv
> > good = "{ 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
> > bad = "{ 224.0.0.0/4 prefixlen >= 4, 240.0.0.0/4 prefixlen >= 4 }"
> > ugly = "{ 127.0.0.1/8, 169.254.0.0/16 }"
> > bgpd.conf-2:6: syntax error
> > tonsar@obc1$
> 
> It looks like nested braces no longer work.
> 
> { { 1.1.1.1/30 } { 2.2.2.2/30 } } - fails
> { 1.1.1.1/30 2.2.2.2/30 } - works
> 
> With my poor yacc skills the best I can do for now is suggest a manpage
> diff, though other parsers (e.g. pf's) do allow nesting in this situation.
> 
> Index: bgpd.conf.5
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/bgpd.conf.5,v
> retrieving revision 1.132
> diff -u -p -r1.132 bgpd.conf.5
> --- bgpd.conf.5   10 Nov 2014 20:48:33 -  1.132
> +++ bgpd.conf.5   10 Jan 2015 14:13:58 -
> @@ -1210,9 +1210,9 @@ deny from any prefix { 192.168.0.0/16, 1
>  Multiple lists can also be specified, which is useful for
>  macro expansion:
>  .Bd -literal -offset indent
> -good="{ 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
> -bad="{ 224.0.0.0/4 prefixlen >= 4, 240.0.0.0/4 prefixlen >= 4 }"
> -ugly="{ 127.0.0.1/8, 169.254.0.0/16 }"
> +good="192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8"
> +bad="224.0.0.0/4 prefixlen >= 4, 240.0.0.0/4 prefixlen >= 4"
> +ugly="127.0.0.1/8, 169.254.0.0/16"
>  
>  deny from any prefix { $good $bad $ugly }
>  .Ed
> 
> 

I think we should fix the parser and not the docu.

-- 
:wq Claudio



Re: massage volume control task

2015-01-11 Thread David Gwynne

> On 3 Jan 2015, at 9:35 am, David Gwynne  wrote:
> 
>> 
>> On 2 Jan 2015, at 9:55 pm, Mark Kettenis  wrote:
>> 
>>> Date: Fri, 2 Jan 2015 16:15:07 +1000
>>> From: David Gwynne 
>>> 
>>> can someone test this?
>>> 
>>> it allocates storage for the volume change details rather than cast
>>> arguments to a single global task.
>>> 
>>> adds some safety while there if audio0 is a hotplug device.
>>> 
>>> ok?
>> 
>> The problem with this approach is that things silently fail when
>> memory allocation fails.  Exactly the problem that workq_add_task()
>> had.  Perhaps the best thing is to store the "event" in the softc,
>> although then you'd probably need some locking to make sure the task
>> sees a consistent dir/out pair.
> 
> is "silently fail" a pun here?
> 
> you can lose events either way. if you get more than one keypress before the 
> task runs, you'll lose. if you are in a situation where you cant allocate 
> memory, you lose.
> 
> i think the code generally is bogus so im trying to do as little as possible 
> to it. the more i look at it the more i want to just remove it.
> 
> its been unreliable in all incarnations.

did anyone try this diff?

dlg

> 
>> 
>>> Index: audio.c
>>> ===
>>> RCS file: /cvs/src/sys/dev/audio.c,v
>>> retrieving revision 1.125
>>> diff -u -p -r1.125 audio.c
>>> --- audio.c 19 Dec 2014 22:44:58 -  1.125
>>> +++ audio.c 2 Jan 2015 06:08:39 -
>>> @@ -465,11 +465,6 @@ audioattach(struct device *parent, struc
>>> }
>>> DPRINTF(("audio_attach: inputs ports=0x%x, output ports=0x%x\n",
>>>  sc->sc_inports.allports, sc->sc_outports.allports));
>>> -
>>> -#if NWSKBD > 0
>>> -   task_set(&sc->sc_mixer_task, wskbd_set_mixervolume_callback, NULL,
>>> -   NULL);
>>> -#endif /* NWSKBD > 0 */
>>> }
>>> 
>>> int
>>> @@ -3432,27 +3427,39 @@ filt_audiowrite(struct knote *kn, long h
>>> }
>>> 
>>> #if NWSKBD > 0
>>> +struct wskbd_vol_change {
>>> +   struct task t;
>>> +   long dir;
>>> +   long out;
>>> +};
>>> +
>>> int
>>> wskbd_set_mixervolume(long dir, long out)
>>> {
>>> struct audio_softc *sc;
>>> +   struct wskbd_vol_change *ch;
>>> 
>>> if (audio_cd.cd_ndevs == 0 || (sc = audio_cd.cd_devs[0]) == NULL) {
>>> DPRINTF(("wskbd_set_mixervolume: audio_cd\n"));
>>> return (ENXIO);
>>> }
>>> 
>>> -   task_del(systq, &sc->sc_mixer_task);
>>> -   task_set(&sc->sc_mixer_task, wskbd_set_mixervolume_callback,
>>> -   (void *)dir, (void *)out);
>>> -   task_add(systq, &sc->sc_mixer_task);
>>> +   ch = malloc(sizeof(*ch), M_TEMP, M_NOWAIT);
>>> +   if (ch == NULL)
>>> +   return (ENOMEM);
>>> +
>>> +   task_set(&ch->t, wskbd_set_mixervolume_callback, ch, NULL);
>>> +   ch->dir = dir;
>>> +   ch->out = out;
>>> +   task_add(systq, &ch->t);
>>> 
>>> return (0);
>>> }
>>> 
>>> void
>>> -wskbd_set_mixervolume_callback(void *arg1, void *arg2)
>>> +wskbd_set_mixervolume_callback(void *xch, void *null)
>>> {
>>> +   struct wskbd_vol_change *ch = xch;
>>> struct audio_softc *sc;
>>> struct au_mixer_ports *ports;
>>> mixer_devinfo_t mi;
>>> @@ -3461,19 +3468,19 @@ wskbd_set_mixervolume_callback(void *arg
>>> u_int gain;
>>> int error;
>>> 
>>> -   if (audio_cd.cd_ndevs == 0 || (sc = audio_cd.cd_devs[0]) == NULL) {
>>> -   DPRINTF(("%s: audio_cd\n", __func__));
>>> -   return;
>>> -   }
>>> +   dir = ch->dir;
>>> +   out = ch->out;
>>> +   free(ch, M_TEMP, sizeof(*ch));
>>> 
>>> -   dir = (long)arg1;
>>> -   out = (long)arg2;
>>> +   sc = (struct audio_softc *)device_lookup(&audio_cd, 0);
>>> +   if (sc == NULL)
>>> +   return;
>>> 
>>> ports = out ? &sc->sc_outports : &sc->sc_inports;
>>> 
>>> if (ports->master == -1) {
>>> DPRINTF(("%s: master == -1\n", __func__));
>>> -   return;
>>> +   goto done;
>>> }
>>> 
>>> if (dir == 0) {
>>> @@ -3482,7 +3489,7 @@ wskbd_set_mixervolume_callback(void *arg
>>> error = au_get_mute(sc, ports, &mute);
>>> if (error != 0) {
>>> DPRINTF(("%s: au_get_mute: %d\n", __func__, error));
>>> -   return;
>>> +   goto done;
>>> }
>>> 
>>> mute = !mute;
>>> @@ -3490,7 +3497,7 @@ wskbd_set_mixervolume_callback(void *arg
>>> error = au_set_mute(sc, ports, mute);
>>> if (error != 0) {
>>> DPRINTF(("%s: au_set_mute: %d\n", __func__, error));
>>> -   return;
>>> +   goto done;
>>> }
>>> } else {
>>> /* Raise or lower volume */
>>> @@ -3499,7 +3506,7 @@ wskbd_set_mixervolume_callback(void *arg
>>> error = sc->hw_if->query_devinfo(sc->hw_hdl, &mi);
>>> if (error != 0) {
>>> DPRINTF(("%s: query_devinfo: %d\n", __func__, error));
>>> -   return;
>>> +   goto done;
>>> }
>

Re: Kernel does not compile with option LOCKDEBUG

2015-01-11 Thread Helg
On Sat, 10 Jan 2015 19:39:19 -0800
Philip Guenther  wrote:

> On Mon, 5 Jan 2015, Helg wrote:
> > The man page for LOCK(9) says that if the kernel option LOCKDEBUG is 
> > enabled, additional facilities are provided to assist in determining 
> > deadlock occurrences.
> > 
> > I created a copy of /sys/arch/amd64/conf/GENERIC and added option 
> > LOCKDEBUG. Executing config and then make clean && make results in 
> > warnings like:
> > 
> > implicit declaration of function '__mp_lock'
> > 
> > Adding includes for  in the offending files resolves the 
> > problem but this just doesn't seem right.
> > 
> > Does anyone have any suggestions?
> 
> Yeah, don't use it.  It used to be a lot more when there were still traces 
> of the original "simplelocks" in the tree, but the code to do more with 
> LOCKDEBUG was ripped out as those no-ops were felt to be more misleading 
> than helpful.

Thanks. I figured as much when I started to look deeper into the
implementation of lockinit and lockmgr. These are now just legacy
wrappers for rwlock functions. Removing LOCKDEBUG makes sense to me.

> 
> It's dead, Jim, let's bury LOCKDEBUG.
> 
> oks?
> 
> 
> Philip
> 
> Index: sys/arch/i386/i386/trap.c
> ===
> RCS file: /cvs/src/sys/arch/i386/i386/trap.c,v
> retrieving revision 1.119
> diff -u -p -r1.119 trap.c
> --- sys/arch/i386/i386/trap.c 2 Dec 2014 18:13:10 -   1.119
> +++ sys/arch/i386/i386/trap.c 11 Jan 2015 03:33:48 -
> @@ -381,11 +381,6 @@ trap(struct trapframe *frame)
>   case T_PAGEFLT: /* allow page faults in kernel mode */
>   if (p == 0 || p->p_addr == 0)
>   goto we_re_toast;
> -#ifdef LOCKDEBUG
> - /* If we page-fault while in scheduler, we're doomed. */
> - if (__mp_lock_held(&sched_lock))
> - goto we_re_toast;
> -#endif
>  
>   pcb = &p->p_addr->u_pcb;
>  #if 0
> Index: sys/sys/sched.h
> ===
> RCS file: /cvs/src/sys/sys/sched.h,v
> retrieving revision 1.37
> diff -u -p -r1.37 sched.h
> --- sys/sys/sched.h   17 Oct 2014 01:51:39 -  1.37
> +++ sys/sys/sched.h   11 Jan 2015 03:33:48 -
> @@ -183,7 +183,7 @@ void remrunqueue(struct proc *);
>   yield();\
>  } while (0)
>  
> -#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
> +#if defined(MULTIPROCESSOR)
>  #include 
>  
>  /*
> @@ -215,7 +215,7 @@ do {  
> \
>   splx(s);\
>  } while (/* CONSTCOND */ 0)
>  
> -#else /* ! MULTIPROCESSOR || LOCKDEBUG */
> +#else /* ! MULTIPROCESSOR */
>  
>  #define  SCHED_ASSERT_LOCKED()   splassert(IPL_SCHED);
>  #define  SCHED_ASSERT_UNLOCKED() /* nothing */
> @@ -225,7 +225,7 @@ do {  
> \
>  #define  SCHED_LOCK(s)   s = splsched()
>  #define  SCHED_UNLOCK(s) splx(s)
>  
> -#endif /* MULTIPROCESSOR || LOCKDEBUG */
> +#endif /* MULTIPROCESSOR */
>  
>  #endif   /* _KERNEL */
>  #endif   /* _SYS_SCHED_H_ */
> Index: share/man/man9/lock.9
> ===
> RCS file: /cvs/src/share/man/man9/lock.9,v
> retrieving revision 1.22
> diff -u -p -r1.22 lock.9
> --- share/man/man9/lock.9 9 Jul 2014 14:16:10 -   1.22
> +++ share/man/man9/lock.9 11 Jan 2015 03:33:48 -
> @@ -57,10 +57,6 @@ single process.
>  It also allows upgrading a shared-access lock to an
>  exclusive-access lock, as well as downgrading an exclusive-access lock
>  to a shared-access lock.
> -.Pp
> -If the kernel option LOCKDEBUG is enabled, additional facilities
> -are provided to record additional lock information.
> -These facilities are provided to assist in determining deadlock occurrences.
>  .Sh FUNCTIONS
>  The functions which operate on locks are:
>  .Bl -tag -width Ds


-- 
Helg 



more airports

2015-01-11 Thread Kirill Bychkov
Hi.
This patch adds/fixes/extends airport data for some exUSSR airports I've been 
to.
OK?
Index: share/misc/airport
===
RCS file: /cvs/src/share/misc/airport,v
retrieving revision 1.47
diff -u -r1.47 airport
--- share/misc/airport  7 Jan 2015 16:08:50 -   1.47
+++ share/misc/airport  11 Jan 2015 08:18:53 -
@@ -11,7 +11,9 @@
 AAA:Anaa, Anaa, French Polynesia
 AAE:Rabah Bitat, Annaba, Algeria
 AAL:Aalborg, Denmark
+AAQ:Vityazevo, Anapa, Russia
 AAR:Aarhus, Aarhus, Denmark
+ABA:Abakan, Russia
 ABE:Lehigh Valley International, Pennsylvania, USA
 ABI:Abilene Regional, Abilene, Texas, USA
 ABJ:Port Bouet, Abidjan, Cote d'ivoire
@@ -39,6 +41,7 @@
 ADQ:Kodiak, Alaska, USA
 ADZ:Gustavo Rojas Pinilla International, San Andres Island, Colombia
 AEP:Jorge Newberry, Buenos Aires, Argentina
+AER:Sochi, Russia
 AES:Vigra, Aalesund, Norway
 AET:Allakaket, Alaska, USA
 AEX:Alexandria International, Louisiana, USA
@@ -553,7 +556,7 @@
 FRM:Fairmont Municipal, Minnesota, USA
 FRO:Floro, Norway
 FRS:Flores, Guatemala
-FRU:Bishkek, Kyrgyzstan
+FRU:Manas, Bishkek, Kyrgyzstan
 FSC:Figari, Corsica, France
 FSD:Joe Foss Field, Sioux Falls, South Dakota, USA
 FSM:Fort Smith Municipal, Arkansas, USA
@@ -701,6 +704,7 @@
 HRO:Boone County, Harrison, Arkansas, USA
 HSI:Hastings, Nebraska, USA
 HSV:Huntsville International, Alabama, USA
+HTA:Chita, Russia
 HTI:Hamilton Island, Queensland, Australia
 HUF:Terre Haute Hulman Regional, Indiana, USA
 HUI:Hue, Vietnam
@@ -845,7 +849,8 @@
 KEP:Nepalganj, Nepal
 KER:Kerman, Iran
 KGC:Kingscote, South Australia, Australia
-KGD:Kaliningrad, Russia
+KGD:Khrabrovo, Kaliningrad, Russia
+KGP:Kogalym, Russia
 KHE:Kherson International, Kherson, Ukraine
 KHH:Kaohsiung, Taiwan
 KHI:Karachi, Pakistan
@@ -856,7 +861,7 @@
 KIT:Kithira, Greece
 KIV:Kishinev, Moldova
 KIX:Kansai International, Osaka, Japan
-KJA:Krasnojarsk, Russia
+KJA:Yemelyanovo, Krasnoyarsk, Russia
 KKN:Hoeyburtmoen, Kirkenes, Norway
 KLO:Kalibo, Philippines
 KLR:Kalmar, Sweden
@@ -894,7 +899,7 @@
 KTR:Tindal, Katherine, Northern Territory, Australia
 KTW:Pyrzowice, Katowice, Poland
 KUA:Padang Geroda, Kuantan, Malaysia
-KUF:Samara, Russia
+KUF:Kurumoch, Samara, Russia
 KUL:Subang Kuala Lumpur International, Malaysia
 KUM:Yakushima, Japan
 KUN:Kaunas, Lithuania
@@ -907,6 +912,7 @@
 KWI:Kuwait International
 KWG:Kryvyi Rih International, Dnipropetrovs'k, Ukraine
 KWL:Guilin, China
+KXK:Khurba, Komsomolsk-on-Amur, Russia
 KZI:Kozani, Greece
 KZN:Kazan, Russia
 KZS:Kastelorizo, Greece
@@ -1043,6 +1049,7 @@
 MCP:Macapa, Amapa, Brazil
 MCT:Seeb, Muscat, Oman
 MCW:Mason City, Iowa, USA
+MCX:Uytash, Makhachkala, Dagestan, Russia
 MCY:Maroochydore, Sunshine Coast, Queensland, Australia
 MDC:Samratulang, Manado, Indonesia
 MDE:La Playas, Medellin, Colombia
@@ -1120,6 +1127,7 @@
 MRK:Marco Island, Florida, USA
 MRS:Marseille, France
 MRU:Sir Seewoosagur Ramgoolam Airport, Mauritius
+MRV:Mineralnye Vody, Russia
 MRY:Monterey, California, USA
 MSJ:Misawa, Japan
 MSL:Muscle Shoals, Muscle Shoals / Florence / Sheffield, Alabama, USA
@@ -1166,6 +1174,7 @@
 NCL:Newcastle International, England, United Kingdom
 NDJ:N'djamena, N Djamena, Chad
 NEC:Necochea, Buenos Aires, Argentina
+NER:Chulman, Neryungri, Russia
 NEV:Nevis, Leeward Islands, Saint Kitts And Nevis
 NGO:Komaki, Nagoya, Japan
 NGS:Nagasaki, Japan
@@ -1429,7 +1438,7 @@
 ROR:Airai, Koror, Palau
 ROS:Fisherton, Rosario, Santa Fe, Argentina
 ROU:Rousse, Bulgaria
-ROV:Rostov, Russia
+ROV:Rostov-on-Don, Russia
 ROW:Industrial Air Center, Roswell, New Mexico, USA
 RPR:Raipur, India
 RRG:Rodrigues Island, Mauritius
@@ -1575,6 +1584,7 @@
 STR:Echterdingen, Stuttgart, Germany
 STS:Sonoma County, Santa Rosa, California, USA
 STT:Cyril E King, St Thomas Island, US Virgin Islands, USA
+STW:Stavropol, Russia
 STX:St Croix Island, US Virgin Islands, USA
 SUB:Juanda, Surabaya, Indonesia
 SUE:Sturgeon Bay, Wisconsin, USA
@@ -1587,7 +1597,7 @@
 SVO:Sheremetyevo, Moscow, Russia
 SVQ:Sevilla, Spain
 SVU:Savusavu, Savusavu, Fiji
-SVX:Ekaterinburg, Russia
+SVX:Koltsovo, Ekaterinburg, Russia
 SVZ:San Antonio, Venezuela
 SWA:Shantou, China
 SWF:Stewart, Newburgh/Poughkeepsie, New York, USA
@@ -1648,7 +1658,7 @@
 TIV:Tivat, Montenegro
 TIZ:Tari, Papua New Guinea
 TJA:Tarija, Bolivia
-TJM:Tyumen, Russia
+TJM:Roshchino, Tyumen, Russia
 TKK:Truk, Caroline Islands, Micronesia
 TKQ:Kigoma, Tanzania
 TKS:Tokushima, Japan
@@ -1683,6 +1693,7 @@
 TRV:Trivandrum, India
 TRZ:Civil, Tiruchirapally, India
 TSA:Sung Shan, Taipei, Taiwan
+TSE:Astana, Kazakhstan
 TSR:Timisoara, Romania
 TSS:East 34Th Street Heliport, New York, New York, USA
 TSV:Townsville, Queensland, Australia
@@ -1716,6 +1727,7 @@
 UAQ:San Juan, Argentina
 UBJ:Ube, Japan
 UCA:Utica/Oneida County, New York, USA
+UCT:Ukhta, Russia
 UDJ:Uzhgorod International, Zakarpattia, Ukraine
 UDR:Udaipur, India
 UEL:Quelimane, Mozambique
@@ -1787,7 +1799,7 @@
 VTZ:Vishakhapatnam, India
 VUP:Valledupar,