source:
npl/system/klibc/patches/klibc-add-pread-and-pwrite-32bit-syscall-wrappers-for-parisc.patch
@
128fde4
Last change on this file since 128fde4 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 3.5 KB |
-
usr/include/endian.h
From: Helge Deller <deller@gmx.de> Subject: [klibc] Add pread and pwrite 32bit syscall wrappers for parisc Date: Wed, 23 Apr 2014 22:52:53 +0200 Bug-Debian: https://bugs.debian.org/745660 Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003880.html On the hppa arch (32bit userspace and 32 or 64bit kernel), the fstype program fails to detect the filesystem. The reason for this failure is, that fstype calls the pread() syscall, which has on some architectures with 32bit userspace a different calling syntax. I noticed this bug on hppa, but I assume s390 (32bit) and others might run into similiar issues. Signed-off-by: Helge Deller <deller@gmx.de> ---
a b 12 12 #define PDP_ENDIAN __PDP_ENDIAN 13 13 #define BYTE_ORDER __BYTE_ORDER 14 14 15 #if __BYTE_ORDER == __LITTLE_ENDIAN 16 # define __LONG_LONG_PAIR(HI, LO) LO, HI 17 #elif __BYTE_ORDER == __BIG_ENDIAN 18 # define __LONG_LONG_PAIR(HI, LO) HI, LO 19 #endif 20 15 21 #endif /* _ENDIAN_H */ -
usr/klibc/Kbuild
a b klib-y += vsnprintf.o snprintf.o vsprint 35 35 siglongjmp.o \ 36 36 sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ 37 37 pselect.o ppoll.o \ 38 pread.o pwrite.o \ 38 39 brk.o sbrk.o malloc.o realloc.o zalloc.o calloc.o \ 39 40 mmap.o shm_open.o shm_unlink.o \ 40 41 memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ -
new file usr/klibc/pread.c
- + 1 /* 2 * pread.c 3 * 4 * Some architectures need to wrap the system call 5 */ 6 7 #include <endian.h> 8 #include <sys/syscall.h> 9 10 #if defined(__hppa__) 11 12 #if _BITSIZE == 32 13 extern size_t __pread(int, void *, size_t, unsigned int, unsigned int); 14 #else 15 extern size_t __pread(int, void *, size_t, off_t); 16 #endif 17 18 size_t pread(int fd, void *buf, size_t count, off_t offset) 19 { 20 #if _BITSIZE == 32 21 unsigned int hi = offset >> 32; 22 unsigned int lo = (unsigned int) offset; 23 return __pread(fd, buf, count, __LONG_LONG_PAIR(hi, lo)); 24 #else 25 return __pread(fd, buf, count, offset); 26 #endif 27 } 28 29 #endif -
new file usr/klibc/pwrite.c
- + 1 /* 2 * pwrite.c 3 * 4 * Some architectures need to wrap the system call 5 */ 6 7 #include <endian.h> 8 #include <sys/syscall.h> 9 10 #if defined(__hppa__) 11 12 #if _BITSIZE == 32 13 extern ssize_t __pwrite(int, const void *, size_t, unsigned int, unsigned int); 14 #else 15 extern ssize_t __pwrite(int, const void *, size_t, off_t); 16 #endif 17 18 size_t pwrite(int fd, void *buf, size_t count, off_t offset) 19 { 20 #if _BITSIZE == 32 21 unsigned int hi = offset >> 32; 22 unsigned int lo = (unsigned int) offset; 23 return __pwrite(fd, buf, count, __LONG_LONG_PAIR(hi, lo)); 24 #else 25 return __pwrite(fd, buf, count, offset); 26 #endif 27 } 28 29 #endif -
usr/klibc/SYSCALLS.def
a b int fdatasync,fsync::fdatasync(int); 189 189 int readv(int, const struct iovec *, int); 190 190 int writev(int, const struct iovec *, int); 191 191 int ftruncate64,ftruncate::ftruncate(int, off_t); 192 ssize_t pread64,pread::pread(int, void *, size_t, off_t); 193 ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t); 192 <parisc> ssize_t pread64,pread::__pread(int, void *, size_t, off_t); 193 <parisc> ssize_t pwrite64,pwrite::__pwrite(int, void *, size_t, off_t); 194 <!parisc> ssize_t pread64,pread::pread(int, void *, size_t, off_t); 195 <!parisc> ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t); 194 196 int sync_file_range,fdatasync,fsync::sync_file_range(int, off_t, off_t, unsigned int); 195 197 <?> int splice(int, off_t *, int, off_t *, size_t, unsigned int); 196 198 <?> int tee(int, int, size_t, unsigned int);
Note: See TracBrowser
for help on using the repository browser.