Add a few more system-specific dependencies.
diff --git a/SYSCALLS b/SYSCALLS
index bf6cecc..267fe8d 100644
--- a/SYSCALLS
+++ b/SYSCALLS
@@ -8,8 +8,7 @@
#
# Process-related syscalls
#
-# Some platforms don't seem to have vfork()?
-# pid_t vfork()
+<!mips,mips64> pid_t vfork()
pid_t getpid()
int setpgid(pid_t, pid_t)
pid_t getpgid(pid_t)
@@ -19,7 +18,7 @@
pid_t getsid(pid_t)
pid_t wait4(pid_t, int *, int, struct rusage *)
int execve(const char *, char * const *, char * const *)
-int nice(int)
+<!x86_64,ia64,alpha> int nice(int)
#
# User and group IDs
@@ -43,8 +42,8 @@
# Filesystem-related system calls
#
int mount(const char *, const char *, const char *, unsigned long, const void *)
-int umount(const char *)
-int umount2(const char *, int)
+<!alpha,ia64> int umount2(const char *, int)
+<alpha,ia64> int umount::umount2(const char *, int)
int pivot_root(const char *, const char *)
int sync()
int statfs(const char *, struct statfs *)
@@ -105,13 +104,12 @@
int rt_sigsuspend(const sigset_t *, size_t)
int rt_sigpending(sigset_t *, size_t)
int pause()
-unsigned int alarm(unsigned int)
+<!alpha,ia64> unsigned int alarm(unsigned int)
int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t)
#
# Time-related system calls
#
-time_t time(time_t *)
clock_t times(struct tms *)
int gettimeofday(struct timeval *, struct timezone *)
int settimeofday(const struct timeval *, const struct timezone *)
diff --git a/klibc/Makefile b/klibc/Makefile
index b9b6c58..3244021 100644
--- a/klibc/Makefile
+++ b/klibc/Makefile
@@ -28,7 +28,8 @@
strcmp.o strcpy.o strdup.o strlen.o strncat.o strstr.o \
strncmp.o strncpy.o strrchr.o strspn.o strsep.o strtok.o \
gethostname.o getdomainname.o getcwd.o seteuid.o setegid.o \
- getenv.o setenv.o unsetenv.o getopt.o
+ getenv.o setenv.o unsetenv.o getopt.o \
+ time.o
LIB = libc.a
SOFLAGS = -fPIC
diff --git a/klibc/SYSCALLS b/klibc/SYSCALLS
index bf6cecc..267fe8d 100644
--- a/klibc/SYSCALLS
+++ b/klibc/SYSCALLS
@@ -8,8 +8,7 @@
#
# Process-related syscalls
#
-# Some platforms don't seem to have vfork()?
-# pid_t vfork()
+<!mips,mips64> pid_t vfork()
pid_t getpid()
int setpgid(pid_t, pid_t)
pid_t getpgid(pid_t)
@@ -19,7 +18,7 @@
pid_t getsid(pid_t)
pid_t wait4(pid_t, int *, int, struct rusage *)
int execve(const char *, char * const *, char * const *)
-int nice(int)
+<!x86_64,ia64,alpha> int nice(int)
#
# User and group IDs
@@ -43,8 +42,8 @@
# Filesystem-related system calls
#
int mount(const char *, const char *, const char *, unsigned long, const void *)
-int umount(const char *)
-int umount2(const char *, int)
+<!alpha,ia64> int umount2(const char *, int)
+<alpha,ia64> int umount::umount2(const char *, int)
int pivot_root(const char *, const char *)
int sync()
int statfs(const char *, struct statfs *)
@@ -105,13 +104,12 @@
int rt_sigsuspend(const sigset_t *, size_t)
int rt_sigpending(sigset_t *, size_t)
int pause()
-unsigned int alarm(unsigned int)
+<!alpha,ia64> unsigned int alarm(unsigned int)
int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t)
#
# Time-related system calls
#
-time_t time(time_t *)
clock_t times(struct tms *)
int gettimeofday(struct timeval *, struct timezone *)
int settimeofday(const struct timeval *, const struct timezone *)
diff --git a/klibc/syscalls.pl b/klibc/syscalls.pl
index 37c594a..303c754 100644
--- a/klibc/syscalls.pl
+++ b/klibc/syscalls.pl
@@ -1,13 +1,35 @@
#!/usr/bin/perl
+($arch) = @ARGV;
+
while ( defined($line = <STDIN>) ) {
chomp $line;
$line =~ s/\s*\#.*$//; # Strip comments and trailing blanks
- if ( $line =~ /^\s*([^\(]+[^:A-Za-z0-9_])([A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) {
- $type = $1;
- $sname = $2;
- $fname = $3;
- $argv = $4;
+ if ( $line =~ /^\s*(\<[^\>]+\>\s+|)([^\(\<\>]+[^:A-Za-z0-9_])([A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) {
+ $archs = $1;
+ $type = $2;
+ $sname = $3;
+ $fname = $4;
+ $argv = $5;
+
+ $doit = 1;
+ if ( $archs ne '' ) {
+ die "$0: Internal error"
+ unless ( $archs =~ /^\<(|\!)([^\>\!]+)\>/ );
+ $not = $1;
+ $list = $2;
+
+ $doit = ($not eq '') ? 0 : 1;
+
+ @list = split(/,/, $list);
+ foreach $a ( @list ) {
+ if ( $a eq $arch ) {
+ $doit = ($not eq '') ? 1 : 0;
+ last;
+ }
+ }
+ }
+ next if ( ! $doit );
$type =~ s/\s*$//;
diff --git a/klibc/time.c b/klibc/time.c
new file mode 100644
index 0000000..8f6e897
--- /dev/null
+++ b/klibc/time.c
@@ -0,0 +1,27 @@
+/*
+ * time.c
+ */
+
+#include <time.h>
+#include <sys/time.h>
+#include <sys/syscall.h>
+
+#ifdef __NR_time
+
+_syscall1(time_t,time,time_t *,t);
+
+#else
+
+time_t time(time_t *t)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+
+ if ( t )
+ *t = (time_t)tv.tv_sec;
+
+ return (time_t)tv.tv_sec;
+}
+
+#endif
diff --git a/klibc/umount.c b/klibc/umount.c
new file mode 100644
index 0000000..9a8e62a
--- /dev/null
+++ b/klibc/umount.c
@@ -0,0 +1,12 @@
+/*
+ * umount.c
+ *
+ * Single-argument form of umount
+ */
+
+#include <sys/mount.h>
+
+int umount(const char *dir)
+{
+ return umount2(dir, 0);
+}
diff --git a/syscalls.pl b/syscalls.pl
index 37c594a..303c754 100644
--- a/syscalls.pl
+++ b/syscalls.pl
@@ -1,13 +1,35 @@
#!/usr/bin/perl
+($arch) = @ARGV;
+
while ( defined($line = <STDIN>) ) {
chomp $line;
$line =~ s/\s*\#.*$//; # Strip comments and trailing blanks
- if ( $line =~ /^\s*([^\(]+[^:A-Za-z0-9_])([A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) {
- $type = $1;
- $sname = $2;
- $fname = $3;
- $argv = $4;
+ if ( $line =~ /^\s*(\<[^\>]+\>\s+|)([^\(\<\>]+[^:A-Za-z0-9_])([A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) {
+ $archs = $1;
+ $type = $2;
+ $sname = $3;
+ $fname = $4;
+ $argv = $5;
+
+ $doit = 1;
+ if ( $archs ne '' ) {
+ die "$0: Internal error"
+ unless ( $archs =~ /^\<(|\!)([^\>\!]+)\>/ );
+ $not = $1;
+ $list = $2;
+
+ $doit = ($not eq '') ? 0 : 1;
+
+ @list = split(/,/, $list);
+ foreach $a ( @list ) {
+ if ( $a eq $arch ) {
+ $doit = ($not eq '') ? 1 : 0;
+ last;
+ }
+ }
+ }
+ next if ( ! $doit );
$type =~ s/\s*$//;
diff --git a/time.c b/time.c
new file mode 100644
index 0000000..8f6e897
--- /dev/null
+++ b/time.c
@@ -0,0 +1,27 @@
+/*
+ * time.c
+ */
+
+#include <time.h>
+#include <sys/time.h>
+#include <sys/syscall.h>
+
+#ifdef __NR_time
+
+_syscall1(time_t,time,time_t *,t);
+
+#else
+
+time_t time(time_t *t)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+
+ if ( t )
+ *t = (time_t)tv.tv_sec;
+
+ return (time_t)tv.tv_sec;
+}
+
+#endif
diff --git a/umount.c b/umount.c
new file mode 100644
index 0000000..9a8e62a
--- /dev/null
+++ b/umount.c
@@ -0,0 +1,12 @@
+/*
+ * umount.c
+ *
+ * Single-argument form of umount
+ */
+
+#include <sys/mount.h>
+
+int umount(const char *dir)
+{
+ return umount2(dir, 0);
+}