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 #1Just Joined!
- Join Date
- Jun 2012
- Posts
- 1
Custom ioctl on Linux FORE200E ATM driver
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 of using the ioctl() call to perform this custom "operation" of the recording the user-space pointer in the driver module.
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:
int someInt;
ioctl(atmSocket, FIOGETOWN, &someInt);
perror("ioctl");
-> ioctl: No such device
What am I doing wrong?
- 06-14-2012 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,143
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!


Reply With Quote
