[comp.sys.encore] xmeter on Umax BSD

cwilson@clapton.austek.oz (Chris Wilson) (04/17/91)

	Has anyone managed to get xmeter running on an Encore Multimax
running BSD 4.3. It compiles and runs without errors but displays all
hosts (including itself) as down. This problem appears to be in the
routine getmeter which always get the return status RPC_TIMEDOUT from
the clnt_call routine. I'm a complete rpc novice so I don't know where
to start fixing this problem. Any help would be appreciated. The
getmeter routine is included below.

Regards,
Chris Wilson
Austek Microsystems Pty. Ltd., Technology Park, Adelaide, SA 5095 Australia
ACSnet:	cwilson@austek.oz	Internet:  cwilson@austek.oz.au
UUCP: uunet.uu.net!munnari!austek.oz.au!cwilson


/*
 * getmeter - Executes rstat(3) call to read statistics for specified host.
 *   I do all the rpc junk myself so that I have better control over timeouts
 *   than rstat(3) gives me.  If we're watching multiple stats
 *   on the same host I only do one rstat(3) call (refcnt and curcnt are
 *   used for this).
 */
int getmeter (h)

register METER  *h;

{
  enum clnt_stat        cs;
  register SHMETER      *sh;
  int                   p;

  sh = h->sh;
  if (sh->curcnt >= sh->refcnt)
      sh->curcnt = 0;
  if (!sh->curcnt++) {
      if (sh->clnt == NULL) {
          if ((p = getport (h)) < 0)
              return (-1);
          sh->addr.sin_port = p;
          sh->s = RPC_ANYSOCK;
          if (!(sh->clnt = clntudp_create(&sh->addr, RSTATPROG, RSTATVERS_TIME,
                                          ptto, &sh->s)))
              return (-1);
          sh->first = 1;
          sh->idx = 0;
      } else {
          sh->first = 0;
          sh->idx ^= 1;
      }
      cs = clnt_call (sh->clnt, RSTATPROC_STATS, xdr_void, 0, xdr_statstime,
                      &sh->st[sh->idx], tto);
/* Bad status RPC_TIMEDOUT always returned here */
      if (cs != RPC_SUCCESS) {
          clnt_destroy (sh->clnt);
          close (sh->s);        /* Some clnt_destroy's don't do this    */
          sh->clnt = NULL;
          return (-1);
      }
  }
  return (sh->first ? 0 :
                      sh->clnt == NULL ? -1 : (sd[h->stat].val) (h));
}

gnb@bby.oz.au (Gregory N. Bond) (04/24/91)

>>>>> On 17 Apr 91 07:03:43 GMT, cwilson@clapton.austek.oz (Chris Wilson) said:


Chris> 	Has anyone managed to get xmeter running on an Encore Multimax
Chris> running BSD 4.3. It compiles and runs without errors but displays all
Chris> hosts (including itself) as down. This problem appears to be in the
Chris> routine getmeter which always get the return status RPC_TIMEDOUT from
Chris> the clnt_call routine. I'm a complete rpc novice so I don't know where
Chris> to start fixing this problem. Any help would be appreciated. The
Chris> getmeter routine is included below.

The same thing happens on sparcs, but not on sun3s.  Something to do
with structure passing in the rpc libraries, but I cannot work out
exactly what.

Greg.
--
Gregory Bond, Burdett Buckeridge & Young Ltd, Melbourne, Australia
Internet: gnb@melba.bby.oz.au    non-MX: gnb%melba.bby.oz@uunet.uu.net
Uucp: {uunet,pyramid,ubc-cs,ukc,mcvax,prlb2,nttlab...}!munnari!melba.bby.oz!gnb

gnb@bby.oz.au (Gregory N. Bond) (04/24/91)

>>>>> On 24 Apr 91 12:18:16, gnb@bby.oz.au (Gregory N. Bond) said:
[that's me folks]

Me> The same thing happens on sparcs, but not on sun3s.  Something to do
Me> with structure passing in the rpc libraries, but I cannot work out
Me> exactly what.

It turns out that the problem is with the librpcsvc.a routines on
Solbournes OS 4.0[CD], rather than generic sparc.  The xdr routines
for rstat in that library are compiled with the wrong structure
definition and all rpc calls return RPC_CANTDECODERES.

I worked around it by using rpcgen to generate my own set of xdr
routines, and then compiling and linking those.  I can mail you the
diffs to the Imakefile if that would help, but I don't know if that's
the problem with the Umax version.

Greg.
--
Gregory Bond, Burdett Buckeridge & Young Ltd, Melbourne, Australia
Internet: gnb@melba.bby.oz.au    non-MX: gnb%melba.bby.oz@uunet.uu.net
Uucp: {uunet,pyramid,ubc-cs,ukc,mcvax,prlb2,nttlab...}!munnari!melba.bby.oz!gnb