[Info-vax] $GETRMI RMI$_DISKS
Neil Rieck
n.rieck at sympatico.ca
Thu Mar 22 21:46:50 EDT 2012
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/
More information about the Info-vax
mailing list