]> mj.ucw.cz Git - pciutils.git/commitdiff
Define SYS_(pread|pwrite) as __NR_\1 on glibc systems unless defined by glibc
authorMartin Mares <mj@ucw.cz>
Tue, 9 Jun 1998 19:22:05 +0000 (19:22 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 5 May 2006 12:09:53 +0000 (14:09 +0200)
itself.

This solution is _very_ugly_, but it's the only way I know which doesn't force
people to rebuild the glibc every few kernel releases. Grrr. I don't understand
why glibc uses its own include for syscall numbers and doesn't just include
<asm/unistd.h> instead.

ChangeLog
setpci.c

index 2973c575e319da002829b4c554f0de40c474648f..6e8575113a16da02289c05f56c91b7428eeef48e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Jun  9 22:53:59 1998  Martin Mares  <mj@albireo.ucw.cz>
+
+       * names.c (parse_name_list): Killed an unused variable.
+
+       * setpci.c (pread, pwrite): Define SYS_(pread|pwrite) as __NR_\1
+       if they are not defined by glibc (needed for glibc built on older
+       kernels). Ugly.
+
+       * setpci.c (exec_op): Fixed error messages. Thanks, Steve!
+
 Mon Jun  8 10:59:22 1998  Martin Mares  <mj@albireo.ucw.cz>
 
        * Released as 1.05.
index f65b4d6c9598c1e92eab554976597d0092432342..166bceed8eafa7f816b9886cee5409fa542e09f7 100644 (file)
--- a/setpci.c
+++ b/setpci.c
@@ -1,5 +1,5 @@
 /*
- *     $Id: setpci.c,v 1.3 1998/06/08 07:57:54 mj Exp $
+ *     $Id: setpci.c,v 1.4 1998/06/09 19:22:05 mj Exp $
  *
  *     Linux PCI Utilities -- Manipulate PCI Configuration Registers
  *
@@ -66,12 +66,18 @@ xmalloc(unsigned int howmuch)
  * or use lseek/read/write instead.
  */
 #ifdef __GLIBC__
+#ifndef SYS_pread
+#define SYS_pread __NR_pread
+#endif
 static int
 pread(unsigned int fd, void *buf, size_t size, loff_t where)
 {
   return syscall(SYS_pread, fd, buf, size, where);
 }
 
+#ifndef SYS_pwrite
+#define SYS_pwrite __NR_pwrite
+#endif
 static int
 pwrite(unsigned int fd, void *buf, size_t size, loff_t where)
 {
@@ -180,7 +186,7 @@ exec_op(struct op *op, struct device *dev)
          }
        if (i != (int) op->width)
          {
-           fprintf(stderr, "Error writing to %02x:%02x.%d: %m", dev->bus, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
+           fprintf(stderr, "Error writing to %02x:%02x.%d: %m\n", dev->bus, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
            exit(1);
          }
       }
@@ -207,7 +213,7 @@ exec_op(struct op *op, struct device *dev)
            }
          if (i != (int) op->width)
            {
-             fprintf(stderr, "Error reading from %02x:%02x.%d: %m", dev->bus, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
+             fprintf(stderr, "Error reading from %02x:%02x.%d: %m\n", dev->bus, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
              exit(1);
            }
          printf(m, x);