From 87de70a2984cece87db94f4b445589c4e24e5c77 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Wed, 15 Mar 2017 14:31:00 -0400 Subject: posix/mman: add mmap support for shm objects Update #2859. --- cpukit/libcsupport/include/rtems/libio_.h | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'cpukit/libcsupport/include/rtems/libio_.h') diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h index c2fb975bf7..695a4c45a5 100644 --- a/cpukit/libcsupport/include/rtems/libio_.h +++ b/cpukit/libcsupport/include/rtems/libio_.h @@ -304,6 +304,47 @@ void rtems_libio_free( rtems_libio_t *iop ); +/** + * Garbage collects the free libio in case it was previously freed but there + * were still references to it. + */ +void rtems_libio_check_deferred_free( rtems_libio_t *iop ); + +/** + * Increment the reference count tracking number of mmap mappings of a file. + * Returns the updated reference count value. + */ +static inline uint32_t rtems_libio_increment_mapping_refcnt(rtems_libio_t *iop) +{ + uint32_t refcnt; + rtems_libio_lock(); + refcnt = ++iop->mapping_refcnt; + rtems_libio_unlock(); + return refcnt; +} + +/** + * Decrement the reference count tracking number of mmap mappings of a file. + * Returns the updated reference count value. + */ +static inline uint32_t rtems_libio_decrement_mapping_refcnt(rtems_libio_t *iop) +{ + uint32_t refcnt; + rtems_libio_lock(); + refcnt = --iop->mapping_refcnt; + rtems_libio_unlock(); + return refcnt; +} + +static inline bool rtems_libio_is_mapped(rtems_libio_t *iop) +{ + bool is_mapped; + rtems_libio_lock(); + is_mapped = iop->mapping_refcnt != 0; + rtems_libio_unlock(); + return is_mapped; +} + /* * File System Routine Prototypes */ -- cgit v1.2.3