[hackers] [9base] applied Paul's final uClibc patches, thanks || anselm
changeset: 95:8ea978e371b8
tag: tip
user: anselm_AT_garbe.us
date: Wed Mar 07 21:29:55 2012 +0100
files: join/join.c lib9/dirread.c lib9/libc.h
description:
applied Paul's final uClibc patches, thanks
diff -r 3c9842ed0141 -r 8ea978e371b8 join/join.c
--- a/join/join.c Wed Feb 29 20:52:27 2012 +0100
+++ b/join/join.c Wed Mar 07 21:29:55 2012 +0100
_AT_@ -1,7 +1,7 @@
/* join F1 F2 on stuff */
#include <u.h>
+#include <stdio.h>
#include <libc.h>
-#include <stdio.h>
#include <ctype.h>
#define F1 0
#define F2 1
diff -r 3c9842ed0141 -r 8ea978e371b8 lib9/dirread.c
--- a/lib9/dirread.c Wed Feb 29 20:52:27 2012 +0100
+++ b/lib9/dirread.c Wed Mar 07 21:29:55 2012 +0100
_AT_@ -3,10 +3,28 @@
#include <libc.h>
#include <sys/stat.h>
#include <dirent.h>
+#if defined(__linux__) && (__UCLIBC__)
+# include <sys/syscall.h>
+#endif
extern int _p9dir(struct stat*, struct stat*, char*, Dir*, char**, char*);
#if defined(__linux__)
+# if defined(__UCLIBC__)
+/* uClibc doesn't provide getdirentries(2), getdents(2) isn't wrapped
+ * by uClibc either. So we are using getdents(2) syscall directly.
+ */
+# warning "uClibc based system are using getdents(2) syscall directly."
+static int
+mygetdents(int fd, struct dirent *buf, int n)
+{
+# if defined(__USE_LARGEFILE64)
+ return syscall(SYS_getdents64, fd, (void*)buf, n);
+# else
+ return syscall(SYS_getdents, fd, (void*)buf, n);
+# endif
+}
+# else
static int
mygetdents(int fd, struct dirent *buf, int n)
{
_AT_@ -18,6 +36,7 @@
nn = getdirentries(fd, (void*)buf, n, &off);
return nn;
}
+# endif
#elif defined(__APPLE__) || defined(__FreeBSD__)
static int
mygetdents(int fd, struct dirent *buf, int n)
diff -r 3c9842ed0141 -r 8ea978e371b8 lib9/libc.h
--- a/lib9/libc.h Wed Feb 29 20:52:27 2012 +0100
+++ b/lib9/libc.h Wed Mar 07 21:29:55 2012 +0100
_AT_@ -334,6 +334,13 @@
extern vlong p9nsec(void);
#ifndef NOPLAN9DEFINES
+/* Clear some declarations to avoid conflicts in edge situation.
+ * uClibc based systems have this issue.
+ */
+#undef gmtime
+#undef localtime
+#undef asctime
+#undef ctime
#define gmtime p9gmtime
#define localtime p9localtime
#define asctime p9asctime
Received on Wed Mar 07 2012 - 20:28:57 CET
This archive was generated by hypermail 2.3.0
: Wed Mar 07 2012 - 20:36:10 CET