This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FW: Patch for undeclared __NR_pread - glibc 2.2.2


Hi,

Here is a patch for the "`__NR_pread' undeclared" error that occurs when
glibc-2.2.2 is compiled with recent Linux kernels (2.6.6+, perhaps
earlier ones). It's not particularly pretty, but it has the advantage of
being limited to a single file. This issue appears to have been resolved
in glibc-2.3.3 by changing the many .c files involved.

The crosstool ChangeLog mentions similar problems with gcc-3.4.1  /
glibc-2.2.5  /  linux-2.6.7, a similar patch would probably work there.

Steve Magnani
Digital Design Corporation

--- glibc-2.2.2/sysdeps/unix/sysv/linux/kernel-features.h 2001-01-23
16:07:25.000000000 -0600
+++ glibc-2.2.2/sysdeps/unix/sysv/linux/kernel-features.h.patch
2004-11-09 14:36:34.649230300 -0600
@@ -53,6 +53,20 @@
 #if __LINUX_KERNEL_VERSION >= 131584
 # define __ASSUME_PREAD_SYSCALL  1
 # define __ASSUME_PWRITE_SYSCALL 1
+
+/* pread/pwrite were renamed to pread64/pwrite64 somewhere between
2.4.4 & 2.6.6 */
+#include <sys/syscall.h>
+#ifdef __NR_pread64  /* Newer kernels renamed but it's the same.  */
+# ifndef __NR_pread
+#  define __NR_pread __NR_pread64
+# endif
+#endif
+
+#ifdef __NR_pwrite64  /* Newer kernels renamed but it's the same.  */
+# ifndef __NR_pwrite
+#  define __NR_pwrite __NR_pwrite64
+# endif
+#endif
 #endif
 
 /* When was `poll' introduced?  */




------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]