On 12/11/2012 11:24 AM, alex alex wrote: > Subject : malfunction of FD_ISSET with RTDM > > Package: xenomai > Version: 2.6.1 > Kernel:2.6.38.8 > arch:i686 i386 GNU/Linux > > The attached code shows a malfunction of FD_ISSET with the use of a rtdm > driver. > > Description : > > In this code I compare the functioning of FD_ISSET with a rtdm driver and > with a simple FIFO. > The driver consists of a "ring buffer" which must have the same result as > the fifo. > > In the program, the last time I use select with the rtdm driver (after a > read operation), FD_ISSET returns 1 while there's been a select timeout > (while with the fifo, it well returns 0) . > I'd like to know if FD_CLR, FD_ISSET, FD_SET, FD_ZERO work with a rtdm > driver and if necessary how can we pass > the "readfds" mask from the user space to the rtdm driver. >
FD_ISSET is not at fault, the bit is probably set in the fdset. Xenomai simply does not modify the fdsets in case of timeout, and this is indeed not compliant with the POSIX specification which states: "If the timeout interval expires without the specified condition being true for any of the specified file descriptors, the objects pointed to by the readfds, writefds, and errorfds arguments shall have all bits set to 0." Actually, the core service is correctly implemented, what is simply missing is a copy to user in case of timeout. I wonder if we can not simply replace the test if (err > 0) with if (err >= 0) at the end of the __select function in ksrc/skins/posix/syscall.c Please send a (tested) patch or bug report to the [email protected] mailing list (subscription required, here: http://www.xenomai.org/mailman/listinfo/xenomai ) -- Gilles. -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

