diff --git a/ppu/crt/crt1.c b/ppu/crt/crt1.c index 6c3826ac..fdca7b25 100644 --- a/ppu/crt/crt1.c +++ b/ppu/crt/crt1.c @@ -14,6 +14,9 @@ extern int __librt_fstat_r(struct _reent *r,int fd,struct stat *st); extern int __librt_fstat64_r(struct _reent *r,int fd,struct stat *st); extern int __librt_stat_r(struct _reent *r,const char *path,struct stat *st); extern int __librt_stat64_r(struct _reent *r,const char *path,struct stat *st); +extern int __librt_ftruncate_r(struct _reent *r,int fd,off_t len); +extern int __librt_truncate_r(struct _reent *r,const char *path,off_t len); +extern int __librt_fsync_r(struct _reent *r,int fd); extern _ssize_t __librt_read_r(struct _reent *r,int fd,void *ptr,size_t len); extern _ssize_t __librt_write_r(struct _reent *r,int fd,const void *ptr,size_t len); extern _off_t __librt_lseek_r(struct _reent *r,int fd,_off_t pos,int dir); @@ -32,6 +35,7 @@ extern long int __librt_telldir_r(struct _reent *r,DIR *dirp); extern void __librt_rewinddir_r(struct _reent *r,DIR *dirp); extern void __librt_seekdir_r(struct _reent *r,DIR *dirp,long int loc); extern int __librt_rmdir_r(struct _reent *r,const char *dirname); +extern int __librt_link_r(struct _reent *r,const char *old,const char *new); extern int __librt_unlink_r(struct _reent *r,const char *path); extern int __librt_access_r(struct _reent *r,const char *path,int amode); @@ -65,6 +69,9 @@ static void __syscalls_init(void) __syscalls.fstat64_r = __librt_fstat64_r; __syscalls.stat_r = __librt_stat_r; __syscalls.stat64_r = __librt_stat64_r; + __syscalls.ftruncate_r = __librt_ftruncate_r; + __syscalls.truncate_r = __librt_truncate_r; + __syscalls.fsync_r = __librt_fsync_r; __syscalls.chmod_r = __librt_chmod_r; __syscalls.rename_r = __librt_rename_r; __syscalls.isatty_r = __librt_isatty_r; @@ -78,6 +85,7 @@ static void __syscalls_init(void) __syscalls.rewinddir_r = __librt_rewinddir_r; __syscalls.seekdir_r = __librt_seekdir_r; __syscalls.rmdir_r = __librt_rmdir_r; + __syscalls.link_r = __librt_link_r; __syscalls.unlink_r = __librt_unlink_r; __syscalls.access_r = __librt_access_r; diff --git a/ppu/librt/Makefile b/ppu/librt/Makefile index ea5892b0..f1c73525 100644 --- a/ppu/librt/Makefile +++ b/ppu/librt/Makefile @@ -45,7 +45,8 @@ VPATH := $(BASEDIR) OBJS := \ sbrk.o exit.o close.o lseek.o read.o open.o sleep.o write.o fstat.o \ socket.o lock.o dirent.o mkdir.o times.o umask.o lv2errno.o heap.o \ - chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o access.o + chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o access.o \ + link.o truncate.o fsync.o all: ppu diff --git a/ppu/librt/fsync.c b/ppu/librt/fsync.c new file mode 100644 index 00000000..d749afc7 --- /dev/null +++ b/ppu/librt/fsync.c @@ -0,0 +1,17 @@ +#include <_ansi.h> +#include <_syslist.h> +#include +#include +#include +#include +#include + +#include + +int +_DEFUN(__librt_fsync_r,(ptr,fd), + struct _reent *ptr _AND + int fd) +{ + return lv2errno_r(ptr,sysLv2FsFsync(fd)); +} diff --git a/ppu/librt/link.c b/ppu/librt/link.c new file mode 100644 index 00000000..44f30d93 --- /dev/null +++ b/ppu/librt/link.c @@ -0,0 +1,19 @@ +#include +#include +#include <_ansi.h> +#include <_syslist.h> +#include +#include +#include +#include + +#include + +int +_DEFUN(__librt_link_r,(r,old,new), + struct _reent *r _AND + const char *old _AND + const char *new) +{ + return lv2errno_r(r,sysLv2FsLink(old,new)); +} diff --git a/ppu/librt/truncate.c b/ppu/librt/truncate.c new file mode 100644 index 00000000..e0f0d66e --- /dev/null +++ b/ppu/librt/truncate.c @@ -0,0 +1,28 @@ +#include +#include +#include <_ansi.h> +#include <_syslist.h> +#include +#include +#include +#include + +#include + +int +_DEFUN(__librt_truncate_r,(r,path,len), + struct _reent *r _AND + const char *path _AND + off_t len) +{ + return lv2errno_r(r,sysLv2FsTruncate(path,len)); +} + +int +_DEFUN(__librt_ftruncate_r,(r,fd,len), + struct _reent *r _AND + int fd _AND + off_t len) +{ + return lv2errno_r(r,sysLv2FsFtruncate(fd,len)); +}