aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-08-14 10:55:38 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-08-14 10:55:38 +0000
commit17e139e8f5bd5b60bddb43247b52a2df48dec6f5 (patch)
tree841e8056408c199d63191aa8e90f4baec35c3b8d
parent5e1d1d885969db05444a9d9bfe1bde3fa2ffaaa9 (diff)
downloadklibc-17e139e8f5bd5b60bddb43247b52a2df48dec6f5.tar.gz
Various bug fixes than didn't happen on i386.klibc-0.36
-rw-r--r--SYSCALLS4
-rw-r--r--arch/alpha/pipe.c1
-rw-r--r--exits.S74
-rw-r--r--include/stdio.h2
-rw-r--r--include/sys/socket.h10
-rw-r--r--inet/inet_aton.c2
-rw-r--r--klibc/MCONFIG2
-rw-r--r--klibc/SYSCALLS4
-rw-r--r--klibc/arch/alpha/pipe.c1
-rw-r--r--klibc/include/stdio.h2
-rw-r--r--klibc/include/sys/socket.h10
-rw-r--r--klibc/inet/inet_aton.c2
-rw-r--r--klibc/nice.c3
-rw-r--r--nice.c3
-rw-r--r--socketcall.S38
15 files changed, 33 insertions, 125 deletions
diff --git a/SYSCALLS b/SYSCALLS
index 62a34716762fd..331076cc7c6bf 100644
--- a/SYSCALLS
+++ b/SYSCALLS
@@ -113,8 +113,8 @@ int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t)
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 8c587a9e24785..5aee9edbab66c 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 73fec593d10d8..0000000000000
--- 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 a413df3f54a5c..00a3cf4d940e9 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -39,7 +39,7 @@ static __inline__ int fileno(FILE *__f)
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 4c2e9ffc5f410..626726d919fba 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 f9ad81bc5fda0..e581b492ad20f 100644
--- a/inet/inet_aton.c
+++ b/inet/inet_aton.c
@@ -12,7 +12,7 @@ int inet_aton(const char *str, struct in_addr *addr)
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 34d21f1538466..0fa0ecac34707 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 62a34716762fd..331076cc7c6bf 100644
--- a/klibc/SYSCALLS
+++ b/klibc/SYSCALLS
@@ -113,8 +113,8 @@ int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t)
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 8c587a9e24785..5aee9edbab66c 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 a413df3f54a5c..00a3cf4d940e9 100644
--- a/klibc/include/stdio.h
+++ b/klibc/include/stdio.h
@@ -39,7 +39,7 @@ static __inline__ int fileno(FILE *__f)
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 4c2e9ffc5f410..626726d919fba 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 f9ad81bc5fda0..e581b492ad20f 100644
--- a/klibc/inet/inet_aton.c
+++ b/klibc/inet/inet_aton.c
@@ -12,7 +12,7 @@ int inet_aton(const char *str, struct in_addr *addr)
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 c3d9da630a9ae..f0d97a3cd025e 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 @@ _syscall1(int,nice,int,inc);
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 c3d9da630a9ae..f0d97a3cd025e 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 @@ _syscall1(int,nice,int,inc);
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 6bac1e6913ef9..0000000000000
--- 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
-
-