[comp.sys.apollo] how does "bldt" get its information

dododge@wam.umd.edu (David O. Dodge) (06/25/91)

I've been wondering about this for quite some time, and some small
experimentation hasn't revealed too much:

Exactly how does the bldt program get the information to display the
kernal build version/date? For example, on my node here at home it
says:

AEGIS2-DOMAIN/IX kernal, revision 9.7 , Wednesday, October 28, 1987   5:13:28 pm.

I know it gets this from some sort of system call because if I run the
9.7 version of bldt on an SR10 node it gives me the proper version/etc.
So the question is: which call does it and what's the invoking parameters?
I'm pretty sure this isn't documented anywhere but has anyone figured it
out?

On the SR10.3 system at work I used "nm" to get a list of routines called
(is there an equivalent under 9.7 *AEGIS*? ), then proceeded to replace the
calls one by one with my own version (by using inlib) that printed out what
came in, and proceeded to see what happened. I could get the program to
crash, and I could make things like the node name disappear, but I never
did figure out where that kernal string comes from.

Any information appreciated...

                                    Dave Dodge/dododge@wam.umd.edu

ced@apollo.hp.com (Carl Davidson) (06/25/91)

From article <1991Jun25.060026.24045@wam.umd.edu>, by dododge@wam.umd.edu (David O. Dodge):
> I've been wondering about this for quite some time, and some small
> experimentation hasn't revealed too much:
> 
> Exactly how does the bldt program get the information to display the
> kernal build version/date? 
> says:
> 

This is yet another service of the "asknode" subsystem. The build 
information is stored in a kernel structure and encoded into a string 
each time the routine is called.

-- 
Carl Davidson  (508) 256-6600 x4361    | "What is the Existential
The Apollo Systems Divison of          |  Vaccuum and does it come
The Hewlett-Packard Company            |  with attachments?"
DOMAIN: ced@apollo.HP.COM              | 

szabo_p@maths.su.oz.au (Paul Szabo) (06/26/91)

In article <1991Jun25.133754.7667@apollo.hp.com> ced@apollo.hp.com (Carl
Davidson) writes:
> From article <1991Jun25.060026.24045@wam.umd.edu>, by dododge@wam.umd.edu (David O. Dodge):
> > Exactly how does the bldt program get the information to display the
> > kernal build version/date? 
> This is yet another service of the "asknode" subsystem. The build 
> information is stored in a kernel structure and encoded into a string 
> each time the routine is called.

You might want to look at the osinfo calls. The online documentation is
misleading, 'man osinfo' or 'help calls osinfo' only mention the
osinfo_$get_rev ('man osinfo_get_rev' or 'help calls osinfo_$get_rev') call.
The include file is better... Below is an example of use (at SR10.2).

Paul Szabo - System Manager   //        School of Mathematics and Statistics
szabo_p@maths.su.oz.au        //   University of Sydney, NSW 2006, Australia

---

#include <apollo/base.h>
#include <apollo/osinfo.h>

main ()
{

char      text_str[100];
short     text_len;
short     myvers;
int       osrev_size;
os_rev_$t osrev;
status_$t status;

int       memory;

short     model_len;
char      model_str[100];
int       model_max;
int       num_cpus;


text_str[0] = 0x00;
text_len    = 0;
myvers      = os_rev_$version;
osrev_size  = sizeof(osrev);

model_max   = sizeof(model_str);

/* ----- */

printf ("\nFrom osinfo_$get_rev:\n\n");

osinfo_$get_rev (text_str,text_len,myvers,osrev_size,&osrev,&status);

printf ("Got status = %x\n",status.all);

printf ("Version    = %d\n",osrev.version);
printf ("  Major    = %d\n",osrev.mmajor);
printf ("  Minor    = %d\n",osrev.mminor);
printf ("  Subminor = %d\n",osrev.subminor);
printf ("  Code     = %d\n",osrev.code);

if (osrev.os_len   < os_rev_$strlen) osrev.os_str  [osrev.os_len]   = 0x00;
if (osrev.pvt_len  < os_rev_$strlen) osrev.pvt_str [osrev.pvt_len]  = 0x00;
if (osrev.date_len < os_rev_$strlen) osrev.date_str[osrev.date_len] = 0x00;

printf ("Name       = %.32s\n",osrev.os_str);
printf ("Extension  = %.32s\n",osrev.pvt_str);
printf ("Date       = %.32s\n",osrev.date_str);

/* ----- */

printf ("\nFrom osinfo_$mem_size:\n\n");

osinfo_$mem_size (text_str,text_len,&memory,&status);

printf ("Got status = %x\n",status.all);

printf ("Memory     = %d\n",memory);

/* ----- */

printf ("\nFrom osinfo_$node_type:\n\n");

osinfo_$node_type (text_str,text_len,&model_len,model_str,model_max,&num_cpus,&status);

printf ("Got status = %x\n",status.all);

if (model_len < model_max) model_str[model_len] = 0x00;

printf ("Model      = %.100s\n",model_str);
printf ("No. CPUs   = %d\n",num_cpus);

}
--
         1         2         3         4         5         6         7         8
12345678901234567890123456789012345678901234567890123456789012345678901234567890

szabo_p@maths.su.oz.au  /  Paul Szabo - System Manager  /  Phone +61 2 692 3806