chiark / gitweb /
[PATCH] sync klibc with release 0.95
authorgreg@kroah.com <greg@kroah.com>
Wed, 17 Dec 2003 08:22:55 +0000 (00:22 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:13:08 +0000 (21:13 -0700)
28 files changed:
klibc/Makefile
klibc/klibc/Makefile
klibc/klibc/SYSCALLS
klibc/klibc/arch/i386/include/klibc/archsignal.h
klibc/klibc/arch/ia64/Makefile.inc
klibc/klibc/arch/ia64/include/klibc/archsignal.h
klibc/klibc/arch/ia64/pipe.c [new file with mode: 0644]
klibc/klibc/arch/ppc/Makefile.inc
klibc/klibc/arch/ppc/crt0.S
klibc/klibc/arch/ppc64/Makefile.inc
klibc/klibc/arch/ppc64/crt0.S
klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h [new file with mode: 0644]
klibc/klibc/arch/ppc64/setjmp.S [new file with mode: 0644]
klibc/klibc/arch/s390/Makefile.inc
klibc/klibc/include/klibc/compiler.h
klibc/klibc/include/signal.h
klibc/klibc/include/stdio.h
klibc/klibc/include/sys/module.h [deleted file]
klibc/klibc/inet/bindresvport.c
klibc/klibc/mmap.c
klibc/klibc/strcasecmp.c
klibc/klibc/strerror.c
klibc/klibc/strncasecmp.c
klibc/klibc/strncmp.c
klibc/klibc/syscommon.h
klibc/klibc/tests/memstrtest.c
klibc/klibc/tests/minips.c
klibc/version

index 5f9a7d6a6e9d41a01a64014a280ac9125bfe7321..ef5fbabff8fc06291be7a5331c3fdf097364ecbc 100644 (file)
@@ -1,6 +1,23 @@
+VERSION := $(shell cat version)
 SUBDIRS = klibc
 
 all:
 
 SUBDIRS = klibc
 
 all:
 
+rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm)
+
+klibc.spec: klibc.spec.in version
+       sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
+
+.PHONY: rpm
+rpm: klibc.spec
+       +$(rpmbuild) -bb klibc.spec
+
 %:
        @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 %:
        @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+
+clean:
+       @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+
+spotless:
+       @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+       rm -f klibc.spec *~ tags
index e1d63381c18924e0ac5832ebcbc3fa980ae1c8a7..5fc481aa8a1554b59f520bcd9e0e5ef61aadc3e2 100644 (file)
@@ -57,6 +57,12 @@ tests: $(TESTS)
 tests/%.o : tests/%.c
        $(CC) $(CFLAGS) -c -o $@ $<
 
 tests/%.o : tests/%.c
        $(CC) $(CFLAGS) -c -o $@ $<
 
+# This particular file uses a bunch of formats gcc don't know of, in order
+# to test the full range of our vsnprintf() function.  This outputs a bunch
+# of useless warnings unless we tell it not to.
+tests/testvsnp.o : tests/testvsnp.c
+       $(CC) $(CFLAGS) -Wno-format -c -o $@ $<
+
 tests/% : tests/%.o $(LIB) $(CRT0)
        $(LD) $(LDFLAGS) -o $@ $(CRT0) $< $(LIB) $(LIBGCC)
        cp $@ $@.stripped
 tests/% : tests/%.o $(LIB) $(CRT0)
        $(LD) $(LDFLAGS) -o $@ $(CRT0) $< $(LIB) $(LIBGCC)
        cp $@ $@.stripped
@@ -131,6 +137,9 @@ spotless: clean
        find . \( -name \*~ -o -name '.*.d' \) -not -type d -print0 | \
                xargs -0rt rm -f
 
        find . \( -name \*~ -o -name '.*.d' \) -not -type d -print0 | \
                xargs -0rt rm -f
 
+bitsize:
+       @echo $(BITSIZE)
+
 ifneq ($(wildcard $(DIR)/.*.d),)
 include $(wildcard $(DIR)/.*.d)
 endif
 ifneq ($(wildcard $(DIR)/.*.d),)
 include $(wildcard $(DIR)/.*.d)
 endif
index 92dff963b368342afdb3b5c41d956f3a9e48f0f2..0be1b4425abfb6d80c302a502a0dff3927226564 100644 (file)
@@ -73,7 +73,7 @@ int mknod(const char *, mode_t, dev_t)
 int chmod(const char *, mode_t)
 int mkdir(const char *, mode_t)
 int rmdir(const char *)
 int chmod(const char *, mode_t)
 int mkdir(const char *, mode_t)
 int rmdir(const char *)
-<!alpha,mips,mips64> int pipe(int *)
+<!alpha,ia64,mips,mips64> int pipe(int *)
 mode_t umask(mode_t)
 int chroot(const char *)
 int symlink(const char *, const char *)
 mode_t umask(mode_t)
 int chroot(const char *)
 int symlink(const char *, const char *)
@@ -139,9 +139,8 @@ int mprotect(const void *, size_t, int)
 int uname(struct utsname *)
 int setdomainname(const char *, size_t)
 int sethostname(const char *, size_t)
 int uname(struct utsname *)
 int setdomainname(const char *, size_t)
 int sethostname(const char *, size_t)
-int init_module(const char *, struct module *)
-<!ia64> void * create_module(const char *, size_t)
-int delete_module(const char *)
+long init_module(void *, unsigned long, const char *)
+long delete_module(const char *, unsigned int)
 <!ia64> int query_module(const char *, int, void *, size_t, size_t)
 int reboot::__reboot(int, int, int, void *)
 int syslog::klogctl(int, char *, int)
 <!ia64> int query_module(const char *, int, void *, size_t, size_t)
 int reboot::__reboot(int, int, int, void *)
 int syslog::klogctl(int, char *, int)
index caea8d8b3dd69c468d2d992e7d39a2f7a54e077e..b092ba6d3a07f638db72795b3e010c8aaaf2c213 100644 (file)
@@ -8,6 +8,6 @@
 #ifndef _KLIBC_ARCHSIGNAL_H
 #define _KLIBC_ARCHSIGNAL_H
 
 #ifndef _KLIBC_ARCHSIGNAL_H
 #define _KLIBC_ARCHSIGNAL_H
 
-typedef int sig_atomic_t;
+/* No special stuff for this architecture */
 
 #endif
 
 #endif
index edf43459f8c9f8b0d39dda3bb12533907ff0580d..781448770e621c9df864bb1ebd4dd93796a39297 100644 (file)
@@ -9,7 +9,16 @@
 
 ARCHOBJS = \
        arch/$(ARCH)/vfork.o \
 
 ARCHOBJS = \
        arch/$(ARCH)/vfork.o \
-       arch/$(ARCH)/setjmp.o
+       arch/$(ARCH)/setjmp.o \
+       arch/$(ARCH)/pipe.o \
+       libgcc/__divdi3.o \
+       libgcc/__divsi3.o \
+       libgcc/__udivdi3.o \
+       libgcc/__udivsi3.o \
+       libgcc/__umodsi3.o \
+       libgcc/__umoddi3.o \
+       libgcc/__udivmodsi4.o \
+       libgcc/__udivmoddi4.o
 
 ARCHSOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS))
 
 
 ARCHSOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS))
 
index 9ab0ed744c0110234eb390d7fae0529be7ca248e..5b01f19bc2d59667815a07307ab1d0bccc78488d 100644 (file)
@@ -28,6 +28,4 @@ struct sigaction {
 #define sa_handler      _u._sa_handler
 #define sa_sigaction    _u._sa_sigaction
 
 #define sa_handler      _u._sa_handler
 #define sa_sigaction    _u._sa_sigaction
 
-typedef int sig_atomic_t;
-
 #endif
 #endif
diff --git a/klibc/klibc/arch/ia64/pipe.c b/klibc/klibc/arch/ia64/pipe.c
new file mode 100644 (file)
index 0000000..5f5dd05
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * pipe.c
+ */
+
+#include "syscommon.h"
+#include <klibc/archsys.h>
+
+#define ASM_CLOBBERS ,"out2", "out3", "out4", "out5", "out6", "out7",    \
+   /* Non-stacked integer registers, minus r8, r9, r10, r15.  */       \
+  "r2", "r3", "r11", "r12", "r13", "r14", "r16", "r17", "r18",         \
+  "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27",       \
+  "r28", "r29", "r30", "r31",                                          \
+  /* Predicate registers.  */                                          \
+  "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",    \
+  /* Non-rotating fp registers.  */                                    \
+  "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",    \
+  /* Branch registers.  */                                             \
+  "b6", "b7"
+
+int pipe(int *filedes)
+{
+       register long _r8 asm("r8");
+       register long _r9 asm("r9");
+       register long _r10 asm("r10");
+       register long _r15 asm("r15") = __NR_pipe;
+       register long _out0 asm ("out0") = (long)filedes;
+       long _retval;
+       __asm __volatile (__IA64_BREAK
+                         : "=r" (_r8), "=r" (_r10), "=r" (_r15),
+                           "=r" (_out0)
+                         : "2" (_r15), "3" (_out0)
+                         : "memory" ASM_CLOBBERS);
+       if (_r10 == -1) {
+               errno = _r8;
+               _retval = -1;
+       } else {
+               filedes[0] = _r8;
+               filedes[1] = _r9;
+               _retval = 0;
+       }
+       return _retval;
+}
index 6e87a48d6b206b27977d8b0a4aa379236492b44d..3bd2c0643c89ac9f7e01a13135d836007c2bdeb5 100644 (file)
@@ -8,7 +8,13 @@
 #
 
 ARCHOBJS = \
 #
 
 ARCHOBJS = \
-       arch/$(ARCH)/setjmp.o
+       arch/$(ARCH)/setjmp.o \
+       libgcc/__divdi3.o \
+       libgcc/__moddi3.o \
+       libgcc/__udivdi3.o \
+       libgcc/__umoddi3.o \
+       libgcc/__udivmoddi4.o
+
 
 ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
 
 
 ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
 
index f7274b07dd549cde876985c3ac13f7dfa9422a9c..282f8411e4079749c3c90ac3b36d36b99d6ae119 100644 (file)
@@ -1,12 +1,5 @@
 #
 # arch/ppc/crt0.S
 #
 # arch/ppc/crt0.S
-#
-# void _start(void)
-# {
-#    /* Divine up argc, argv, and envp */
-#    environ = envp;
-#    exit(main(argc, argv, envp));
-# } 
 #
 
        .text
 #
 
        .text
        .type _start,@function
        .globl _start
 _start:
        .type _start,@function
        .globl _start
 _start:
-       lwz     3,0(1)
-       addi    4,1,4
-       addi    5,1,8
-       slwi    0,3,2
-       add     5,5,0
-       li      0,0
-       stwu    0,-16(1)
-       lis     9,environ@ha
-       stw     5,environ@l(9)
-       bl      main
-       bl      exit
+       stwu    1,-16(1)
+       addi    3,1,16
+       /*
+        * the SVR4abippc.pdf specifies r7 as a pointer to 
+        * a termination function pointer.
+        * It is unused on Linux.
+        */
+       mr      4,7
+       bl      __libc_init
        
        .size _start,.-_start
        
        .size _start,.-_start
index 434d0aad9604c934c3ce5cd2f7d21b880114d2e6..3ab3a8c8e64fb6dc916825540a07175e8eb25e51 100644 (file)
@@ -7,4 +7,9 @@
 # accordingly.
 #
 
 # accordingly.
 #
 
+ARCHOBJS = \
+       arch/$(ARCH)/setjmp.o
+
+ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
+
 archclean:
 archclean:
index 2f352e80457ad1b3178ba4bd310c32280071891a..872d2a07919b5bd2127dfd2e84f78f2f4c55c691 100644 (file)
@@ -23,16 +23,10 @@ _start:
        .globl  ._start
        .type   ._start,@function
 ._start:
        .globl  ._start
        .type   ._start,@function
 ._start:
-       ld      3,0(1)
-       ld      4,8(1)
-       ld      5,16(1)
-       li      0,0
-       stdu    0,-64(1)
-       ld      9,.LC0@toc(2)
-       std     5,0(9)
-       bl      .main
-       nop
-       bl      .exit
+       stdu    %r1,-32(%r1)
+       addi    %r3,%r1,32
+       mr      %r4,%r7     /* fini */
+       b       .__libc_init
        nop
 
        .size _start,.-_start
        nop
 
        .size _start,.-_start
diff --git a/klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h b/klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h
new file mode 100644 (file)
index 0000000..006a2e2
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * arch/ppc64/include/klibc/archsetjmp.h
+ */
+
+#ifndef _KLIBC_ARCHSETJMP_H
+#define _KLIBC_ARCHSETJMP_H
+
+struct __jmp_buf {
+  unsigned long __r2;
+  unsigned long __sp;
+  unsigned long __lr;
+  unsigned long __cr;
+  unsigned long __r13;
+  unsigned long __r14;
+  unsigned long __r15;
+  unsigned long __r16;
+  unsigned long __r17;
+  unsigned long __r18;
+  unsigned long __r19;
+  unsigned long __r20;
+  unsigned long __r21;
+  unsigned long __r22;
+  unsigned long __r23;
+  unsigned long __r24;
+  unsigned long __r25;
+  unsigned long __r26;
+  unsigned long __r27;
+  unsigned long __r28;
+  unsigned long __r29;
+  unsigned long __r30;
+  unsigned long __r31;
+};
+
+typedef struct __jmp_buf jmp_buf[1];
+
+#endif /* _SETJMP_H */
diff --git a/klibc/klibc/arch/ppc64/setjmp.S b/klibc/klibc/arch/ppc64/setjmp.S
new file mode 100644 (file)
index 0000000..1dcc670
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# arch/ppc64/setjmp.S
+#
+# Basic setjmp/longjmp implementation
+# This file was derived from the equivalent file in NetBSD
+#
+
+       .text
+       .align 4
+
+       .section ".opd","aw"
+setjmp:
+       .quad   .setjmp,.TOC.@tocbase,0
+       .previous
+       .size   setjmp,24
+       .type   .setjmp,@function
+       .globl  setjmp
+       .globl  .setjmp
+.setjmp:
+        mflr    %r11                    /* save return address */
+        mfcr    %r12                    /* save condition register */
+        mr      %r10,%r1                /* save stack pointer */
+        mr      %r9,%r2                 /* save GPR2 (not needed) */
+        stmw    %r9,0(%r3)              /* save r9..r31 */
+        li      %r3,0                   /* indicate success */
+        blr                             /* return */
+
+       .size .setjmp,.-.setjmp
+       .section ".opd","aw"
+longjmp:
+       .quad   .longjmp,.TOC.@tocbase,0
+       .previous
+       .size   longjmp,24
+       .type   .longjmp,@function
+       .globl  longjmp
+       .globl  .longjmp
+.longjmp:
+        lmw     %r9,0(%r3)              /* save r9..r31 */
+        mtlr    %r11                    /* restore LR */
+        mtcr    %r12                    /* restore CR */
+        mr      %r2,%r9                 /* restore GPR2 (not needed) */
+        mr      %r1,%r10                /* restore stack */
+        mr      %r3,%r4                 /* get return value */
+        blr                             /* return */
+
+       .size .longjmp,.-.longjmp
index 45aa55169536fb1aeab343931eeae841dab46954..c50f4f2886c629cc1cf809f6897a898cb3f4de51 100644 (file)
@@ -8,7 +8,12 @@
 #
 
 ARCHOBJS = \
 #
 
 ARCHOBJS = \
-       arch/$(ARCH)/setjmp.o
+       arch/$(ARCH)/setjmp.o \
+       libgcc/__divdi3.o \
+       libgcc/__moddi3.o \
+       libgcc/__udivdi3.o \
+       libgcc/__umoddi3.o \
+       libgcc/__udivmoddi4.o
 
 ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
 
 
 ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
 
index 5c284b206c5160da7ccd17a048bcb532089788f9..64b8c541588be772f0d6eebdbb1de9ca3598b43c 100644 (file)
 # define __unlikely(x) (x)
 #endif
 
 # define __unlikely(x) (x)
 #endif
 
+/* Possibly unused function */
+#ifdef __GNUC__
+# define __unusedfunc  __attribute__((unused))
+#else
+# define __unusedfunc
+#endif
+
 #endif
 #endif
index 62c5083dc04582232365f4a4b42e79573b4cb707..f9eebb2a295357f97ca118e67e6cfa7575fafd27 100644 (file)
 
 #include <klibc/archsignal.h>
 
 
 #include <klibc/archsignal.h>
 
+/* glibc seems to use sig_atomic_t as "int" pretty much on all architectures.
+   Do the same, but allow the architecture to override. */
+#ifdef _KLIBC_HAS_ARCH_SIG_ATOMIC_T
+typedef int sig_atomic_t;
+#endif
+
 /* Some architectures don't define these */
 #ifndef SA_RESETHAND
 # define SA_RESETHAND SA_ONESHOT
 /* Some architectures don't define these */
 #ifndef SA_RESETHAND
 # define SA_RESETHAND SA_ONESHOT
index 5e621af5f18bc6a9ab957f27a206bc935df469f8..f57439f018a58f88b9f77cab7938d2242c39c69a 100644 (file)
@@ -78,12 +78,13 @@ __extern size_t _fread(void *, size_t, FILE *);
 __extern size_t _fwrite(const void *, size_t, FILE *);
 
 #ifndef __NO_FREAD_FWRITE_INLINES
 __extern size_t _fwrite(const void *, size_t, FILE *);
 
 #ifndef __NO_FREAD_FWRITE_INLINES
-static __inline__ size_t
+extern __inline__ size_t
 fread(void *__p, size_t __s, size_t __n, FILE *__f)
 {
   return _fread(__p, __s*__n, __f)/__s;
 }
 fread(void *__p, size_t __s, size_t __n, FILE *__f)
 {
   return _fread(__p, __s*__n, __f)/__s;
 }
-static  __inline__ size_t
+
+extern __inline__ size_t
 fwrite(void *__p, size_t __s, size_t __n, FILE *__f)
 {
   return _fwrite(__p, __s*__n, __f)/__s;
 fwrite(void *__p, size_t __s, size_t __n, FILE *__f)
 {
   return _fwrite(__p, __s*__n, __f)/__s;
diff --git a/klibc/klibc/include/sys/module.h b/klibc/klibc/include/sys/module.h
deleted file mode 100644 (file)
index 96b3b59..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * sys/module.h
- *
- * This is a bastardized version of linux/module.h, since the latter
- * doesn't have __KERNEL__ guards where it needs them...
- */
-
-#ifndef _SYS_MODULE_H
-#define _SYS_MODULE_H
-
-/*
- * Dynamic loading of modules into the kernel.
- *
- * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996
- */
-
-#include <asm/atomic.h>
-
-/* Don't need to bring in all of uaccess.h just for this decl.  */
-struct exception_table_entry;
-
-/* Used by get_kernel_syms, which is obsolete.  */
-struct kernel_sym
-{
-       unsigned long value;
-       char name[60];          /* should have been 64-sizeof(long); oh well */
-};
-
-struct module_symbol
-{
-       unsigned long value;
-       const char *name;
-};
-
-struct module_ref
-{
-       struct module *dep;     /* "parent" pointer */
-       struct module *ref;     /* "child" pointer */
-       struct module_ref *next_ref;
-};
-
-/* TBD */
-struct module_persist;
-
-struct module
-{
-       unsigned long size_of_struct;   /* == sizeof(module) */
-       struct module *next;
-       const char *name;
-       unsigned long size;
-
-       union
-       {
-               atomic_t usecount;
-               long pad;
-       } uc;                           /* Needs to keep its size - so says rth */
-
-       unsigned long flags;            /* AUTOCLEAN et al */
-
-       unsigned nsyms;
-       unsigned ndeps;
-
-       struct module_symbol *syms;
-       struct module_ref *deps;
-       struct module_ref *refs;
-       int (*init)(void);
-       void (*cleanup)(void);
-       const struct exception_table_entry *ex_table_start;
-       const struct exception_table_entry *ex_table_end;
-#ifdef __alpha__
-       unsigned long gp;
-#endif
-       /* Members past this point are extensions to the basic
-          module support and are optional.  Use mod_member_present()
-          to examine them.  */
-       const struct module_persist *persist_start;
-       const struct module_persist *persist_end;
-       int (*can_unload)(void);
-       int runsize;                    /* In modutils, not currently used */
-       const char *kallsyms_start;     /* All symbols for kernel debugging */
-       const char *kallsyms_end;
-       const char *archdata_start;     /* arch specific data for module */
-       const char *archdata_end;
-       const char *kernel_data;        /* Reserved for kernel internal use */
-};
-
-struct module_info
-{
-       unsigned long addr;
-       unsigned long size;
-       unsigned long flags;
-       long usecount;
-};
-
-/* Bits of module.flags.  */
-
-#define MOD_UNINITIALIZED      0
-#define MOD_RUNNING            1
-#define MOD_DELETED            2
-#define MOD_AUTOCLEAN          4
-#define MOD_VISITED            8
-#define MOD_USED_ONCE          16
-#define MOD_JUST_FREED         32
-#define MOD_INITIALIZING       64
-
-/* Values for query_module's which.  */
-
-#define QM_MODULES     1
-#define QM_DEPS                2
-#define QM_REFS                3
-#define QM_SYMBOLS     4
-#define QM_INFO                5
-
-/* Can the module be queried? */
-#define MOD_CAN_QUERY(mod) (((mod)->flags & (MOD_RUNNING | MOD_INITIALIZING)) && !((mod)->flags & MOD_DELETED))
-
-/* When struct module is extended, we must test whether the new member
-   is present in the header received from insmod before we can use it.  
-   This function returns true if the member is present.  */
-
-#define mod_member_present(mod,member)                                         \
-       ((unsigned long)(&((struct module *)0L)->member + 1)            \
-        <= (mod)->size_of_struct)
-
-/*
- * Ditto for archdata.  Assumes mod->archdata_start and mod->archdata_end
- * are validated elsewhere.
- */
-#define mod_archdata_member_present(mod, type, member)                 \
-       (((unsigned long)(&((type *)0L)->member) +                      \
-         sizeof(((type *)0L)->member)) <=                              \
-        ((mod)->archdata_end - (mod)->archdata_start))
-        
-
-/* Check if an address p with number of entries n is within the body of module m */
-#define mod_bound(p, n, m) ((unsigned long)(p) >= ((unsigned long)(m) + ((m)->size_of_struct)) && \
-                (unsigned long)((p)+(n)) <= (unsigned long)(m) + (m)->size)
-
-/* Backwards compatibility definition.  */
-
-#define GET_USE_COUNT(module)  (atomic_read(&(module)->uc.usecount))
-
-/* Poke the use count of a module.  */
-
-#define __MOD_INC_USE_COUNT(mod)                                       \
-       (atomic_inc(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED|MOD_USED_ONCE)
-#define __MOD_DEC_USE_COUNT(mod)                                       \
-       (atomic_dec(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED)
-#define __MOD_IN_USE(mod)                                              \
-       (mod_member_present((mod), can_unload) && (mod)->can_unload     \
-        ? (mod)->can_unload() : atomic_read(&(mod)->uc.usecount))
-
-/* Indirect stringification.  */
-
-#define __MODULE_STRING_1(x)   #x
-#define __MODULE_STRING(x)     __MODULE_STRING_1(x)
-
-#endif /* _SYS_MODULE_H */
index b5f327bb33091a89027fc9f1834460f7491171ef..c30054edfd326566e95b0af94bcaa8ed79201f93 100644 (file)
@@ -37,7 +37,7 @@ int bindresvport(int sd, struct sockaddr_in *sin)
        
        for (i = 0; i < NUM_PORTS; i++, port++) {
                sin->sin_port = htons(port);
        
        for (i = 0; i < NUM_PORTS; i++, port++) {
                sin->sin_port = htons(port);
-               if ((ret = bind(sd, sin, sizeof(*sin))) != -1)
+               if ((ret = bind(sd, (struct sockaddr *)&sin, sizeof(*sin))) != -1)
                        break;
                if (port == END_PORT)
                        port = START_PORT;
                        break;
                if (port == END_PORT)
                        port = START_PORT;
index 3d28cba601ed4dea3fbd70c970b3d81bbf1e535c..aedf4dceb562916eac2f65a4b366a712d6a522de 100644 (file)
@@ -19,7 +19,7 @@
  * Prefer mmap2() over mmap(), except on the architectures listed
  */
 
  * Prefer mmap2() over mmap(), except on the architectures listed
  */
 
-#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__)
+#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc64__)
 
 /* This architecture uses mmap2() */
 
 
 /* This architecture uses mmap2() */
 
index e583491b35f8af712d8026870ece455537ba43d0..12aef40d932995136ec6ac280d5e64be62c09f57 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * strcasecmp.c
 /*
  * strcasecmp.c
- *
  */
 
 #include <string.h>
  */
 
 #include <string.h>
@@ -8,18 +7,17 @@
 
 int strcasecmp(const char *s1, const char *s2)
 {
 
 int strcasecmp(const char *s1, const char *s2)
 {
-       char *n1, *n2;
-       int i, retval;
+  const unsigned char *c1 = s1, *c2 = s2;
+  unsigned char ch;
+  int d = 0;
 
 
-       n1 = strdup(s1);
-       n2 = strdup(s2);
+  while ( 1 ) {
+    /* toupper() expects an unsigned char (implicitly cast to int)
+       as input, and returns an int, which is exactly what we want. */
+    d = toupper(ch = *c1++) - toupper(*c2++);
+    if ( d || !ch )
+      break;
+  }
 
 
-       for (i = 0; i < strlen(n1); i++)
-               n1[i] = toupper(n1[i]);
-       for (i = 0; i < strlen(n2); i++)
-               n2[i] = toupper(n2[i]);
-       retval = strcmp(n1, n2);
-       free(n1);
-       free(n2);
-       return retval;
+  return d;
 }
 }
index 754a30693cc54f4100860a2e9290e8764fae8783..62705553a6d000df790d183f2208c2827a1c1708 100644 (file)
@@ -10,7 +10,6 @@ char *strerror(int errnum)
 
   char numbuf[32];
   char *p;
 
   char numbuf[32];
   char *p;
-  int len;
 
   p = numbuf+sizeof numbuf;
   *--p = '\0';
 
   p = numbuf+sizeof numbuf;
   *--p = '\0';
index 542493de0f83e541c5a623ec70a5e51413b31239..3309d1a7fe6b4074f3285b6d4a764007ab8b9085 100644 (file)
@@ -7,18 +7,17 @@
 
 int strncasecmp(const char *s1, const char *s2, size_t n)
 {
 
 int strncasecmp(const char *s1, const char *s2, size_t n)
 {
-       char *n1, *n2;
-       int i, retval;
+  const unsigned char *c1 = s1, *c2 = s2;
+  unsigned char ch;
+  int d = 0;
 
 
-       n1 = strndup(s1, n);
-       n2 = strndup(s2, n);
+  while ( n-- ) {
+    /* toupper() expects an unsigned char (implicitly cast to int)
+       as input, and returns an int, which is exactly what we want. */
+    d = toupper(ch = *c1++) - toupper(*c2++);
+    if ( d || !ch )
+      break;
+  }
 
 
-       for (i = 0; i < strlen(n1); i++)
-               n1[i] = toupper(n1[i]);
-       for (i = 0; i < strlen(n2); i++)
-               n2[i] = toupper(n2[i]);
-       retval = strcmp(n1, n2);
-       free(n1);
-       free(n2);
-       return retval;
+  return d;
 }
 }
index 98a41c37730f8c06efd806e416734759f975abe8..4dbde1389f77cce75743192b751e9fecc24f1ba0 100644 (file)
@@ -11,7 +11,7 @@ int strncmp(const char *s1, const char *s2, size_t n)
   int d = 0;
 
   while ( n-- ) {
   int d = 0;
 
   while ( n-- ) {
-    d = (int)*c2++ - (int)(ch = *c1++);
+    d = (int)(ch = *c1++) - (int)*c2++;
     if ( d || !ch )
       break;
   }
     if ( d || !ch )
       break;
   }
index 224e240e3831fe98d449497800b8ed66fb6b738a..916d4eb0c02af3a2b05486077a47dcb37fdf5e85 100644 (file)
@@ -15,7 +15,6 @@
 #include <sys/dirent.h>
 #include <sys/klog.h>
 #include <sys/mman.h>
 #include <sys/dirent.h>
 #include <sys/klog.h>
 #include <sys/mman.h>
-#include <sys/module.h>
 #include <sys/resource.h>
 #include <sys/select.h>
 #include <sys/stat.h>
 #include <sys/resource.h>
 #include <sys/select.h>
 #include <sys/stat.h>
index 14d5173cb2fb3c54df7dce417aabd9f3ced5e78a..70c642c06762550a8d29b85d3f08eac2a2a13359 100644 (file)
@@ -8,7 +8,7 @@ int main(void)
     int i;
     int r;
 
     int i;
     int r;
 
-    for(i = 0; i < sizeof(t1); i++)
+    for(i = 0; i < (int)sizeof(t1); i++)
        t1[i] = t2[i] = (unsigned char)i;
 
     r = memcmp(t1, t2, sizeof(t1));
        t1[i] = t2[i] = (unsigned char)i;
 
     r = memcmp(t1, t2, sizeof(t1));
@@ -19,7 +19,7 @@ int main(void)
     r = memcmp(t1, t2, sizeof(t1));
     printf("memcmp r = %d\n", r);
 
     r = memcmp(t1, t2, sizeof(t1));
     printf("memcmp r = %d\n", r);
 
-    for (i = 0; i < sizeof(t1); i++)
+    for (i = 0; i < (int)sizeof(t1); i++)
        t1[i] = 0xaa;
     memset(t2, 0xaa, sizeof(t2));
     r = memcmp(t1, t2, sizeof(t1));
        t1[i] = 0xaa;
     memset(t2, 0xaa, sizeof(t2));
     r = memcmp(t1, t2, sizeof(t1));
index c599150858d59bdad3b3d936ccca545dbd1938ab..20898270f4eeb7107c12c7702ab08a9bc669ba26 100644 (file)
@@ -396,6 +396,7 @@ static void print_proc(void){
     );
     break;
   default:
     );
     break;
   default:
+    break;
   }
   if(show_args) printf(" [%s]\n", P_cmd);
   else          printf(" %s\n", P_cmd);
   }
   if(show_args) printf(" [%s]\n", P_cmd);
   else          printf(" %s\n", P_cmd);
index e6e9cf41cc536a82fea46962bfbf353dcbcc706b..fd6d73e4a0554be7673f39086280788941fefc24 100644 (file)
@@ -1 +1 @@
-0.82
+0.95