| View previous topic :: View next topic |
| Author |
Message |
NeoXeno
Joined: 20 Oct 2005 Posts: 10
|
Posted: Mon Mar 12, 2007 1:49 am Post subject: Can I open more than 9 files using fopen or sceIoOpen? |
|
|
Hi everyone,
This may sound strange to some of you, but I'm writing a game engine where I need to have about 20 to 30 files opened simultaneously for the entire duration of the program. This is for streaming purposes. However, when I try to open more than 9 files using either fopen or sceIoOpen, my PSP freezes. Is there a way I can up the maximum number of files I can open at once? Thanks! |
|
| Back to top |
|
 |
Saotome

Joined: 03 Apr 2004 Posts: 182
|
Posted: Mon Mar 12, 2007 3:09 am Post subject: |
|
|
Maybe a stack issue?
I had a similar problem with networking. Then after a while I noticed the stack of the networking thread was set to just 1kB :P (after setting it to 128kB I didn't have problems anymore).
If you don't use threads (I don't know what the default stack size of the main thread is), you could try to make a thread for loading and set it to some bigger size. _________________ infj |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Mon Mar 12, 2007 4:01 am Post subject: |
|
|
| Code: | /* Define the main thread's stack size (optional) */
/**
* ELF:
* Elf default stack size is (256KB)
*
* PRX:
* PRX default stack size is (256KB)
*
* Example Below: smaller stack for kernel
* thread for 1.0 psp (32KB)
*/
PSP_MAIN_THREAD_STACK_SIZE_KB(32); |
_________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
NeoXeno
Joined: 20 Oct 2005 Posts: 10
|
Posted: Mon Mar 12, 2007 5:03 am Post subject: |
|
|
Thanks guys.
I tried increasing the size of the stack for the kernel thread but it would still crash. To be sure, I even created a separate, simple program that only opens a specified number of files for reading but it would still crash after opening more than 9.
Maybe one of you can create something similar to see if it you get the same results? It could be that I'm doing something wrong. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Mon Mar 12, 2007 6:32 am Post subject: |
|
|
Well I wrote a quick app and it looks like there is a 16 file open limit (which once you take off some existing files) ends up at around 9 or so. When I run out of files it returns SCE_KERNEL_ERROR_MFILE but it shouldn't crash.
So you are screwed :) |
|
| Back to top |
|
 |
NeoXeno
Joined: 20 Oct 2005 Posts: 10
|
Posted: Mon Mar 12, 2007 9:42 am Post subject: |
|
|
Lol! Yeah TyRaNiD, I'm starting to think there is no work around to this and that I am screwed. I did not anticipate this when I started coding so I may have to rethink and redo some of the things I had going (which were working quite well up until now). I'll see if I can try a few things before I call it quits.
By the way, why was a limit even placed? Does having too many files open at once drain system resources or something?
Thanks everyone. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Mon Mar 12, 2007 3:56 pm Post subject: |
|
|
| Yah it will probably be a resources thing, strangely though if I do my test on my hostfs stuff I can open around 56 files. Seems the MS driver is artifically limiting the number of files :( |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Mar 12, 2007 5:12 pm Post subject: |
|
|
Not the first time the SCE engineers artificially crumbled the sce* API :) _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
Chrighton
Joined: 15 Jun 2005 Posts: 58
|
Posted: Thu Apr 12, 2007 12:53 am Post subject: |
|
|
I think this limitation just kicked my ass. I have no problems running the app I ported through PSPLink/hostfs side of things (hooray for tyranid!) but from the memstick side of things, some showstoppers result: errno codes from 24 (too many open?) to 2 (not found? when trying to read, but the file(s) exist and are stat'able at this point - it's not a case issue either).
*9* files max ?! |
|
| Back to top |
|
 |
|