Hi Mike,
I don't think you need to go through all the STRUCT_EXISTS()
and MEMBER_OFFSET() gyrations, do you?
How about this (uncompiled/untested):
Index: s390.c
===================================================================
RCS file: /nfs/projects/cvs/crash/s390.c,v
retrieving revision 1.31
diff -u -r1.31 s390.c
--- s390.c 11 Oct 2006 13:14:35 -0000 1.31
+++ s390.c 24 Apr 2007 20:26:27 -0000
@@ -538,10 +538,11 @@
/* Linux 2.6 */
unsigned long runqueue_addr, runqueue_offset;
unsigned long cpu_offset, per_cpu_offset_addr, running_task;
- char runqueue[4096];
+ char *runqueue;
int cpu;
cpu = s390_cpu_of_task(task);
+ runqueue = GETBUF(SIZE(runqueue));
runqueue_offset=symbol_value("per_cpu__runqueues");
per_cpu_offset_addr=symbol_value("__per_cpu_offset");
@@ -549,10 +550,10 @@
&cpu_offset, sizeof(long),"per_cpu_offset",
FAULT_ON_ERROR);
runqueue_addr=runqueue_offset + cpu_offset;
- readmem(runqueue_addr,KVADDR,&runqueue,sizeof(runqueue),
+ readmem(runqueue_addr,KVADDR,runqueue,SIZE(runqueue),
"runqueue", FAULT_ON_ERROR);
- running_task = *((unsigned long*)&runqueue[MEMBER_OFFSET(
- "runqueue", "curr")]);
+ running_task = ULONG(runqueue + OFFSET(runqueue_curr);
+ FREEBUF(runqueue);
if(running_task == task)
return TRUE;
else
Index: s390x.c
===================================================================
RCS file: /nfs/projects/cvs/crash/s390x.c,v
retrieving revision 1.31
diff -u -r1.31 s390x.c
--- s390x.c 1 Feb 2007 14:55:36 -0000 1.31
+++ s390x.c 24 Apr 2007 20:27:15 -0000
@@ -572,10 +572,11 @@
/* Linux 2.6 */
unsigned long runqueue_addr, runqueue_offset;
unsigned long cpu_offset, per_cpu_offset_addr, running_task;
- char runqueue[4096];
+ char *runqueue;
int cpu;
cpu = s390x_cpu_of_task(task);
+ runqueue = GETBUF(SIZE(runqueue));
runqueue_offset=symbol_value("per_cpu__runqueues");
per_cpu_offset_addr=symbol_value("__per_cpu_offset");
@@ -583,10 +584,10 @@
&cpu_offset, sizeof(long),"per_cpu_offset",
FAULT_ON_ERROR);
runqueue_addr=runqueue_offset + cpu_offset;
- readmem(runqueue_addr,KVADDR,&runqueue,sizeof(runqueue),
+ readmem(runqueue_addr,KVADDR,runqueue,SIZE(runqueue),
"runqueue", FAULT_ON_ERROR);
- running_task = *((unsigned long*)&runqueue[MEMBER_OFFSET(
- "runqueue", "curr")]);
+ running_task = ULONG(runqueue + MEMBER_OFFSET(runqueue_curr));
+ FREEBUF(runqueue);
if(running_task == task)
return TRUE;
else