how to know the error string of the error?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
huyi_zg
Posts: 7
Joined: Thu Oct 12, 2006 11:19 pm

how to know the error string of the error?

Post by huyi_zg »

1.is there a way to know the error string?
example:
I have invoked this method: sceIoGetThreadCwd, and get the return value ret(ret < 0), how to know what's the error reason?

2.is errno in libc thread safe?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

1.is there a way to know the error string?
Check /usr/local/pspdev/psp/sdk/include/pspkerror.h
2.is errno in libc thread safe?
I don't think so, newlib generally doesn't know about PSP threads.
huyi_zg
Posts: 7
Joined: Thu Oct 12, 2006 11:19 pm

Post by huyi_zg »

thanks jimparis.

how to make error thread safe? Can I use TLS?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Making it fully thread safe would require a lot of changes in newlib, there are many places that assume global file handles, one working directory, etc. It would probably be easier to just keep all of your libc stuff in one thread. Or add your own locks anywhere you're calling newlib functions to make sure you only do things from one thread at a time.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well the Sony newlib uses the TLS in user threads along with the built in bits of newlib to provide per-thread values, but it is just more work than I can be arsed to spend considering I avoid newlib at all costs ;) Newlib can be made thread safe relatively easily it is just down to providing support to handle the data, one thing you would probably have to do though would be to setup the TLS at the start of every thread which would be slightly annoying, not simple way to make it automatic :/
Post Reply