From 557856bdd9b9d8f8a4d767034df58831a96c1a93 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 26 Apr 2002 23:21:29 +0000 Subject: 2002-04-26 Jeff Johnston * libc/sys/linux/Makefile.am: Add io64.c. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/io.c(mkfifo, fsync, fdatasync): Added syscalls. * libc/sys/linux/signal.c (sigwaitinfo, sigtimedwait): Ditto. * libc/sys/linux/io64.c: New file. --- newlib/ChangeLog | 8 ++++++++ newlib/libc/sys/linux/Makefile.am | 2 +- newlib/libc/sys/linux/Makefile.in | 12 ++++++------ newlib/libc/sys/linux/io.c | 20 +++++++++++-------- newlib/libc/sys/linux/io64.c | 41 +++++++++++++++++++++++++++++++++++++++ newlib/libc/sys/linux/signal.c | 12 ++++++++++++ 6 files changed, 80 insertions(+), 15 deletions(-) create mode 100644 newlib/libc/sys/linux/io64.c diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 689e32629..37a7a11f6 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,11 @@ +2002-04-26 Jeff Johnston + + * libc/sys/linux/Makefile.am: Add io64.c. + * libc/sys/linux/Makefile.in: Regenerated. + * libc/sys/linux/io.c(mkfifo, fsync, fdatasync): Added syscalls. + * libc/sys/linux/signal.c (sigwaitinfo, sigtimedwait): Ditto. + * libc/sys/linux/io64.c: New file. + 2002-04-26 Jeff Johnston * configure.in (CC_FOR_NEWLIB): New variable that diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am index fec559293..6b919da8c 100644 --- a/newlib/libc/sys/linux/Makefile.am +++ b/newlib/libc/sys/linux/Makefile.am @@ -8,7 +8,7 @@ SUBDIRS = machine . SUBLIBS = $(LINUX_MACH_LIB) LIB_SOURCES = \ - brk.c getoptlong.c ids.c inode.c io.c linux.c mmap.c \ + brk.c getoptlong.c ids.c inode.c io.c io64.c linux.c mmap.c \ process.c realpath.c sched.c \ select.c signal.c siglongjmp.c socket.c sleep.c stack.c \ sysconf.c systat.c termios.c time.c \ diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in index f13defa33..e4f840bc6 100644 --- a/newlib/libc/sys/linux/Makefile.in +++ b/newlib/libc/sys/linux/Makefile.in @@ -97,7 +97,7 @@ SUBDIRS = machine . SUBLIBS = $(LINUX_MACH_LIB) LIB_SOURCES = \ - brk.c getoptlong.c ids.c inode.c io.c linux.c mmap.c \ + brk.c getoptlong.c ids.c inode.c io.c io64.c linux.c mmap.c \ process.c realpath.c sched.c \ select.c signal.c siglongjmp.c socket.c sleep.c stack.c \ sysconf.c systat.c termios.c time.c \ @@ -132,15 +132,15 @@ DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ @USE_LIBTOOL_FALSE@lib_a_OBJECTS = brk.o getoptlong.o ids.o inode.o \ -@USE_LIBTOOL_FALSE@io.o linux.o mmap.o process.o realpath.o sched.o \ -@USE_LIBTOOL_FALSE@select.o signal.o siglongjmp.o socket.o sleep.o \ -@USE_LIBTOOL_FALSE@stack.o sysconf.o systat.o termios.o time.o usleep.o \ -@USE_LIBTOOL_FALSE@wait.o +@USE_LIBTOOL_FALSE@io.o io64.o linux.o mmap.o process.o realpath.o \ +@USE_LIBTOOL_FALSE@sched.o select.o signal.o siglongjmp.o socket.o \ +@USE_LIBTOOL_FALSE@sleep.o stack.o sysconf.o systat.o termios.o time.o \ +@USE_LIBTOOL_FALSE@usleep.o wait.o LTLIBRARIES = $(noinst_LTLIBRARIES) @USE_LIBTOOL_TRUE@liblinux_la_DEPENDENCIES = @USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = brk.lo getoptlong.lo ids.lo \ -@USE_LIBTOOL_TRUE@inode.lo io.lo linux.lo mmap.lo process.lo \ +@USE_LIBTOOL_TRUE@inode.lo io.lo io64.lo linux.lo mmap.lo process.lo \ @USE_LIBTOOL_TRUE@realpath.lo sched.lo select.lo signal.lo \ @USE_LIBTOOL_TRUE@siglongjmp.lo socket.lo sleep.lo stack.lo sysconf.lo \ @USE_LIBTOOL_TRUE@systat.lo termios.lo time.lo usleep.lo wait.lo diff --git a/newlib/libc/sys/linux/io.c b/newlib/libc/sys/linux/io.c index 9b39e12a8..31b9da7cc 100644 --- a/newlib/libc/sys/linux/io.c +++ b/newlib/libc/sys/linux/io.c @@ -17,6 +17,7 @@ #define __NR___ioctl __NR_ioctl #define __NR___flock __NR_flock +#define __NR___mknod __NR_mknod _syscall3(int,read,int,fd,void *,buf,size_t,count) _syscall3(ssize_t,readv,int,fd,const struct iovec *,vec,int,count) @@ -29,10 +30,12 @@ _syscall0(int,sync) _syscall1(int,dup,int,fd) _syscall2(int,dup2,int,oldfd,int,newfd) _syscall3(int,fcntl,int,fd,int,cmd,long,arg) +_syscall1(int,fdatasync,int,fd) +_syscall1(int,fsync,int,fd) - +static _syscall2(long,__flock,unsigned int,fd,unsigned int,cmd) static _syscall3(int,__ioctl,int,fd,int,request,void *,arg) - +static _syscall3(int,__mknod,const char *,path,mode_t,mode,dev_t *,dev) int ioctl(int fd,int request,...) { @@ -45,13 +48,14 @@ int ioctl(int fd,int request,...) return res; } - -/* Why are all the types gratuituously different ? */ - -static _syscall2(long,__flock,unsigned int,fd,unsigned int,cmd) - - int flock(int fd,int operation) { return __flock(fd,operation); } + +int mkfifo(const char *path, mode_t mode) +{ + dev_t dev = 0; + return __mknod(path, mode | S_IFIFO, &dev); +} + diff --git a/newlib/libc/sys/linux/io64.c b/newlib/libc/sys/linux/io64.c new file mode 100644 index 000000000..c18854bf7 --- /dev/null +++ b/newlib/libc/sys/linux/io64.c @@ -0,0 +1,41 @@ +/* libc/sys/linux/io64.c - large file input/output system calls */ + +/* Copyright 2002, Red Hat Inc. */ + + +#define __KERNEL_PROTOTYPES + +#include +#include +#include +#include +#include +#include +#include +#include + +_syscall2(int,stat64,const char *,name,struct stat64 *,st) + +static _syscall5(void,_llseek,int,fd,off_t,hi,off_t,lo,loff_t *,pos,int,whence) + +loff_t lseek64(int fd, loff_t offset, int whence) +{ + loff_t pos; + _llseek(fd, offset >> 32, offset & 0xffffffff, &pos, whence); + return pos; +} + +int open64(const char *path, int oflag, ...) +{ + mode_t mode = 0; + if (oflag & O_CREAT) + { + va_list list; + va_start(list, oflag); + mode = va_arg(list, int); + va_end(list); + } + return open(path, oflag | O_LARGEFILE, mode); +} + + diff --git a/newlib/libc/sys/linux/signal.c b/newlib/libc/sys/linux/signal.c index 813b9d9cd..7b8f0f4db 100644 --- a/newlib/libc/sys/linux/signal.c +++ b/newlib/libc/sys/linux/signal.c @@ -12,6 +12,7 @@ #define __NR___sgetmask __NR_sgetmask #define __NR___ssetmask __NR_ssetmask #define __NR___sigsuspend __NR_sigsuspend +#define __NR___rt_sigtimedwait __NR_rt_sigtimedwait _syscall2(int,kill,pid_t,pid,int,sig) _syscall2(__sighandler_t,signal,int,signum,__sighandler_t,handler) @@ -25,6 +26,7 @@ _syscall3(int,sigprocmask,int,how,const sigset_t *,set,sigset_t *,oldset) static _syscall0(int,__sgetmask) static _syscall1(int,__ssetmask,int,newmask) static _syscall3(int,__sigsuspend,int,arg1,int,arg2,int,mask) +static _syscall4(int,__rt_sigtimedwait,const sigset_t *,set,siginfo_t *,info,struct timespec *,timeout,size_t,size) int sigsuspend (const sigset_t *mask) { @@ -54,6 +56,16 @@ int raise(int sig) return kill(getpid(),sig); } +int sigtimedwait(const sigset_t *set, siginfo_t *info, + struct timespec *timeout) +{ + return __rt_sigtimedwait(set, info, timeout, sizeof(sigset_t)); +} + +int sigwaitinfo(const sigset_t *set, siginfo_t *info) +{ + return __rt_sigtimedwait(set, info, NULL, sizeof(sigset_t)); +} const char *const sys_siglist[] = { #include "siglist.inc" -- cgit v1.2.3