chiark / gitweb /
[PATCH] update to klibc version 0.101, fixing the stdin bug.
authorgreg@kroah.com <greg@kroah.com>
Thu, 29 Jan 2004 02:35:47 +0000 (18:35 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:13:20 +0000 (21:13 -0700)
klibc/klibc/Makefile
klibc/klibc/arch/ppc/include/klibc/archsys.h
klibc/klibc/getpagesize.c [new file with mode: 0644]
klibc/klibc/include/stdio.h
klibc/klibc/include/unistd.h
klibc/klibc/mmap.c
klibc/klibc/syscommon.h
klibc/version

index 5fc481aa8a1554b59f520bcd9e0e5ef61aadc3e2..def201524a43f5ccb274c3aff021042bd2c71cf6 100644 (file)
@@ -24,7 +24,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \
          sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \
          __signal.o signal.o bsd_signal.o siglist.o siglongjmp.o \
          sigaction.o sigpending.o sigprocmask.o sigsuspend.o \
-         brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \
+         brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o getpagesize.o \
          memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
          memmove.o \
          strcasecmp.o strncasecmp.o strndup.o strerror.o \
@@ -118,12 +118,12 @@ socketcalls.dir: SOCKETCALLS socketcalls.pl socketcommon.h
        touch $@
 
 %/static.obj: %.dir
-       $(MAKE) objects-$(basename $(notdir $@)) DIR=$*
+       $(MAKE) objects-$(basename $(notdir $@)) DIR=$*/
 
-STATIC = $(addsuffix .o,$(basename $(wildcard $(DIR)/*.[cS])))
+STATIC = $(addsuffix .o,$(basename $(wildcard $(DIR)*.[cS])))
 
 objects-static: $(STATIC)
-       touch $(DIR)/static.obj
+       touch $(DIR)static.obj
 
 clean: archclean
        find . -type f -a \( -name \*.[isoa] -o -name \*.l[iso] \) -print0 | xargs -0rt rm -f
@@ -140,6 +140,6 @@ spotless: clean
 bitsize:
        @echo $(BITSIZE)
 
-ifneq ($(wildcard $(DIR)/.*.d),)
-include $(wildcard $(DIR)/.*.d)
+ifneq ($(wildcard $(DIR).*.d),)
+include $(wildcard $(DIR).*.d)
 endif
index 33a5ff32360b06f9350b2ee40c6583070d86ca0a..17a28859e5c9fdb4d70a11e6b6fb13df91720372 100644 (file)
@@ -36,18 +36,24 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
                 __asm__ __volatile__                                    \
                         ("sc           \n\t"                            \
                          "mfcr %1      "                                \
-                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
-                        : "0"   (__sc_3), "1"   (__sc_0),               \
-                          "r"   (__sc_4),                               \
-                          "r"   (__sc_5),                               \
-                          "r"   (__sc_6),                               \
-                          "r"   (__sc_7),                               \
-                          "r"   (__sc_8)                                \
-                        : __syscall_clobbers);                          \
+                        : "+r"   (__sc_3),                             \
+                         "+r"   (__sc_0),                              \
+                          "+r"   (__sc_4),                              \
+                          "+r"   (__sc_5),                              \
+                          "+r"   (__sc_6),                              \
+                          "+r"   (__sc_7),                              \
+                          "+r"   (__sc_8)                               \
+                        : : "cr0", "ctr", "memory",                     \
+                            "r9", "r10", "r11", "r12");                        \
                 __sc_ret = __sc_3;                                      \
                 __sc_err = __sc_0;                                      \
         }                                                               \
-        __syscall_return (type);                                        \
+        if (__sc_err & 0x10000000)                                      \
+        {                                                               \
+                errno = (int)__sc_ret;                                  \
+                __sc_ret = -1;                                          \
+        }                                                               \
+        return (type)__sc_ret;                                          \
 }
 
 #endif /* _syscall6() missing */
diff --git a/klibc/klibc/getpagesize.c b/klibc/klibc/getpagesize.c
new file mode 100644 (file)
index 0000000..2d975b1
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * getpagesize.c
+ */
+
+#include <sys/syscall.h>
+#include <asm/page.h>
+
+/* Presumably there is a better way to do this... */
+#ifdef __ia64__
+# define __NR_getpagesize 1171
+#endif
+
+#ifdef __NR_getpagesize
+
+_syscall0(int,getpagesize);
+
+#else
+
+int getpagesize(void)
+{
+  return PAGE_SIZE;
+}
+
+#endif
+
+
index 31a1fe40af29647a85d10af76695f151f3f4d736..fba1e30746a9d33c0b153cf049b5e039209d608c 100644 (file)
 struct _IO_file;
 typedef struct _IO_file FILE;
 
-#define stdin  ((FILE *)0)
-#define stdout ((FILE *)1)
-#define stderr ((FILE *)2)
-
 #ifndef EOF
 # define EOF (-1)
 #endif
@@ -44,10 +40,12 @@ static __inline__ int fileno(FILE *__f)
   return (int)(size_t)__f - 1;
 }
 
-static __inline__ FILE * __create_file(int __fd)
-{
-  return (FILE *)(size_t)(__fd + 1);
-}
+/* This is a macro so it can be used as initializer */
+#define __create_file(__fd) ((FILE *)(size_t)((__fd) + 1))
+
+#define stdin  __create_file(0)
+#define stdout __create_file(1)
+#define stderr __create_file(2)
 
 __extern FILE *fopen(const char *, const char *);
 
index ad129138341657d38dd3f25b18b69316eb8a76be..3d5c6881d359fb3e0627c8a42ba3d259d67abb34 100644 (file)
@@ -105,6 +105,8 @@ __extern int optind, opterr, optopt;
 
 __extern int isatty(int);
 
+__extern int getpagesize(void);
+
 /* Standard file descriptor numbers. */
 #define STDIN_FILENO   0
 #define STDOUT_FILENO  1
index aedf4dceb562916eac2f65a4b366a712d6a522de..89cf3a6a8f1b28120c336548586e3c2a878dbe84 100644 (file)
@@ -19,7 +19,7 @@
  * Prefer mmap2() over mmap(), except on the architectures listed
  */
 
-#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc64__)
+#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc__) && !defined(__powerpc64__)
 
 /* This architecture uses mmap2() */
 
index 30939207391073174b295d391d2641cd8ecca82a..429025279eb2269bc15da5009c81a48bd8e2e349 100644 (file)
@@ -28,5 +28,5 @@
 #include <unistd.h>
 
 #ifdef __i386__
-#include <sys/vm86.h>
+# include <sys/vm86.h>
 #endif
index 0f6db3dda2ebf786351bbc6a94ca68edeaec496a..2f3d7fa99589727fde2fcbce6ffbd09914407583 100644 (file)
@@ -1 +1 @@
-0.98
+0.101