254dafc522444e10f0c152d42ec6fb8dfd4979c3
[feed/packages.git] / libs / libpciaccess / patches / 010-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versions.patch
1 From 833c86ce15cee2a84a37ae71015f236fd32615d9 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Fri, 11 Nov 2022 11:15:58 -0800
4 Subject: [PATCH] linux_sysfs: Use pwrite/pread instead of 64bit versions
5
6 pread64/pwrite64 are aliased to pread/pwrite when largefile support is
7 enabled e.g. using _FILE_OFFSET_BITS=64 macro
8
9 This helps it compile on latest musl C library based systems where these
10 functions are put under _LARGEFILE64_SOURCE which is to be removed once
11 all packages start using 64bit off_t, it works with glibc becuase
12 _GNU_SOURCE feature macro also defines _LARGEFILE64_SOURCE, thats not
13 the case with musl
14
15 Signed-off-by: Khem Raj <raj.khem@gmail.com>
16 ---
17 src/linux_sysfs.c | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20 --- a/src/linux_sysfs.c
21 +++ b/src/linux_sysfs.c
22 @@ -462,7 +462,7 @@ pci_device_linux_sysfs_read( struct pci_
23
24
25 while ( temp_size > 0 ) {
26 - const ssize_t bytes = pread64( fd, data_bytes, temp_size, offset );
27 + const ssize_t bytes = pread( fd, data_bytes, temp_size, offset );
28
29 /* If zero bytes were read, then we assume it's the end of the
30 * config file.
31 @@ -522,7 +522,7 @@ pci_device_linux_sysfs_write( struct pci
32
33
34 while ( temp_size > 0 ) {
35 - const ssize_t bytes = pwrite64( fd, data_bytes, temp_size, offset );
36 + const ssize_t bytes = pwrite( fd, data_bytes, temp_size, offset );
37
38 /* If zero bytes were written, then we assume it's the end of the
39 * config file.