From a8a76223c5a028356a3b2ab429b57405f35a51c6 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 10 May 2017 09:51:09 +0200 Subject: Make non blocking BCM socket. Needed because we use systemd event loop that recommend that. Change-Id: Ia3faf35fe80a973f7a7b1c81f6a8adf96705394b Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/utils/socketcan-bcm.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'CAN-binder/low-can-binding') diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp index b0148d9..7323565 100644 --- a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp +++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp @@ -19,6 +19,7 @@ #include #include +#include namespace utils { @@ -58,6 +59,8 @@ namespace utils ERROR(binder_interface, "%s: Connect failed. %s", __FUNCTION__, strerror(errno)); close(); } + // Needed because of using systemD event loop. See sd_event_add_io manual. + fcntl(socketcan_t::socket_, F_SETFL, O_NONBLOCK); } return socket_; } -- cgit 1.2.3-korg