Messages in this thread | | | Date | Mon, 12 Jul 2010 13:12:39 -0300 | From | Arnaldo Carvalho de Melo <> | Subject | Re: [PATCHv9 2.6.35-rc4-tip 10/13] perf: Re-Add make_absolute_path |
| |
Em Mon, Jul 12, 2010 at 10:30:36AM -0400, Steven Rostedt escreveu: > On Mon, 2010-07-12 at 11:00 -0300, Arnaldo Carvalho de Melo wrote: > > Also please remove the xstrdup and die calls from this function, we're > > trying to get rid of all such 'panic' like functions so that we can > > librarize as much code as possible.
> What I found useful with the "die" calls with trace-cmd is that I made > them weak, and then they could be overwritten by apps. Thus, in > kernelshark, the die and warning functions produce pop-ups and bug > reports.
Well, I prefer to follow the kernel way of doing things, i.e. to propagate as much as possible up the callchain the error return value, so that the apps can handle it in any way they prefer, i.e. die() calls in tools/perf/builtin-foo.c are okayish, but not on tools/perf/util/.
When I'm writing a tools/perf/builtin-.c file I also don't use die() calls, as some routines may end up moving to the library, so its nice to avoid them from the start.
The pr_{warning,err,info,etc} calls do something along the lines of what you do, but not by marking them weak, the routine that is ultimately called checks what kind of UI is being used and calls the appropriate one (TUI/NEWT of stdio).
- Arnaldo
| |