[Info-vax] $GETRMI RMI$_DISKS

Mark Daniel mark.daniel at wasd.vsm.com.au
Fri Mar 23 03:12:21 EDT 2012


On 23/03/12 12:16 PM, Neil Rieck wrote:
> On Mar 19, 3:31 am, Mark Daniel<mark.dan... at wasd.vsm.com.au>  wrote:
>> Anyone with experienced with the GETRMI item.  Looks pretty
>> straightforward but when the code below is run (regardless of how I
>> tweak the buffer size) produces
>>
>> $ mcr [.OBJ_AXP]RALERT.EXE
>> CollectDiskRMI()
>> sys$getrmi() %X00000014  IOsb: %X00000014
>> sys$setpri() %X00000001
>> %SYSTEM-F-BADPARAM, bad parameter value
>> $
>>
>> If I reduce the buffer size to 4 (longword) I get
>>
>> sys$getrmi() %X00000001  IOsb: %X00000001
>>
>> because it initialises the disk count longword but then seems to barf on
>> the first disk data.  VMS V8.3 sources do not indicate this item is
>> disabled, it is in the RMIDEF header, even though it is not a documented
>> item in the System Services Manual.
>>
>> On both
>>
>> HP C V7.3-009 on OpenVMS Alpha V8.3
>> HP C V7.1-011 on OpenVMS IA64 V8.4
>>
>> As always, thanks in advance, Mark Daniel.
>>
>> {
>>      /* initialize structure for RMI items */
>>      static struct {
>>         short  BufferLength;
>>         short  ItemCode;
>>         void  *BufferPtr;
>>         void  *LengthPtr;
>>      } ItemList1[] =
>>      {
>>          { 0, RMI$_DISKS, 0, 0 },
>>          {0,0,0,0}
>>      };
>>
>>      int  status;
>>      unsigned short  DiskDataSize;
>>      char  *DiskDataPtr;
>>
>>      /*********/
>>      /* begin */
>>      /*********/
>>
>>      if (Debug) fprintf (stdout, "CollectDiskRMI()\n");
>>
>>      DiskDataPtr = calloc (1, DiskDataSize = RMI$C_DISK_MINSIZE * 100);
>>
>>      ItemList1[0].BufferPtr = DiskDataPtr;
>>      ItemList1[0].BufferLength = DiskDataSize;
>>
>>      /* collect System Performance Information */
>>      status = sys$getrmi (
>>               SpiEfn,  /* efn */
>>               0,  /* csiaddr */
>>               0,  /* nodename */
>>               &ItemList1,  /* item list */
>>               &IOsb,  /* iosb */
>>               0,      /* astaddr */
>>               0 );    /* astprm */
>>
>>      if (Debug)
>>         fprintf (stdout, "sys$getrmi() %%X%08.08X  IOsb: %%X%08.08X\n",
>>                  status, IOsb.iosb$w_status);
>>
>>      if (VMSok (status)) status = IOsb.iosb$w_status;
>>      if (VMSnok (status)) return (status);
>>
>>      return (SS$_NORMAL);
>> }
>
> The VMS docs are a tiny bit confusing unless you try to imagine it is
> still 1978.
>
> In the items list, we have four parameters.
>
> P1 is the byte-size of the buffer pointed to by P3 (longs=4)
> P2 is the item we want processed
> P3 points to the buffer
> P4 points to a long which will contain the actual number of bytes
> written. Set this to zero if you don't care to know.
>
> Sometimes it is easier to understand this stuff when you see the
> solution done in a student language like BASIC so I spent 20 minutes
> cobbling together this little RMI demo from my JPI demo.
>
> http://www3.sympatico.ca/n.rieck/demo_vms_html/bas_getrmi_demo.html
>
> Now if you want to see it done properly in C (using 64-bits no less),
> check out this demo from Jim Duff's web site:
>
> http://www.eight-cubed.com/examples/framework.php?file=sys_getrmi.c
>
> Neil Rieck
> Kitchener / Waterloo / Cambridge,
> Ontario, Canada.
> http://www3.sympatico.ca/n.rieck/

Hi Neil.

I'm one who for a number of years has frequented your ever-expanding 
site of useful and entertaining VMS items.  In fact for an equal number 
of years it has been pointed to by my own token list

   http://wasd.vsm.com.au/ht_root/other/->lists.html

Many thanks for these ongoing efforts.

In this case, useful as the example might be to BASIC programmers 
without system service experience, the query was not how to program 
$GETRMI, or use item lists, etc., I was specifically asking for anyone 
who has had experience (by implication; positive or negative) with the 
RMI$_DISKS item of that service (the original query was poorly edited - 
and was intended to read "experienced with the $GETRMI RMI$_DISKS item" 
- type in haste, explain at leisure).

When I went with the suggestion from hb to try the same with $GETSPI it 
worked as expected (should have thought of trying that myself).  This 
shows that either, 1) $GETRMI is an incomplete implementation (accepting 
the RMI$_DISKS item but not processing it correctly), or 2) there is 
some $GETRMI-specific quirk to using that item.  No-one has offered a 
definitive comment.  I lean towards the former explanation.  I had used 
the undocumented/unsupported $GETSPI API years and years ago but was 
just trying to drag myself into the late 1990s by using $GETRMI.  My 
code now uses $GETSPI for this particular item.

If your BASIC example can get RMI$_DISKS to work I'd like to know!

Cheers, Mark.



More information about the Info-vax mailing list