summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/include/rtems/libio.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-13 09:22:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-15 10:29:34 +0200
commitbaef823cd550449bfbcc36625b9571389d8ad1af (patch)
tree238c1952d23dc09d41ae99d186d0656f78ed857b /cpukit/libcsupport/include/rtems/libio.h
parentlibio: Unify readv() and writev() (diff)
downloadrtems-baef823cd550449bfbcc36625b9571389d8ad1af.tar.bz2
libio: Add hold/drop iop reference
Check iop reference count in close() and return -1 with errno set to EBUSY in case the file descriptor is still in use. Update #3132.
Diffstat (limited to 'cpukit/libcsupport/include/rtems/libio.h')
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index 2a67496800..804929915a 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -37,6 +37,7 @@
#include <rtems.h>
#include <rtems/fs.h>
#include <rtems/chain.h>
+#include <rtems/score/atomic.h>
#ifdef __cplusplus
extern "C" {
@@ -1319,7 +1320,7 @@ extern const rtems_filesystem_limits_and_options_t
struct rtems_libio_tt {
rtems_driver_name_t *driver;
off_t offset; /* current offset into file */
- uint32_t flags;
+ Atomic_Uint flags;
rtems_filesystem_location_info_t pathinfo;
uint32_t data0; /* private to "driver" */
void *data1; /* ... */
@@ -1371,12 +1372,13 @@ typedef struct {
#define LIBIO_FLAGS_APPEND 0x0200U /* all writes append */
#define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U /* close on process exec() */
#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
+#define LIBIO_FLAGS_REFERENCE_INC 0x1000U
/** @} */
-static inline uint32_t rtems_libio_iop_flags( const rtems_libio_t *iop )
+static inline unsigned int rtems_libio_iop_flags( const rtems_libio_t *iop )
{
- return iop->flags;
+ return _Atomic_Load_uint( &iop->flags, ATOMIC_ORDER_RELAXED );
}
/**