@@ -1021,8 +1021,11 @@ void _nvp_SHM_COPY() {
10211021 int exec_ledger_fd = -1 ;
10221022 int i ,j ;
10231023 unsigned long offset_in_map = 0 ;
1024-
1025- exec_ledger_fd = shm_open ("exec-ledger" , O_RDONLY , 0666 );
1024+ int pid = getpid ();
1025+ char buf [BUF_SIZE ];
1026+
1027+ sprintf (buf , "exec-ledger-%d" , pid );
1028+ exec_ledger_fd = shm_open (buf , O_RDONLY , 0666 );
10261029
10271030 if (exec_ledger_fd == -1 ) {
10281031 printf ("%s: shm_open failed. Err = %s\n" , __func__ , strerror (errno ));
@@ -1096,7 +1099,7 @@ void _nvp_SHM_COPY() {
10961099 }
10971100
10981101 munmap (shm_area , 10 * 1024 * 1024 );
1099- shm_unlink ("exec-ledger" );
1102+ shm_unlink (buf );
11001103}
11011104
11021105void _mm_cache_flush (void const * p ) {
@@ -1244,13 +1247,11 @@ void _nvp_init2(void)
12441247 if (!_nvp_node_lookup [i ])
12451248 assert (0 );
12461249
1247- #if WORKLOAD_TAR | WORKLOAD_GIT | WORKLOAD_RSYNC
12481250 _nvp_backup_roots [i ] = (struct backupRoots * )calloc (OPEN_MAX ,
12491251 sizeof (struct backupRoots ));
12501252 if (!_nvp_backup_roots [i ])
12511253 assert (0 );
12521254
1253- #endif // WORKLOAD_TAR
12541255
12551256 memset ((void * )_nvp_node_lookup [i ], 0 , OPEN_MAX * sizeof (struct NVNode ));
12561257 // Allocating and initializing all the dynamic structs inside struct NVNode
@@ -1276,11 +1277,9 @@ void _nvp_init2(void)
12761277 // Allocating and Initializing DR root of the node
12771278 memset ((void * )& _nvp_node_lookup [i ][j ].dr_info , 0 , sizeof (struct free_dr_pool ));
12781279
1279- #if WORKLOAD_TAR | WORKLOAD_GIT | WORKLOAD_RSYNC
12801280 _nvp_backup_roots [i ][j ].root = _nvp_node_lookup [i ][j ].root ;
12811281 _nvp_backup_roots [i ][j ].merkle_root = _nvp_node_lookup [i ][j ].merkle_root ;
12821282 _nvp_backup_roots [i ][j ].root_dirty_cache = _nvp_node_lookup [i ][j ].root_dirty_cache ;
1283- #endif // WORKLOAD_TAR
12841283
12851284 }
12861285 }
@@ -1555,15 +1554,15 @@ void _nvp_init2(void)
15551554 */
15561555 atexit (nvp_exit_handler );
15571556
1558- #if WORKLOAD_TAR | WORKLOAD_GIT | WORKLOAD_RSYNC
1557+ int pid = getpid ();
1558+ char buf [BUF_SIZE ];
15591559
1560- if (access ("/dev/shm/exec-ledger" , F_OK ) != -1 )
1560+ sprintf (buf , "/dev/shm/exec-ledger-%d" , pid );
1561+ if (access (buf , F_OK ) != -1 )
15611562 execv_done = 1 ;
15621563 else
15631564 execv_done = 0 ;
15641565
1565- #endif // WORKLOAD_TAR
1566-
15671566}
15681567
15691568void nvp_transfer_to_free_dr_pool (struct NVNode * node )
@@ -4744,6 +4743,8 @@ RETT_EXECVE _nvp_EXECVE(INTF_EXECVE) {
47444743
47454744 int exec_ledger_fd = -1 , i = 0 ;
47464745 unsigned long offset_in_map = 0 ;
4746+ int pid = getpid ();
4747+ char buf [BUF_SIZE ];
47474748
47484749 for (i = 0 ; i < 1024 ; i ++ ) {
47494750 if (_nvp_fd_lookup [i ].offset != NULL )
@@ -4752,7 +4753,8 @@ RETT_EXECVE _nvp_EXECVE(INTF_EXECVE) {
47524753 execve_fd_passing [i ] = 0 ;
47534754 }
47544755
4755- exec_ledger_fd = shm_open ("exec-ledger" , O_RDWR | O_CREAT , S_IRUSR | S_IWUSR );
4756+ sprintf (buf , "exec-ledger-%d" , pid );
4757+ exec_ledger_fd = shm_open (buf , O_RDWR | O_CREAT , S_IRUSR | S_IWUSR );
47564758 if (exec_ledger_fd == -1 ) {
47574759 printf ("%s: %s\n" , __func__ , strerror (errno ));
47584760 assert (0 );
@@ -4813,6 +4815,8 @@ RETT_EXECVP _nvp_EXECVP(INTF_EXECVP) {
48134815
48144816 int exec_ledger_fd = -1 , i = 0 ;
48154817 unsigned long offset_in_map = 0 ;
4818+ int pid = getpid ();
4819+ char buf [BUF_SIZE ];
48164820
48174821 for (i = 0 ; i < 1024 ; i ++ ) {
48184822 if (_nvp_fd_lookup [i ].offset != NULL )
@@ -4825,8 +4829,9 @@ RETT_EXECVP _nvp_EXECVP(INTF_EXECVP) {
48254829 if (_nvp_fd_lookup [i ].node != NULL && _nvp_fd_lookup [i ].valid )
48264830 _nvp_FSYNC (_nvp_fd_lookup [i ].fd );
48274831 }
4828-
4829- exec_ledger_fd = shm_open ("exec-ledger" , O_RDWR | O_CREAT , S_IRUSR | S_IWUSR );
4832+
4833+ sprintf (buf , "exec-ledger-%d" , pid );
4834+ exec_ledger_fd = shm_open (buf , O_RDWR | O_CREAT , S_IRUSR | S_IWUSR );
48304835 if (exec_ledger_fd == -1 ) {
48314836 printf ("%s: %s\n" , __func__ , strerror (errno ));
48324837 assert (0 );
@@ -5911,6 +5916,9 @@ RETT_DUP2 _nvp_DUP2(INTF_DUP2)
59115916 nvf2 -> node = nvf -> node ;
59125917 nvf2 -> valid = nvf -> valid ;
59135918 nvf2 -> posix = nvf -> posix ;
5919+ // Increment the refernce count as this file
5920+ // descriptor is pointing to the same NVFNode
5921+ nvf2 -> node -> reference ++ ;
59145922
59155923 SANITYCHECK (nvf2 -> node != NULL );
59165924 SANITYCHECK (nvf2 -> valid );
@@ -6541,3 +6549,4 @@ RETT_FALLOCATE _nvp_FALLOCATE(INTF_FALLOCATE)
65416549 return result;
65426550}
65436551*/
6552+
0 commit comments