From: "Christoph Egger" Subject: [PATCH][TOOLS] xentrace: Don't append trace on existing file Date: Thu, 29 Nov 2007 11:30:14 +0100 Message-ID: <200711291130.14821.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_2SpTHdZ8AtSvf+Z" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --Boundary-00=_2SpTHdZ8AtSvf+Z Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi! When you run "xentrace -e trace.output" the first time, all is fine. When you run it a second time, then the data is appended which makes you reading old data with xentrace_format and you interprete it as new data. This usually happens when you automated tracing guests with xentrace and=20 xentrace_format with a script. Therefore, attached patch makes xentrace to truncate the file to zero bytes before writing any data. Signed-off-by: Christoph Egger =2D-=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=E4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=E4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=E4ftsf=FChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy --Boundary-00=_2SpTHdZ8AtSvf+Z Content-Type: text/plain; charset=us-ascii; name=tools_xentrace.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=tools_xentrace.diff diff -r e10eacec8b91 tools/xentrace/xentrace.c --- a/tools/xentrace/xentrace.c Wed Nov 28 22:36:33 2007 +0000 +++ b/tools/xentrace/xentrace.c Thu Nov 29 13:28:10 2007 +0100 @@ -581,7 +581,9 @@ int main(int argc, char **argv) } if ( opts.outfile ) - outfd = open(opts.outfile, O_WRONLY | O_CREAT | O_LARGEFILE, 0644); + outfd = open(opts.outfile, + O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, + 0644); if(outfd < 0) { --Boundary-00=_2SpTHdZ8AtSvf+Z Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_2SpTHdZ8AtSvf+Z--