ioctl missing?

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

Moderators: cheriff, TyRaNiD

Post Reply
TheEye
Posts: 2
Joined: Wed Dec 19, 2007 1:01 am

ioctl missing?

Post by TheEye »

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?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

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.
TheEye
Posts: 2
Joined: Wed Dec 19, 2007 1:01 am

Post by TheEye »

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?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

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.
Post Reply