[rtems commit] termios: Add kqueue() and poll() support

Sebastian Huber sebh at rtems.org
Thu Feb 23 07:55:05 UTC 2017


Module:    rtems
Branch:    master
Commit:    5bfeddc0c27b7cd896efd8c0b6ef2b5682ec4640
Changeset: http://git.rtems.org/rtems/commit/?id=5bfeddc0c27b7cd896efd8c0b6ef2b5682ec4640

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Feb 21 09:01:49 2017 +0100

termios: Add kqueue() and poll() support

Real implementation is provided by libbsd.

---

 cpukit/libcsupport/include/rtems/termiostypes.h | 20 ++++++++++++++++++++
 cpukit/libcsupport/src/termios.c                |  4 ++--
 cpukit/libfs/src/defaults/default_kqfilter.c    | 12 +++++++-----
 cpukit/libfs/src/defaults/default_poll.c        |  9 +++++++--
 4 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/cpukit/libcsupport/include/rtems/termiostypes.h b/cpukit/libcsupport/include/rtems/termiostypes.h
index 3cf6beb..2dcaa16 100644
--- a/cpukit/libcsupport/include/rtems/termiostypes.h
+++ b/cpukit/libcsupport/include/rtems/termiostypes.h
@@ -555,6 +555,26 @@ int rtems_termios_set_initial_baud(
   rtems_termios_baud_t baud
 );
 
+/**
+ * @brief Termios kqueue() filter filesystem node handler
+ *
+ * Real implementation is provided by libbsd.
+ */
+int rtems_termios_kqfilter(
+  rtems_libio_t *iop,
+  struct knote  *kn
+);
+
+/**
+ * @brief Termios poll() filesystem node handler.
+ *
+ * Real implementation is provided by libbsd.
+ */
+int rtems_termios_poll(
+  rtems_libio_t *iop,
+  int            events
+);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index c44abbe..5067f6c 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -2063,8 +2063,8 @@ static const rtems_filesystem_file_handlers_r rtems_termios_imfs_handler = {
   .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
   .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync,
   .fcntl_h = rtems_filesystem_default_fcntl,
-  .kqfilter_h = rtems_filesystem_default_kqfilter,
-  .poll_h = rtems_filesystem_default_poll,
+  .kqfilter_h = rtems_termios_kqfilter,
+  .poll_h = rtems_termios_poll,
   .readv_h = rtems_filesystem_default_readv,
   .writev_h = rtems_filesystem_default_writev
 };
diff --git a/cpukit/libfs/src/defaults/default_kqfilter.c b/cpukit/libfs/src/defaults/default_kqfilter.c
index ef6fc1f..df21a89 100644
--- a/cpukit/libfs/src/defaults/default_kqfilter.c
+++ b/cpukit/libfs/src/defaults/default_kqfilter.c
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2013, 2017 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -26,13 +26,15 @@
 
 #include <rtems/libio_.h>
 
-#include <sys/types.h>
-#include <sys/event.h>
-
 int rtems_filesystem_default_kqfilter(
   rtems_libio_t *iop,
-  struct knote *kn
+  struct knote  *kn
 )
 {
   return EINVAL;
 }
+
+int rtems_termios_kqfilter(
+  rtems_libio_t *iop,
+  struct knote  *kn
+) RTEMS_WEAK_ALIAS( rtems_filesystem_default_kqfilter );
diff --git a/cpukit/libfs/src/defaults/default_poll.c b/cpukit/libfs/src/defaults/default_poll.c
index aa895d6..a7c9378 100644
--- a/cpukit/libfs/src/defaults/default_poll.c
+++ b/cpukit/libfs/src/defaults/default_poll.c
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2013, 2017 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -30,8 +30,13 @@
 
 int rtems_filesystem_default_poll(
   rtems_libio_t *iop,
-  int events
+  int            events
 )
 {
   return POLLERR;
 }
+
+int rtems_termios_poll(
+  rtems_libio_t *iop,
+  int            events
+) RTEMS_WEAK_ALIAS( rtems_filesystem_default_poll );




More information about the vc mailing list