Hello, everybody!

I am trying to port existing program from Linux to Xenomai. This program
works with CAN devices via CAN raw sockets in single thread, and 'select'
syscall is used for read/write multiplexing.
I use Xenomai-3 branch 'stable-3.0.x'. When I try to use 'select' syscall
on RTCAN sockets, it returns -1 and 'errno' is set to 19 - "No such
device". I've found that there is no handler for 'select' event in RTCAN
driver in 'xenomai-3/kernel/drivers/can/rtcan_raw.c' in 'rtcan_driver' at
line 978.
Does some fundamental reason for absence of 'rtcan_driver.select' handler
for RTCAN sockets exist? Or it wasn't implemented just because 'select'
syscall is rarely used?

I have also tried to implement 'rtcan_driver.select' handler by myself. The
patch is attached to this message.
For XNSELECT_READ I use 'rtdm_sem_select' on socket semaphore like it is
used in RTNet TCP driver in
'xenomai-3/kernel/drivers/net/stack/ipv4/tcp/tcp.c' at line 2083. For
XNSELECT_WRITE I also use 'rtdm_sem_select' on device TX semaphore like in
'rtcan_raw_sendmsg' function.
I have tested this implementation and it seems to be working.
Please review it.

Best regards,
Alexey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtcan-select.patch
Type: text/x-diff
Size: 1320 bytes
Desc: not available
URL: 
<http://xenomai.org/pipermail/xenomai/attachments/20160718/c1efafde/attachment.patch>
_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai

Reply via email to