Skip to content

Commit 579ef1a

Browse files
committed
Add link()
uses sysLv2FsLink()
1 parent 2da7ab9 commit 579ef1a

3 files changed

Lines changed: 23 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_link_r(struct _reent *r,const char *old,const char *new);
3536
extern int __librt_unlink_r(struct _reent *r,const char *path);
3637
extern int __librt_access_r(struct _reent *r,const char *path,int amode);
3738

@@ -78,6 +79,7 @@ static void __syscalls_init(void)
7879
__syscalls.rewinddir_r = __librt_rewinddir_r;
7980
__syscalls.seekdir_r = __librt_seekdir_r;
8081
__syscalls.rmdir_r = __librt_rmdir_r;
82+
__syscalls.link_r = __librt_link_r;
8183
__syscalls.unlink_r = __librt_unlink_r;
8284
__syscalls.access_r = __librt_access_r;
8385

ppu/librt/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ 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 unlink.o access.o
48+
chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o access.o \
49+
link.o
4950

5051
all: ppu
5152

ppu/librt/link.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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_link_r,(r,old,new),
14+
struct _reent *r _AND
15+
const char *old _AND
16+
const char *new)
17+
{
18+
return lv2errno_r(r,sysLv2FsLink(old,new));
19+
}

0 commit comments

Comments
 (0)