what kind of machine am I

Dennis L. Malefyt dlm at lhdsy1.chevron.com
Wed May 8 04:47:31 AEST 1991



I am posting this in the hope that I will not have to create and
maintain a host_type database.

Situation: we have DECstations, Sparcs, Appollos, RS6000, Cray XMP,
MasPar, SGI Iris4D's, Macs, VAXstations, HP's ... and on and on.

Problem: we want a unique and simple way for a user/developper to
determine what type of machine he/she is on. What we are interested in
is the binary compatibility, not the model number, amount of RAM, etc...
of a particular machine.

Solution: is two-folded.
	a) we need a database of significant names
	b) we need a mechanism to get the appropriate name.

What already exists: tcsh has an environmental variable called HOSTTYPE.
I am including as few lines of the latest list of tcsh HOSTTYPES, as
well as some text which accompanies it:

start:
19. NEW ENVIRONMENT AND SHELL VARIABLES
	On startup, tcsh now automatically initializes the
	environment variable HOST to the name of the machine that it is
	running on.  It does this by doing a gethostname(2)
	system call, and setting HOST to the result.
		
	Tcsh also initializes the environment variable HOSTTYPE to a
	symbolic name for the type of computer that it is running
	on.  The current possible values are:

	ns32000        an NS32000 CPU machine
	next           a NeXT computer
	aix370         an IBM 370, running aix
	alliant        an Alliant FX series
...
	decstation     a DecStation XXXX
	gould-np1      a Gould NP1
	hp300          an HP 9000, series 300, running mtXinu
	hp800          an HP 9000, series 800, running mtXinu
...
end.

The problem with tcsh is that it does not contain a complete list of all
possible hardware, cray being one example.

Also, we want the solution to be shell independent, not ala tcsh. Tcsh
is used here just for the (incomplete) list of names it provides.

Other solutions we have looked at: we have looked at cpp but it is not
guaranteed to work on its own and one would have to look at more than
one keyword to figure out what is what. We also have looked at what some
platforms offer: DEC offers the command named "machine" but it answers
mips. Oh well, so much for that, since the SGI can also say mips too and
they are not binary compatible... Not to mention Sony, MIPS
themselves...

Now for the big question: Are we the first to look at this problem (I
doubt it ...) and what are the solutions that were found?

We could develop our own database of names but if one already exists and
is maintained by certain group, then this is one less standard that we
have to worry about!

Again, this is a two-question thing: there is a) the topic of "what name
to use to identify a machine"?, and b) "how does the user get the name
for his/her machine"?

We are thinking of using a command named "hosttype" which would return
the appropriate string. Since we need to be portable, is this command
already used in any UNIX?

I welcome any input. Thank you for your attention.
-- 
     +--------------------------------------------------------------+       
     | Dennis Malefyt                     Internet: dlm at chevron.com |       
     | Chevron Information Technology Co.       Tel: (213) 694-7531 |       
     | La Habra, California 90633-0446          Fax: (213) 694-7709 |       



More information about the Comp.unix.admin mailing list