This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ports/3063] New: sysctl syscall used by ioperm() on arm


The sysctl syscall has been removed in 2.6.18+ kernels and replaced by a dummy 
syscall returning an error. Therefore sysctl() could not be used anymore.

This function is used on ioperm() on arm. The values should be read from /proc 
instead. You will find a patch below to fix the problem.

--- libc/sysdeps/unix/sysv/linux/arm/ioperm.c.orig	2006-08-15 
18:23:08.715868260 +0200
+++ libc/sysdeps/unix/sysv/linux/arm/ioperm.c	2006-08-15 19:30:07.215439365 
+0200
@@ -49,6 +49,8 @@
 
 #define PATH_ARM_SYSTYPE	"/etc/arm_systype"
 #define PATH_CPUINFO		"/proc/cpuinfo"
+#define PATH_PORTBASE		"/proc/bus/isa/portbase"
+#define PATH_PORTSHIFT		"/proc/bus/isa/portshift"
 
 #define MAX_PORT	0x10000
 
@@ -100,15 +102,25 @@
 {
   char systype[256];
   int i, n;
-  static int iobase_name[] = { CTL_BUS, CTL_BUS_ISA, BUS_ISA_PORT_BASE };
-  static int ioshift_name[] = { CTL_BUS, CTL_BUS_ISA, BUS_ISA_PORT_SHIFT };
+  FILE * fp;
+
   size_t len = sizeof(io.base);
 
-  if (! sysctl (iobase_name, 3, &io.io_base, &len, NULL, 0)
-      && ! sysctl (ioshift_name, 3, &io.shift, &len, NULL, 0))
+  if (fp = fopen (PATH_PORTBASE, "r"))
     {
-      io.initdone = 1;
-      return 0;
+      n = fscanf (fp, "%li", &io.io_base);
+      fclose(fp);
+
+      if (n == 1 && (fp = fopen(PATH_PORTSHIFT, "r")))
+        {
+          n = fscanf (fp, "%i", &io.io_shift);
+          fclose(fp);
+          if (n == 1)
+	    {
+	      io.initdone = 1;
+              return 0;
+	    }
+	}
     }
 
   n = readlink (PATH_ARM_SYSTYPE, systype, sizeof (systype) - 1);
@@ -127,8 +139,6 @@
     }
   else
     {
-      FILE * fp;
-
       fp = fopen (PATH_CPUINFO, "r");
       if (! fp)
 	return -1;

-- 
           Summary: sysctl syscall used by ioperm() on arm
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ports
        AssignedTo: roland at gnu dot org
        ReportedBy: aurelien at aurel32 dot net
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: armv-unknown-linux-gnu
  GCC host triplet: arm-unknown-linux-gnu
GCC target triplet: arm-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=3063

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]