Skip to content

Commit f1ab220

Browse files
authored
Merge pull request #74 from bucanero/access
Add access() function
2 parents 01b3d4d + 4711e71 commit f1ab220

6 files changed

Lines changed: 30 additions & 1 deletion

File tree

ppu/crt/crt1.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ 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);
3535
extern int __librt_unlink_r(struct _reent *r,const char *path);
36+
extern int __librt_access_r(struct _reent *r,const char *path,int amode);
3637

3738
extern int __librt_usleep_r(struct _reent *r,useconds_t usec);
3839
extern unsigned int __librt_sleep_r(struct _reent *r,unsigned int seconds);
@@ -78,6 +79,7 @@ static void __syscalls_init(void)
7879
__syscalls.seekdir_r = __librt_seekdir_r;
7980
__syscalls.rmdir_r = __librt_rmdir_r;
8081
__syscalls.unlink_r = __librt_unlink_r;
82+
__syscalls.access_r = __librt_access_r;
8183

8284
__syscalls.sleep_r = __librt_sleep_r;
8385
__syscalls.usleep_r = __librt_usleep_r;

ppu/include/lv2/sysfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ s32 sysFsChmod(const char* path, s32 mode);
7070
s32 sysFsMkdir(const char* path, s32 mode);
7171
s32 sysFsRmdir(const char *path);
7272
s32 sysFsUnlink(const char *path);
73+
s32 sysFsAccess(const char *path,s32 amode);
7374

7475
s32 sysFsOpendir(const char *path, s32 *fd);
7576
s32 sysFsClosedir(s32 fd);

ppu/include/sys/file.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ LV2_SYSCALL sysLv2FsLink(const char *oldpath,const char *newpath)
132132
return_to_user_prog(s32);
133133
}
134134

135+
LV2_SYSCALL sysLv2FsAccess(const char *path,s32 amode)
136+
{
137+
lv2syscall2(816,(u64)path,amode);
138+
return_to_user_prog(s32);
139+
}
140+
135141
#ifdef __cplusplus
136142
}
137143
#endif

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 unlink.o
48+
chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o access.o
4949

5050
all: ppu
5151

ppu/librt/access.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_access_r,(r,path,amode),
14+
struct _reent *r _AND
15+
const char *path _AND
16+
int amode)
17+
{
18+
return lv2errno_r(r,sysLv2FsAccess(path,amode));
19+
}

ppu/sprx/libsysfs/exports.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ EXPORT(sysFsUnlink, 0x7F4677A8);
1515
EXPORT(sysFsOpendir, 0x3F61245C);
1616
EXPORT(sysFsClosedir, 0xFF42DCC3);
1717
EXPORT(sysFsReaddir, 0x5C74903D);
18+
EXPORT(sysFsAccess, 0x06E681ED);
1819
EXPORT(sysFsAioInit, 0xDB869F20);
1920
EXPORT(sysFsAioReadEx, 0xC1C507E7);
2021
EXPORT(sysFsAioWriteEx, 0x4CEF342E);

0 commit comments

Comments
 (0)