[psptoolchain/newlib] remove readlink(2) declaration

Create a single thread for each patch to be added to the repository. Please try to stay on topic.
Post Reply
Beuc
Posts: 33
Joined: Thu Mar 26, 2009 5:04 am
Location: holland

[psptoolchain/newlib] remove readlink(2) declaration

Post by Beuc »

readlink(2) is not defined in the PSP SDK, but it's defined in /usr/local/pspdev/psp/include/sys/unistd.h.

When using a portability layer such as Gnulib (which detects readlink and see if it should use its own generic version or keep the optimized system-provided version), this causes confusion.
In particular, Gnulib's declaration isn't exactly the same as pspsdk/newlib's (there a missing 'unsigned' in newlib).

So, since readlink isn't available, and since the definition is causing confusion, I suggest it's removed :)

Code: Select all

sed -i -e 's/.*_EXFUN(readlink.*//' /usr/local/pspdev/psp/include/sys/unistd.h
Note: I'm willing to make a proper patch, however I don't know how you generate patches/newlib-1.16.0-PSP.patch. Is this described somewhere?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Note: I'm willing to make a proper patch, however I don't know how you generate patches/newlib-1.16.0-PSP.patch. Is this described somewhere?
It's a mess, for historical reasons :) See

Code: Select all

cd /tmp
svn co -r 2229 svn://svn.ps2dev.org/psp/trunk/psptoolchain@2229
svn co -r 2229 svn://svn.ps2dev.org/psp/trunk/newlib-psp@2229
less psptoolchain/devel/README.TXT
More recently, I think the method has been:
  • unpack newlib sources to -orig
  • copy -orig to -dev
  • apply newlib-1.16.0-PSP.patch to -dev
  • make changes in -dev
  • generate patch between -orig and -dev
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

I modified unistd.h as follows:

Code: Select all

diff -burN orig.newlib-1.16.0/newlib/libc/include/sys/unistd.h newlib-1.16.0/newlib/libc/include/sys/unistd.h
--- orig.newlib-1.16.0/newlib/libc/include/sys/unistd.h 2007-11-08 11:20:12.000000000 -0500
+++ newlib-1.16.0/newlib/libc/include/sys/unistd.h      2009-06-22 17:58:22.000000000 -0400
@@ -225,8 +225,10 @@
 int     _EXFUN(sync, (void));
 #endif
 
+#if !defined(__psp__)
 int     _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
 int     _EXFUN(symlink, (const char *__name1, const char *__name2));
+#endif
 
 #define        F_OK    0
 #define        R_OK    4
Not a particularly clean fix, but it should be OK (since we don't support symlinks anyway).

Code: Select all

Sending        patches/newlib-1.16.0-PSP.patch
Transmitting file data .
Committed revision 2464.
Post Reply