Re: procps-1.01 patches

David Mosberger-Tang (davidm@azstarnet.com)
Mon, 17 Jun 1996 10:11:15 -0700


>>>>> On Mon, 17 Jun 1996 12:01:35 +0200 (MET DST), koenig@tat.physik.uni-tuebingen.de (Harald Koenig) said:

Harald> just using base==0 for XtGetApplicationResources() is not
Harald> portable when sizeof(int) < sizeof (void*). I've tested the
Harald> patch below on i386 too.

Yes, my patch had that fixed already:

--- procps-1.01/xcpustate/xcpustate.c Tue May 28 11:01:12 1996
+++ procps-1.01axp/xcpustate/xcpustate.c Sun Jun 16 16:06:26 1996
@@ -18,19 +18,23 @@

#define MAXSTR 512
#define DEF_INTERVAL 1
-#define DEF_COUNT -1
+#define DEF_COUNT -1

char *progname;
static int defaultInterval = DEF_INTERVAL;
static int defaultCount = DEF_COUNT;
-static int count, interval;
+static struct {
+ int count, interval;
+} appres;

/* Application Resources - no particular widget */
static XtResource application_resources[] = {
{"interval", "Interval", XtRInt, sizeof(int),
- (Cardinal)&interval, XtRInt, (caddr_t) &defaultInterval},
+ (char *) &appres.interval - (char *) &appres, XtRInt,
+ (caddr_t) &defaultInterval},
{"count", "Count", XtRInt, sizeof(int),
- (Cardinal)&count, XtRInt, (caddr_t) &defaultCount},
+ (char *) &appres.count - (char *) &appres, XtRInt,
+ (caddr_t) &defaultCount},
};

/*

I'm not sure what solution is better, but it is OK to compute the
difference of two pointers at link time. The linker/gcc just refuses
to truncate a pointer to 32 bits at link time.

>> Harald, now I have a bug report for you (or any X-server hacker,
>> I suppose): xcpustate prints the bar-chart all in black when
>> running the latest XF86_S3 server in 16bpp mode. In 8bpp mode,
>> the stippling works just fine. Bug or feature?

Harald> client bug; patch see below. I don't like this b/w display
Harald> so I never run xcpustate other than for a quick compilation
Harald> check (which almost ever happens on 8bpp as my default
Harald> depth).

Ah, yes, this fixes the problem. I don't like the looks of xcpustate
either, but it's nice to have these things working. xsysinfo does
look better, but it also takes more screen real-estate. Anyhow,
thanks for the fix!

--david