[Mesa-dev] [PATCH 1/3] trace: allow GALLIUM_TRACE=stdout/stderr

Michel Dänzer michel at daenzer.net
Thu Jan 31 07:59:19 PST 2013


On Don, 2013-01-31 at 08:41 -0700, Brian Paul wrote: 
> ---
>  src/gallium/drivers/trace/tr_dump.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
> index 90befb0..0714e9a 100644
> --- a/src/gallium/drivers/trace/tr_dump.c
> +++ b/src/gallium/drivers/trace/tr_dump.c
> @@ -244,9 +244,17 @@ boolean trace_dump_trace_begin()
>  
>     if(!stream) {
>  
> -      stream = fopen(filename, "wt");
> -      if(!stream)
> -         return FALSE;
> +      if (strcmp(filename, "stderr") == 0) {
> +         stream = stderr;
> +      }
> +      else if (strcmp(filename, "stdout") == 0) {
> +         stream = stdout;
> +      }
> +      else {
> +         stream = fopen(filename, "wt");
> +         if (!stream)
> +            return FALSE;
> +      }

What if one wants to trace to a file called 'stdout' or 'stderr'? :)
Slightly more seriously, I have /dev/std{out,err} files for the purpose
of this patch, but I suppose those probably aren't available everywhere
this code can run...


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the mesa-dev mailing list