comp.lang.ada
 help / color / mirror / Atom feed
From: emery@mitre-bedford.arpa  (David Emery)
Subject: Re: Pragma's for Ada ????
Date: 15 Sep 93 14:02:35 GMT	[thread overview]
Message-ID: <EMERY.93Sep15090235@goldfinger.mitre.org> (raw)

System.System_Name is NOT the same as host ID.  For instance,
System.System_Name on my Sparc is "sun_4_unix", and the host_id is
55433bc7.  System.System_Name is generally the 'architecture' or
computer name, while Hostid is a per-machine unique identifier (sort
of a serial number.)

On a Sun/Sparc, the following should do the trick:

	function hostid
	    return string
	is
	  type C_int is new integer;
		-- assuming Standard.integer is the same as C's int.
	  function gethostid return C_int;
	  pragma interface (C, gethostid);
	
	  id : C_int;
	begin
	  id := gethostid;
	  return c_int'image(id);
	end hostid;

Here's the man page entry for gethostid from Sun/SPARC:	

	NAME
	     gethostid - get unique identifier of current host
	
	SYNOPSIS
	     gethostid()
	
	DESCRIPTION
	     gethostid() returns the 32-bit identifier  for  the  current
	     host,  which  should  be  unique across all hosts.  On a Sun
	     workstation, this number is taken from the  CPU  board's  ID
	     PROM.
	
	SEE ALSO
	     hostid(1)

             reply	other threads:[~1993-09-15 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-15 14:02 David Emery [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-15  8:31 Pragma's for Ada ???? cis.ohio-state.edu!math.ohio-state.edu!sol.ctr.columbia.edu!xlink.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!ucaa2385
1993-09-14 21:11  STREETER
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox