summaryrefslogtreecommitdiffstats
path: root/CAN-binder
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-10 09:51:09 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-10 18:45:55 +0200
commita8a76223c5a028356a3b2ab429b57405f35a51c6 (patch)
treee70f5f2c8ae727a3c9f92be4932b2bd5a4221e35 /CAN-binder
parent613d8daa7ce886365602d87458943975c411236a (diff)
Make non blocking BCM socket.
Needed because we use systemd event loop that recommend that. Change-Id: Ia3faf35fe80a973f7a7b1c81f6a8adf96705394b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder')
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-bcm.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
index b0148d91..7323565c 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 <net/if.h>
#include <sys/ioctl.h>
+#include <fcntl.h>
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_;
}