forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ioctl missing?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
TheEye



Joined: 19 Dec 2007
Posts: 2

PostPosted: Wed Dec 19, 2007 1:08 am    Post subject: ioctl missing? Reply with quote

Hello,

I was trying to determine the amount of data available on a socket using the following standard code:

"
ioctl(sock, FIONREAD, &num);
"

The ioctl function does not seem to be implemented as I get the following errors which I do not seem to be able to fix:

"
error: 'FIONREAD' was not declared in this scope
'ioctl' was not declared in this scope
"

I have the following includes:
"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/select.h>
"

Anyone have a solution or pointer to what I`m doing wrong?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Dec 19, 2007 3:29 am    Post subject: Reply with quote

Standard code? FIONREAD isn't even in POSIX. The PSP isn't POSIX, and definitely isn't UNIX. You'll have to figure out the Sony way of doing that. There might be some sceIoIoctl equivalent, but you'll have to resort to reverse engineering to figure it out.

An easier bet would be to just read all the available data and then you'll know exactly how much there was.
Back to top
View user's profile Send private message
TheEye



Joined: 19 Dec 2007
Posts: 2

PostPosted: Thu Dec 20, 2007 12:10 am    Post subject: Reply with quote

The problem is that we would like to know the available data beforehand.

Does anyone have a list of known commands for the sceIoIoctl call?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Thu Dec 20, 2007 8:01 am    Post subject: Reply with quote

Just read all the data and buffer it yourself. Then you can always check to see how much data is in your buffer and still only use as much as you'd like. It shouldn't be hard to rework your code to not need FIONREAD.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group