Results 1 to 2 of 2
I need to pass a user-space pointer for a 64 bit memory chunk to the FORE200E Linux ATM driver so that the driver can write in it. I was thinking ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-12-2012 #1
- Join Date
- Jun 2012
Custom ioctl on Linux FORE200E ATM driver
I open the socket without a problem:
atmSocket = socket(PF_ATMPVC, SOCK_DGRAM, 0);
I can do setsockopt(atmSocket, ...), send(atmSocket, ...) and recv(atmSocket, ...) calls also without a problem.
However, regardless of the cmd I pass to the ioctl() call, it always fails with the "No such device" error message:
ioctl(atmSocket, FIOGETOWN, &someInt);
-> ioctl: No such device
What am I doing wrong?
- 06-14-2012 #2
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
You need to test the return value from the ioctl() call. If it returns a zero, then it succeeded, otherwise it should return a -1 if there is an error. You are also not clearing errno before your ioctl() call, which is a mistake - the output of perror() may be because it hasn't been reset before the ioctl() call.
One final observation, is that your integer someInt is a 32-bit value, not 64-bits, yet you said that you need a 64-bit chunk to pass with the ioctl(). So, declare it as a long long int. That will force it to be 64-bits in size.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!