[rtems commit] posix/mman: update atime on shared memory read call

Gedare Bloom gedare at rtems.org
Fri May 5 15:26:46 UTC 2017


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

Author:    Gedare Bloom <gedare at rtems.org>
Date:      Wed Mar 15 14:29:19 2017 -0400

posix/mman: update atime on shared memory read call

Update #2859.

---

 cpukit/posix/include/rtems/posix/shmimpl.h | 9 +++++++++
 cpukit/posix/src/shmopen.c                 | 1 +
 2 files changed, 10 insertions(+)

diff --git a/cpukit/posix/include/rtems/posix/shmimpl.h b/cpukit/posix/include/rtems/posix/shmimpl.h
index 207f50f..ff3299e 100644
--- a/cpukit/posix/include/rtems/posix/shmimpl.h
+++ b/cpukit/posix/include/rtems/posix/shmimpl.h
@@ -84,6 +84,15 @@ RTEMS_INLINE_ROUTINE POSIX_Shm_Control *_POSIX_Shm_Get_by_name(
   );
 }
 
+RTEMS_INLINE_ROUTINE void _POSIX_Shm_Update_atime(
+  POSIX_Shm_Control *shm
+)
+{
+  struct timeval now;
+  gettimeofday( &now, 0 );
+  shm->atime = now.tv_sec;
+}
+
 RTEMS_INLINE_ROUTINE void _POSIX_Shm_Update_mtime_ctime(
   POSIX_Shm_Control *shm
 )
diff --git a/cpukit/posix/src/shmopen.c b/cpukit/posix/src/shmopen.c
index 3f3789f..4c86535 100644
--- a/cpukit/posix/src/shmopen.c
+++ b/cpukit/posix/src/shmopen.c
@@ -66,6 +66,7 @@ static ssize_t shm_read( rtems_libio_t *iop, void *buffer, size_t count )
       buffer,
       count
   );
+  _POSIX_Shm_Update_atime( shm );
   _POSIX_Shm_Release( shm, &queue_context );
 
   return bytes_read;



More information about the vc mailing list