This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
patch lket-b2a: fix for new transport
- From: Sébastien Dugué <sebastien dot dugue at bull dot net>
- To: systemtap <systemtap at sources dot redhat dot com>
- Date: Wed, 4 Apr 2007 15:51:50 +0200
- Subject: patch lket-b2a: fix for new transport
Hi,
The bulk transport now adds an additional percpu header to the
chunks of data. Fix lket_b2a to cope with this.
Author: Sébastien Dugué <sebastien.dugue@bull.net>
---
runtime/ChangeLog | 5 +++++
runtime/lket/b2a/lket_b2a.c | 17 +++++++++++++++++
runtime/lket/b2a/lket_b2a.h | 5 +++++
3 files changed, 27 insertions(+)
Index: src/runtime/lket/b2a/lket_b2a.c
===================================================================
--- src.orig/runtime/lket/b2a/lket_b2a.c 2007-04-04 11:36:22.000000000 +0200
+++ src/runtime/lket/b2a/lket_b2a.c 2007-04-04 13:36:05.000000000 +0200
@@ -464,6 +464,7 @@ void find_init_header(FILE **infps, cons
{
int i, j, k;
int32_t magic;
+ percpu_header pcpu;
/* information from lket_init_header */
int16_t inithdr_len;
@@ -479,6 +480,10 @@ void find_init_header(FILE **infps, cons
b2a_error("total_infiles <= 0\n");
j = total_infiles;
for(i=0; i<total_infiles; i++) {
+ /* skip percpu header */
+ if (fread(&pcpu, 1, sizeof(pcpu), infps[i]) < sizeof(pcpu))
+ continue;
+
if(fread(&magic, 1, sizeof(magic), infps[i]) < sizeof(magic))
continue;
if(magic == (int32_t)LKET_MAGIC) {
@@ -576,8 +581,20 @@ void find_init_header(FILE **infps, cons
*/
int get_pkt_header(FILE *fp, lket_pkt_header *phdr)
{
+ percpu_header pcpu;
size_t size;
if(feof(fp)) return 0;
+
+ if ((size = fread(&pcpu, 1, sizeof(pcpu), fp)) < sizeof(pcpu)) {
+ if (feof(fp)) {
+ bzero(phdr, sizeof(lket_pkt_header));
+ return 0;
+ } else
+ b2a_error("fread read %u bytes than expected %u, feof:%d\n",
+ (unsigned) size, (unsigned) sizeof(pcpu),
+ feof(fp));
+ }
+
if((size = fread(phdr, 1, sizeof(lket_pkt_header), fp)) < sizeof(lket_pkt_header)) {
if(feof(fp)) {
bzero(phdr, sizeof(lket_pkt_header));
Index: src/runtime/lket/b2a/lket_b2a.h
===================================================================
--- src.orig/runtime/lket/b2a/lket_b2a.h 2007-04-04 11:36:22.000000000 +0200
+++ src/runtime/lket/b2a/lket_b2a.h 2007-04-04 13:36:05.000000000 +0200
@@ -7,6 +7,11 @@
#include "/usr/include/mysql/mysql.h"
#endif
+typedef struct _percpu_header {
+ int32_t seq;
+ int32_t len;
+} percpu_header;
+
#define LKET_MAGIC 0xAEFCDB6B
#define MAX_STRINGLEN 256
Index: src/runtime/ChangeLog
===================================================================
--- src.orig/runtime/ChangeLog 2007-03-22 21:54:28.000000000 +0100
+++ src/runtime/ChangeLog 2007-04-04 15:51:26.000000000 +0200
@@ -1,3 +1,8 @@
+2007-04-04 Sébastien Dugué <sebastien.dugue@bull.net>
+
+ * runtime/lket/b2a/lket_b2a.c: Fix percpu files parsing
+ for transport changes (namely percpu_header insertion).
+
2007-03-22 Frank Ch. Eigler <fche@elastic.org>
* sym.c (_stp_module_relocate): Tolerate empty section string.