1
1

Fixed segfault which might occur if the application uses fork's

This commit was SVN r22847.
Этот коммит содержится в:
Matthias Jurenz 2010-03-17 11:51:04 +00:00
родитель 1ed7fe5057
Коммит 9aec91838b
3 изменённых файлов: 23 добавлений и 19 удалений

Просмотреть файл

@ -442,6 +442,8 @@ void gnu_finalize()
max, ((double)max*1000)/n, idx_max,
avg );
vt_assert( n_htab_entries==0 );
gnu_init = 1;
}
/*

Просмотреть файл

@ -1388,11 +1388,14 @@ void VTGen_delete(VTGen* gen)
void VTGen_destroy(VTGen* gen)
{
/* close writer stream */
OTF_WStream_close(gen->filestream);
if(gen->fileprefix)
{
/* close writer stream */
OTF_WStream_close(gen->filestream);
/* close file manager of writer stream */
OTF_FileManager_close(gen->filemanager);
/* close file manager of writer stream */
OTF_FileManager_close(gen->filemanager);
}
/* destroy sum record */
if (VTGEN_IS_SUM_ON(gen)) VTSum_destroy(gen->sum);

Просмотреть файл

@ -757,11 +757,22 @@ void vt_close()
#if (defined(VT_LIBCWRAP) && defined(VT_FORK))
/* if unifying local traces desired,
wait until all child processes are terminated */
if (vt_env_do_unify() && vt_env_libctrace())
if (vt_env_libctrace())
{
/* wait until all child processes are terminated */
vt_fork_waitchilds();
/* get total number of child processes */
vt_num_traces = 1 + vt_fork_get_num_childs_tot();
/* the master process removes the temp. trace-id file */
if (vt_my_trace == 0)
{
char* trcid_filename = vt_fork_get_trcid_filename();
remove(trcid_filename);
free(trcid_filename);
}
vt_fork_finalize();
}
@ -844,18 +855,6 @@ void vt_close()
else
strcpy(fprefix, vt_env_fprefix());
#if (defined(VT_LIBCWRAP) && defined(VT_FORK))
if (vt_env_libctrace())
{
char* trcid_filename = vt_fork_get_trcid_filename();
/* get total number of child processes */
vt_num_traces = 1 + vt_fork_get_num_childs_tot();
/* remove temp. trace-id file */
remove(trcid_filename);
free(trcid_filename);
}
#endif /* VT_LIBCWRAP && VT_FORK */
/*- wait for files to be ready -*/
for (i = 0; i < vt_num_traces; i++)
{