summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/libio_.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/include/rtems/libio_.h')
-rw-r--r--cpukit/include/rtems/libio_.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/cpukit/include/rtems/libio_.h b/cpukit/include/rtems/libio_.h
index d595500430..995809b6d5 100644
--- a/cpukit/include/rtems/libio_.h
+++ b/cpukit/include/rtems/libio_.h
@@ -103,6 +103,20 @@ extern mode_t rtems_filesystem_umask;
((((unsigned32)(_fd)) < rtems_libio_number_iops) ? \
&rtems_libio_iops[_fd] : 0)
+/*
+ * rtems_libio_check_is_open
+ *
+ * Macro to check if a file descriptor is actually open.
+ */
+
+#define rtems_libio_check_is_open(_iop) \
+ do { \
+ if (((_iop)->flags & LIBIO_FLAGS_OPEN) == 0) { \
+ errno = EBADF; \
+ return -1; \
+ } \
+ } while (0)
+
/*
* rtems_libio_check_fd
*
@@ -118,7 +132,7 @@ extern mode_t rtems_filesystem_umask;
} while (0)
/*
- * rtems_libio_check_fd
+ * rtems_libio_check_buffer
*
* Macro to check if a buffer pointer is valid.
*/