ps3dev / PSL1GHT

A lightweight PS3 SDK
www.psl1ght.com
MIT License
222 stars 62 forks source link

Add access() function #74

Closed bucanero closed 4 years ago

bucanero commented 4 years ago

With information from https://www.psdevwiki.com/ps3/LV2_Functions_and_Syscalls , I added sysLv2FsAccess and access(const char *path, int mode) functions.

bucanero commented 4 years ago

I almost forgot, for this change to work, there's also a required change in the newlib code. 😓

in usr/local/ps3dev/ppu/powerpc64-ps3-elf/include/sys/syscalls.h

struct __syscalls_t {
...
    int (*access_r)(struct _reent *r,const char *name,int mode);
...
}

⚠️ without that change the build won't compile.

Right now the ps3toolchain uses a newlib patch from: https://github.com/ps3dev/ps3toolchain/blob/master/patches/newlib-1.20.0-PS3.patch

I assume this change should be added there, but I'm not sure what's the proper way to include it

(Perhaps this PR should be reverted until the other change is discussed and committed) Apologies, I totally forgot 😞

miigotu commented 4 years ago

@bucanero you can make the PR to the toolchain and add that to the patch you mentioned. I will merge that

EDIT: Did it for you xD

bucanero commented 4 years ago

thanks @miigotu ! 👍 I went to bed last night and I couldn't submit the missing patch

thanks again for your help! 😄

bucanero commented 4 years ago

@miigotu , today doing a full rebuild I realized that some additional code was needed in the newlib patch to add the access() function.

I've submitted a PR here: https://github.com/ps3dev/ps3toolchain/pull/90

miigotu commented 4 years ago

I guess that's why the build was failing. I saw that it wasn't added in my PR but I wasn't sure if it needed added there too. Keep up the good work.

bucanero commented 4 years ago

let me know if your auto-build works after this PR. on my side, I tested rebuilding the whole toolchain locally (on macOS) and I didn't had issues

miigotu commented 4 years ago

Autobuild is failing because ftp.gnu.org has rate limiting and the scrit tries to download the archives 4 times lol. I'll get it figured out.

bucanero commented 4 years ago

that reminds me of a time I couldn't build the ps3 tools and it was because git.savannah.gnu.org was down and the scripts were unable to fetch the config files

miigotu commented 4 years ago

I'm going to see about adding them as submodules or use repo. Git has come a long way with submodules since we wrote the toolchain and tried submodules over 10 years ago ;)