Recently, while porting my old program to 64-bit system I was paying attention on each variable of long type. Pointer to one of them was passed as a parameter to FIONREAD ioctl that I used to check if data are waiting on serial port. I was curious how this is implemented on 64--bit Unixes. What I found was real mess! Namely, see this document: http://www.feyrer.de/PGC/Fighting_the_Lemmings.pdf (page 8 and 9 section Ioctl Calls there's FIONREAD example of troublemaking ioctl call). What I did in my program was to replace it with use of select(), which is more portable. Fortunately, FIONREAD is used only in one place in whole Player tree: /server/drivers/mixed/rflex/rflex-io.cc (that's why it includes sys/filio.h when it is available, FIONREAD is defined there on some Unixes). Now we have few options:
1. Pretend there's no problem
2. Disable it on 64-bit systems (if only cmake is capable to detect 64-bit system!)
3. Rewrite it to use select() instead of FIONREAD ioctl (well, I don't know how clear_incoming_data() function that uses FIONREAD indirectly should be reimplemented then). Since I do not have RWI RFLEX robot myself, I can't do that, I'm not going to publish untested code that talks to the hardware!
Log in to post a comment.