@@ -1624,7 +1624,18 @@ void nvp_free_dr_mmaps()
16241624 temp_free_pool_of_dr_mmaps = LFDS711_QUEUE_UMM_GET_VALUE_FROM_ELEMENT ( * qe );
16251625 addr = temp_free_pool_of_dr_mmaps -> start_addr ;
16261626 munmap ((void * )addr , DR_SIZE );
1627+
1628+ // Fetch the name of the file before closing it.
1629+ char fd_str [256 ];
1630+ char new_path [256 ];
1631+ sprintf (fd_str , "/proc/self/fd/%d" , temp_free_pool_of_dr_mmaps -> dr_fd );
1632+ if (readlink (fd_str , new_path , sizeof (new_path )) == -1 )
1633+ assert (0 );
1634+
16271635 close (temp_free_pool_of_dr_mmaps -> dr_fd );
1636+
1637+ // Remove the file.
1638+ _nvp_fileops -> UNLINK (new_path );
16281639 __atomic_fetch_sub (& num_drs_left , 1 , __ATOMIC_SEQ_CST );
16291640 }
16301641 lfds711_queue_umm_cleanup ( & qs , NULL );
@@ -1635,7 +1646,18 @@ void nvp_free_dr_mmaps()
16351646 temp_free_pool_of_dr_mmaps = LFDS711_QUEUE_UMM_GET_VALUE_FROM_ELEMENT ( * qe_over );
16361647 addr = temp_free_pool_of_dr_mmaps -> start_addr ;
16371648 munmap ((void * )addr , DR_OVER_SIZE );
1649+
1650+ // Fetch the name of the file before closing it.
1651+ char fd_str [256 ];
1652+ char new_path [256 ];
1653+ sprintf (fd_str , "/proc/self/fd/%d" , temp_free_pool_of_dr_mmaps -> dr_fd );
1654+ if (readlink (fd_str , new_path , sizeof (new_path )) == -1 )
1655+ assert (0 );
1656+
16381657 close (temp_free_pool_of_dr_mmaps -> dr_fd );
1658+
1659+ // Remove the file.
1660+ _nvp_fileops -> UNLINK (new_path );
16391661 __atomic_fetch_sub (& num_drs_left , 1 , __ATOMIC_SEQ_CST );
16401662 }
16411663 lfds711_queue_umm_cleanup ( & qs_over , NULL );
0 commit comments