Various bug fixes than didn't happen on i386.

diff --git a/SYSCALLS b/SYSCALLS
index 62a3471..331076c 100644
--- a/SYSCALLS
+++ b/SYSCALLS
@@ -113,8 +113,8 @@
 int rt_sigsuspend(const sigset_t *, size_t)
 int rt_sigpending(sigset_t *, size_t)
 int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t)
-int getitimer(int, struct itimerval *);
-int setitimer(int, const struct itimerval *, struct itimerval *);
+int getitimer(int, struct itimerval *)
+int setitimer(int, const struct itimerval *, struct itimerval *)
 
 #
 # Time-related system calls
diff --git a/arch/alpha/pipe.c b/arch/alpha/pipe.c
index 8c587a9..5aee9ed 100644
--- a/arch/alpha/pipe.c
+++ b/arch/alpha/pipe.c
@@ -7,7 +7,6 @@
 
 int pipe(int *fds)
 {
-  long sc_err;
   register long sc_0 __asm__("$0");
   register long sc_19 __asm__("$19");
   register long sc_20 __asm__("$20");
diff --git a/exits.S b/exits.S
deleted file mode 100644
index 73fec59..0000000
--- a/exits.S
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# exit and _exit get included in *every* program, and gcc generates
-# horrible code for them.  Yes, this only saves a few bytes, but
-# it does it in every program.
-#
-
-#include <asm/unistd.h>
-
-#ifdef __i386__
-
-	.data
-	.align 4
-	.globl __exit_handler
-	.type __exit_handler,@object
-__exit_handler:
-	.long _exit
-	.size __exit_handler,4
-
-	.text
-	.align 4
-	.globl exit
-	.type exit,@function
-exit:
-	jmp *(__exit_handler)
-	.size exit,.-exit
-
-	/* No need to save any registers... we're exiting! */
-	.text
-	.align 4
-	.globl _exit
-	.type _exit,@function
-_exit:
-#if __NR_exit == 1
-	popl %ebx
-	xorl %eax,%eax
-	popl %ebx
-	incl %eax
-#else
-	movl 4(%esp),%ebx
-	movl $__NR_exit,%eax
-#endif
-	int $0x80
-	.size _exit,.-exit
-
-#elif defined(__x86_64__)
-
-	.data
-	.align 8
-	.globl __exit_handler
-	.type __exit_handler,@object
-__exit_handler:
-	.quad _exit
-	.size __exit_handler,8
-
-	.text
-	.align 8
-	.globl exit
-	.type exit,@function
-exit:
-	jmp *(__exit_handler)
-	.size exit,.-exit
-
-	/* No need to save any registers... we're exiting! */
-	.text
-	.align 4
-	.globl _exit
-	.type _exit,@function
-_exit:
-	movl $__NR_exit,%rax
-	/* The argument is already in %rdi */
-	syscall
-	.size _exit,.-exit
-
-#endif
diff --git a/include/stdio.h b/include/stdio.h
index a413df3..00a3cf4 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -39,7 +39,7 @@
 
 static __inline__ FILE * __create_file(int __fd)
 {
-  return (FILE *)__fd;
+  return (FILE *)(size_t)__fd;
 }
 
 __extern FILE *fopen(const char *, const char *);
diff --git a/include/sys/socket.h b/include/sys/socket.h
index 4c2e9ff..626726d 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -8,6 +8,16 @@
 #include <klibc/extern.h>
 #include <linux/socket.h>
 
+/* For some reason these may be protected by __KERNEL__ in asm/socket.h */
+#ifndef SOCK_STREAM
+# define SOCK_STREAM    1
+# define SOCK_DGRAM     2
+# define SOCK_RAW       3
+# define SOCK_RDM       4
+# define SOCK_SEQPACKET 5
+# define SOCK_PACKET    10
+#endif
+
 typedef int socklen_t;
 
 __extern int socket(int, int, int);
diff --git a/inet/inet_aton.c b/inet/inet_aton.c
index f9ad81b..e581b49 100644
--- a/inet/inet_aton.c
+++ b/inet/inet_aton.c
@@ -12,7 +12,7 @@
     uint32_t l;
   } a;
 
-  if ( sscanf("%hhu.%hhu.%hhu.%hhu", &a.b[0], &a.b[1], &a.b[2], &a.b[3]) == 4 ) {
+  if ( sscanf(str, "%hhu.%hhu.%hhu.%hhu", &a.b[0], &a.b[1], &a.b[2], &a.b[3]) == 4 ) {
     addr->s_addr = a.l;		/* Always in network byte order */
     return 1;
   } else {
diff --git a/klibc/MCONFIG b/klibc/MCONFIG
index 34d21f1..0fa0eca 100644
--- a/klibc/MCONFIG
+++ b/klibc/MCONFIG
@@ -3,7 +3,7 @@
 # Makefile configuration, without explicit rules
 #
 
-ARCH    = i386
+ARCH    = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
 CROSS   = 
 CC	= $(CROSS)gcc
 LD      = $(CROSS)ld
diff --git a/klibc/SYSCALLS b/klibc/SYSCALLS
index 62a3471..331076c 100644
--- a/klibc/SYSCALLS
+++ b/klibc/SYSCALLS
@@ -113,8 +113,8 @@
 int rt_sigsuspend(const sigset_t *, size_t)
 int rt_sigpending(sigset_t *, size_t)
 int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t)
-int getitimer(int, struct itimerval *);
-int setitimer(int, const struct itimerval *, struct itimerval *);
+int getitimer(int, struct itimerval *)
+int setitimer(int, const struct itimerval *, struct itimerval *)
 
 #
 # Time-related system calls
diff --git a/klibc/arch/alpha/pipe.c b/klibc/arch/alpha/pipe.c
index 8c587a9..5aee9ed 100644
--- a/klibc/arch/alpha/pipe.c
+++ b/klibc/arch/alpha/pipe.c
@@ -7,7 +7,6 @@
 
 int pipe(int *fds)
 {
-  long sc_err;
   register long sc_0 __asm__("$0");
   register long sc_19 __asm__("$19");
   register long sc_20 __asm__("$20");
diff --git a/klibc/include/stdio.h b/klibc/include/stdio.h
index a413df3..00a3cf4 100644
--- a/klibc/include/stdio.h
+++ b/klibc/include/stdio.h
@@ -39,7 +39,7 @@
 
 static __inline__ FILE * __create_file(int __fd)
 {
-  return (FILE *)__fd;
+  return (FILE *)(size_t)__fd;
 }
 
 __extern FILE *fopen(const char *, const char *);
diff --git a/klibc/include/sys/socket.h b/klibc/include/sys/socket.h
index 4c2e9ff..626726d 100644
--- a/klibc/include/sys/socket.h
+++ b/klibc/include/sys/socket.h
@@ -8,6 +8,16 @@
 #include <klibc/extern.h>
 #include <linux/socket.h>
 
+/* For some reason these may be protected by __KERNEL__ in asm/socket.h */
+#ifndef SOCK_STREAM
+# define SOCK_STREAM    1
+# define SOCK_DGRAM     2
+# define SOCK_RAW       3
+# define SOCK_RDM       4
+# define SOCK_SEQPACKET 5
+# define SOCK_PACKET    10
+#endif
+
 typedef int socklen_t;
 
 __extern int socket(int, int, int);
diff --git a/klibc/inet/inet_aton.c b/klibc/inet/inet_aton.c
index f9ad81b..e581b49 100644
--- a/klibc/inet/inet_aton.c
+++ b/klibc/inet/inet_aton.c
@@ -12,7 +12,7 @@
     uint32_t l;
   } a;
 
-  if ( sscanf("%hhu.%hhu.%hhu.%hhu", &a.b[0], &a.b[1], &a.b[2], &a.b[3]) == 4 ) {
+  if ( sscanf(str, "%hhu.%hhu.%hhu.%hhu", &a.b[0], &a.b[1], &a.b[2], &a.b[3]) == 4 ) {
     addr->s_addr = a.l;		/* Always in network byte order */
     return 1;
   } else {
diff --git a/klibc/nice.c b/klibc/nice.c
index c3d9da6..f0d97a3 100644
--- a/klibc/nice.c
+++ b/klibc/nice.c
@@ -4,6 +4,7 @@
 
 #include <unistd.h>
 #include <sched.h>
+#include <sys/resource.h>
 #include <sys/syscall.h>
 
 #ifdef __NR_nice
@@ -15,7 +16,7 @@
 int nice(int inc)
 {
   pid_t me = getpid();
-  return setpriority(me, PRIO_PROCESS, getpriority(me, PRIO_PROCESS));
+  return setpriority(me, PRIO_PROCESS, getpriority(me, PRIO_PROCESS)+inc);
 }
 
 #endif
diff --git a/nice.c b/nice.c
index c3d9da6..f0d97a3 100644
--- a/nice.c
+++ b/nice.c
@@ -4,6 +4,7 @@
 
 #include <unistd.h>
 #include <sched.h>
+#include <sys/resource.h>
 #include <sys/syscall.h>
 
 #ifdef __NR_nice
@@ -15,7 +16,7 @@
 int nice(int inc)
 {
   pid_t me = getpid();
-  return setpriority(me, PRIO_PROCESS, getpriority(me, PRIO_PROCESS));
+  return setpriority(me, PRIO_PROCESS, getpriority(me, PRIO_PROCESS)+inc);
 }
 
 #endif
diff --git a/socketcall.S b/socketcall.S
deleted file mode 100644
index 6bac1e6..0000000
--- a/socketcall.S
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# socketcall.S
-#
-# On i386, the main (only?) user of socketcall(2), the memory array
-# socketcall(2) needs is conveniently already assembled for us on
-# the stack.  Capitalize on that to make a common socketcall stub.
-#
-
-#include <asm/unistd.h>
-
-#ifdef __i386__
-
-	.text
-	.align 4
-	.globl __socketcall_common
-	.type __socketcall_common, @function
-
-__socketcall_common:
-	pushl %ebx
-	movzbl %al,%ebx		# The socketcall number is passed in in %al
-	leal 8(%esp),%ecx	# Argument pointer
-	movl $__NR_socketcall, %eax
-	int $0x80
-	cmpl $-125,%eax		# Error return?
-	popl %ebx
-	jb 1f
-	neg %eax
-	movl %eax,errno
-	xorl %eax,%eax
-	decl %eax		# Return = -1
-1:
-	ret
-
-	.size __socketcall_common,.-__socketcall_common
-	
-#endif
-
-