From 6ae3650ab159adda12a0a5addc852012b4cb4a9d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 9 Jun 1998 19:22:05 +0000 Subject: [PATCH] Define SYS_(pread|pwrite) as __NR_\1 on glibc systems unless defined by glibc 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 instead. --- ChangeLog | 10 ++++++++++ setpci.c | 12 +++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2973c57..6e85751 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Tue Jun 9 22:53:59 1998 Martin Mares + + * 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 * Released as 1.05. diff --git a/setpci.c b/setpci.c index f65b4d6..166bcee 100644 --- 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); -- 2.39.2