1 --- pciutils-2.1.99-test8/lib/pread.h.pread 2004-08-13 16:15:46.000000000 -0400
2 +++ pciutils-2.1.99-test8/lib/pread.h 2004-08-31 00:30:03.168157294 -0400
7 -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ > 0
8 -/* glibc 2.1 or newer -> pread/pwrite supported automatically */
10 -#elif defined(i386) && defined(__GLIBC__)
11 -/* glibc 2.0 on i386 -> call syscalls directly */
12 -#include <asm/unistd.h>
13 -#include <syscall-list.h>
15 -#define SYS_pread 180
17 -static int pread(unsigned int fd, void *buf, size_t size, loff_t where)
18 -{ return syscall(SYS_pread, fd, buf, size, where); }
20 -#define SYS_pwrite 181
22 -static int pwrite(unsigned int fd, void *buf, size_t size, loff_t where)
23 -{ return syscall(SYS_pwrite, fd, buf, size, where); }
26 -/* old libc on i386 -> call syscalls directly the old way */
27 -#include <asm/unistd.h>
28 -static _syscall5(int, pread, unsigned int, fd, void *, buf, size_t, size, u32, where_lo, u32, where_hi);
29 -static _syscall5(int, pwrite, unsigned int, fd, void *, buf, size_t, size, u32, where_lo, u32, where_hi);
30 -static int do_read(struct pci_dev *d UNUSED, int fd, void *buf, size_t size, int where) { return pread(fd, buf, size, where, 0); }
31 -static int do_write(struct pci_dev *d UNUSED, int fd, void *buf, size_t size, int where) { return pwrite(fd, buf, size, where, 0); }
32 -#define PCI_HAVE_DO_READ
35 -/* In all other cases we use lseek/read/write instead to be safe */
36 -#define make_rw_glue(op) \
37 - static int do_##op(struct pci_dev *d, int fd, void *buf, size_t size, int where) \
39 - struct pci_access *a = d->access; \
41 - if (a->fd_pos != where && lseek(fd, where, SEEK_SET) < 0) \
43 - r = op(fd, buf, size); \
47 - a->fd_pos = where + r; \
52 -#define PCI_HAVE_DO_READ
55 #ifndef PCI_HAVE_DO_READ
56 #define do_read(d,f,b,l,p) pread(f,b,l,p)
57 #define do_write(d,f,b,l,p) pwrite(f,b,l,p)