]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/pciutils-havepread.patch
asterisk addon: update to 11.13.1
[people/pmueller/ipfire-2.x.git] / src / patches / pciutils-havepread.patch
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
3 @@ -12,54 +12,6 @@
4 * don't define it.
5 */
6
7 -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ > 0
8 -/* glibc 2.1 or newer -> pread/pwrite supported automatically */
9 -
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>
14 -#ifndef SYS_pread
15 -#define SYS_pread 180
16 -#endif
17 -static int pread(unsigned int fd, void *buf, size_t size, loff_t where)
18 -{ return syscall(SYS_pread, fd, buf, size, where); }
19 -#ifndef SYS_pwrite
20 -#define SYS_pwrite 181
21 -#endif
22 -static int pwrite(unsigned int fd, void *buf, size_t size, loff_t where)
23 -{ return syscall(SYS_pwrite, fd, buf, size, where); }
24 -
25 -#elif defined(i386)
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
33 -
34 -#else
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) \
38 - { \
39 - struct pci_access *a = d->access; \
40 - int r; \
41 - if (a->fd_pos != where && lseek(fd, where, SEEK_SET) < 0) \
42 - return -1; \
43 - r = op(fd, buf, size); \
44 - if (r < 0) \
45 - a->fd_pos = -1; \
46 - else \
47 - a->fd_pos = where + r; \
48 - return r; \
49 - }
50 -make_rw_glue(read)
51 -make_rw_glue(write)
52 -#define PCI_HAVE_DO_READ
53 -#endif
54 -
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)