From: Myke S. <Myk...@pa...> - 2010-01-22 14:04:18
|
Daniel, Thanks now I understand that this is to cover the re-boot case, so my work-around for the lack of an -lname option in BusyBox has that possible hole. I will document that in my local patch. thanks -myke On Jan 22, 2010, at 3:02 AM, Daniel Hansel wrote: > Hi Myke, > > the option "-lname" checks the symbolic link content for a special > pattern (i.e. the linked file name). > This is necessary to check if the dump file is in use by the process > with the same PID. > > For example, if you use Oprofile to profile a Java application > Oprofile would create a dump file using the PID of the Java app. > process (e.g. pid=1000). > If you reboot your machine without resetting the Oprofile data the > dump files would not be deleted. > After that reboot the PID counter is restarted. > Now you could get a new process with the PID 1000 used by the last > Oprofile run. But this new process is not using the dump file. > In that case the check should delete the dump file due to the fact > that it is not used by the process with the PID 1000. > > The find option "-lname" is used for that. > > Kind regards, > Daniel > > p.s.: Sorry for my late answer. I was very busy during this week. > > Myke Smith wrote: >> >> Daniel, >> >> Any comments on this change? Am I missing something fundamental in >> why >> you need to check for the file by -lname? >> >> To get around -lname in BusyBox I was going to simply do: >> >> # VMs may already be running when profiling is started, so >> # remove only dump files that are not in use >> for I in $dumpdir/*; do >> test -f $I || continue; >> local pid=`basename $I .dump`; >> if ! test -d /proc/$pid; then >> rm -f $I; >> fi >> >> >> thank you, >> >> -myke >> >> On Jan 7, 2010, at 5:12 AM, Maynard Johnson wrote: >> >>> Myke Smith wrote: >>>> Hello, >>>> >>>> I have encountered a problem in prep_jitdump which is due to the >>>> limited implementation of "find" in busybox. >>>> >>>>> # VMs may already be running when profiling is started, so >>>>> # remove only dump files that are not in use >>>>> for I in $dumpdir/*; do >>>>> test -f $I || continue; >>>>> local pid=`basename $I .dump`; >>>>> if test -d /proc/$pid; then >>>>> local files=`find /proc/$pid/fd -lname $I`; >>>>> test -n "$files" && continue; >>>>> fi >>>>> rm -f $I; >>>>> >>>> >>>> In busybox, the option "-lname" is not supported. My question, >>>> after >>>> looking at the code, is why is it necessary to do all of this? >>>> Isn't >>>> it sufficient to see that the pid is still defined in /proc and >>>> if not >>>> remove the file from $dumpdir? >>> Daniel, you are probably the best person to answer this question >>> since >>> you committed this change. >>> >>> -Maynard >>>> >>>> thanks, >>>> >>>> -myke >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> This SF.Net email is sponsored by the Verizon Developer Community >>>> Take advantage of Verizon's best-in-class app development support >>>> A streamlined, 14 day to market process makes app distribution fast >>>> and easy >>>> Join now and get one step closer to millions of Verizon customers >>>> http://p.sf.net/sfu/verizon-dev2dev >>>> _______________________________________________ >>>> oprofile-list mailing list >>>> opr...@li... >>>> https://lists.sourceforge.net/lists/listinfo/oprofile-list >>> >> > |