diff options
author | H. Peter Anvin <hpa@zytor.com> | 2002-08-09 19:22:18 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2002-08-09 19:22:18 +0000 |
commit | 890774f71952def5d1ae2844c927d1f87ae60f77 (patch) | |
tree | f6fae4e0c18f35fe6de08055b15389873174dd5f | |
parent | 33e448b2d1c411f5a0f24f671432f098138f8cc5 (diff) | |
download | klibc-890774f71952def5d1ae2844c927d1f87ae60f77.tar.gz |
Add a few more system-specific dependencies.klibc-0.1
-rw-r--r-- | SYSCALLS | 12 | ||||
-rw-r--r-- | klibc/Makefile | 3 | ||||
-rw-r--r-- | klibc/SYSCALLS | 12 | ||||
-rw-r--r-- | klibc/syscalls.pl | 32 | ||||
-rw-r--r-- | klibc/time.c | 27 | ||||
-rw-r--r-- | klibc/umount.c | 12 | ||||
-rw-r--r-- | syscalls.pl | 32 | ||||
-rw-r--r-- | time.c | 27 | ||||
-rw-r--r-- | umount.c | 12 |
9 files changed, 144 insertions, 25 deletions
diff --git a/SYSCALLS b/SYSCALLS index bf6ceccb49ec6..267fe8d0f2ffb 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 setsid() 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 @@ int setfsgid(gid_t) # 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_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 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 b9b6c583d6f5a..3244021bbc526 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -28,7 +28,8 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ 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 bf6ceccb49ec6..267fe8d0f2ffb 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 setsid() 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 @@ int setfsgid(gid_t) # 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_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 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 37c594a844c48..303c754eef33d 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 0000000000000..8f6e89738d03b --- /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 0000000000000..9a8e62a779bbe --- /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 37c594a844c48..303c754eef33d 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 0000000000000..8f6e89738d03b --- /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 0000000000000..9a8e62a779bbe --- /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); +} |