[Glibc-bsd-commits] r3383 - trunk/freebsd-moused/debian/patches

Guillem Jover guillem at alioth.debian.org
Tue May 31 04:01:01 UTC 2011


Author: guillem
Date: 2011-05-31 04:01:01 +0000 (Tue, 31 May 2011)
New Revision: 3383

Added:
   trunk/freebsd-moused/debian/patches/inline-kld_funcs.patch
Log:
Add missed file in previous commit


Added: trunk/freebsd-moused/debian/patches/inline-kld_funcs.patch
===================================================================
--- trunk/freebsd-moused/debian/patches/inline-kld_funcs.patch	                        (rev 0)
+++ trunk/freebsd-moused/debian/patches/inline-kld_funcs.patch	2011-05-31 04:01:01 UTC (rev 3383)
@@ -0,0 +1,58 @@
+Revert r155805, which replaces the contents of usbmodule() with the new kld
+function from libutil.
+
+---
+ usr.sbin/moused/moused.c |   35 ++++++++++++++++++++++++++++++++++-
+ 1 file changed, 34 insertions(+), 1 deletion(-)
+
+--- a/usr.sbin/moused/moused.c
++++ b/usr.sbin/moused/moused.c
+@@ -48,6 +48,8 @@
+ 
+ #include <sys/param.h>
+ #include <sys/consio.h>
++#include <sys/linker.h>
++#include <sys/module.h>
+ #include <sys/mouse.h>
+ #include <sys/socket.h>
+ #include <sys/stat.h>
+@@ -957,7 +959,38 @@ main(int argc, char *argv[])
+ static int
+ usbmodule(void)
+ {
+-    return (kld_isloaded("uhub/ums") || kld_load("ums") != -1);
++    struct kld_file_stat fstat;
++    struct module_stat mstat;
++    int fileid, modid;
++    int loaded;
++
++    for (loaded = 0, fileid = kldnext(0); !loaded && fileid > 0;
++        fileid = kldnext(fileid)) {
++       fstat.version = sizeof(fstat);
++       if (kldstat(fileid, &fstat) < 0)
++           continue;
++       if (strncmp(fstat.name, "uhub/ums", 8) == 0) {
++           loaded = 1;
++           break;
++       }
++       for (modid = kldfirstmod(fileid); modid > 0;
++            modid = modfnext(modid)) {
++           mstat.version = sizeof(mstat);
++           if (modstat(modid, &mstat) < 0)
++               continue;
++           if (strncmp(mstat.name, "uhub/ums", 8) == 0) {
++               loaded = 1;
++               break;
++           }
++       }
++    }
++    if (!loaded) {
++       if (kldload("ums") != -1)
++           return 1;
++       if (errno != EEXIST)
++           logerr(1, "unable to load USB mouse driver");
++    }
++    return 0;
+ }
+ 
+ /*




More information about the Glibc-bsd-commits mailing list