On 18/02/2016 11:29, Mark Geisert wrote:
A brief search tells me that apparently glibc supports the
(undocumented) GMON_OUT_PREFIX env var which enables a similar behaviour.
Ah, I did not know about that. It would be easy to implement.
So I'm leaning towards choosing file name as GMON_OUT_PREFIX.exename.pid
with GMON_OUT_PREFIX defaulting to "gmon.out" if unspecified.
I think if you are going to implement GMON_OUT_PREFIX, you should make
the behaviour the same as glibc.
Do you think the expanded name should be used in all cases, or only when
there's a gmon.out already present?
I don't think you should be checking for an existing gmon.out file. In
the simple case where the program doesn't fork, it's expected that
gmon.out will get overwritten.