Skip to content

Commit da1edf5

Browse files
authored
Merge pull request #73 from bucanero/unlink
Adds unlink() function
2 parents 7b40dec + c69043f commit da1edf5

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

ppu/crt/crt1.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern long int __librt_telldir_r(struct _reent *r,DIR *dirp);
3232
extern void __librt_rewinddir_r(struct _reent *r,DIR *dirp);
3333
extern void __librt_seekdir_r(struct _reent *r,DIR *dirp,long int loc);
3434
extern int __librt_rmdir_r(struct _reent *r,const char *dirname);
35+
extern int __librt_unlink_r(struct _reent *r,const char *path);
3536

3637
extern int __librt_usleep_r(struct _reent *r,useconds_t usec);
3738
extern unsigned int __librt_sleep_r(struct _reent *r,unsigned int seconds);
@@ -76,6 +77,7 @@ static void __syscalls_init(void)
7677
__syscalls.rewinddir_r = __librt_rewinddir_r;
7778
__syscalls.seekdir_r = __librt_seekdir_r;
7879
__syscalls.rmdir_r = __librt_rmdir_r;
80+
__syscalls.unlink_r = __librt_unlink_r;
7981

8082
__syscalls.sleep_r = __librt_sleep_r;
8183
__syscalls.usleep_r = __librt_usleep_r;

ppu/librt/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ VPATH := $(BASEDIR)
4545
OBJS := \
4646
sbrk.o exit.o close.o lseek.o read.o open.o sleep.o write.o fstat.o \
4747
socket.o lock.o dirent.o mkdir.o times.o umask.o lv2errno.o heap.o \
48-
chmod.o rename.o rmdir.o isatty.o gettod.o settod.o
48+
chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o
4949

5050
all: ppu
5151

ppu/librt/unlink.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <stdio.h>
2+
#include <fcntl.h>
3+
#include <_ansi.h>
4+
#include <_syslist.h>
5+
#include <sys/reent.h>
6+
#include <sys/errno.h>
7+
#include <sys/types.h>
8+
#include <sys/lv2errno.h>
9+
10+
#include <sys/file.h>
11+
12+
int
13+
_DEFUN(__librt_unlink_r,(r,path),
14+
struct _reent *r _AND
15+
const char *path)
16+
{
17+
return lv2errno_r(r,sysLv2FsUnlink(path));
18+
}

0 commit comments

Comments
 (0)