diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-04 21:31:23 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-04 21:31:23 -0700 |
commit | bba90b4e87be3ae5a13d69f6d9c60aa97761c8d5 (patch) | |
tree | 5a1023e003b6624ad528d8ff7be62621092eb269 | |
parent | 352aa83c416a78e59be4dfa7d8442e5eec50130a (diff) |
Sun bug 6852921: Recycling Xorg runs out of file descriptors in kbd driver
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6852921
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r-- | src/sun_kbd.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/sun_kbd.c b/src/sun_kbd.c index b4ebc57..1c87a24 100644 --- a/src/sun_kbd.c +++ b/src/sun_kbd.c @@ -65,6 +65,7 @@ #include <sys/kbd.h> static int KbdOn(InputInfoPtr pInfo, int what); +static void CloseKeyboard(InputInfoPtr pInfo); static void sunKbdSetLeds(InputInfoPtr pInfo, int leds) @@ -236,6 +237,11 @@ KbdOff(InputInfoPtr pInfo, int what) int i; + if (priv->remove_timer) { + TimerFree(priv->remove_timer); + priv->remove_timer = NULL; + } + if (!priv->kbdActive) { return Success; } @@ -245,11 +251,6 @@ KbdOff(InputInfoPtr pInfo, int what) return Success; } - if (priv->remove_timer) { - TimerFree(priv->remove_timer); - priv->remove_timer = NULL; - } - /* restore original state */ if (priv->oleds != -1) { @@ -288,7 +289,7 @@ KbdOff(InputInfoPtr pInfo, int what) } } - priv->kbdActive = FALSE; + CloseKeyboard(pInfo); return Success; } @@ -385,20 +386,26 @@ SetKbdRepeat(InputInfoPtr pInfo, char rad) /* Nothing to do */ } -/* Called from OsTimer callback, since removing a device from the device - list or changing pInfo->fd while xf86Wakeup is looping through the list - causes server crashes */ -static CARD32 -RemoveKeyboard(OsTimerPtr timer, CARD32 time, pointer arg) +static void +CloseKeyboard(InputInfoPtr pInfo) { - InputInfoPtr pInfo = (InputInfoPtr) arg; KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private; close(pInfo->fd); pInfo->fd = -1; priv->kbdActive = FALSE; +} + +/* Called from OsTimer callback, since removing a device from the device + list or changing pInfo->fd while xf86Wakeup is looping through the list + causes server crashes */ +static CARD32 +RemoveKeyboard(OsTimerPtr timer, CARD32 time, pointer arg) +{ + InputInfoPtr pInfo = (InputInfoPtr) arg; + CloseKeyboard(pInfo); xf86DisableDevice(pInfo->dev, TRUE); return 0; /* All done, don't set to run again */ |