[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9117.0. "Work-around for gethostid definition conflict needed..." by AMCUCS::SWIERKOWSKI (Quot homines tot sententiae) Tue Mar 11 1997 18:52

Greetings!

  A software partner called yesterday with a problem that sounds identical to
the definition conflict of gethostid in netdb.h and unistd.h described in note
#8189 posted back in December '96.  I tracked down the QAR referenced in that 
note thread as well as spotting note #7745 posted back in November '96.

  Apparently this bug is present in (at least) V4.0, V4.0a & V4.0b (my customer
is still running 4.0).  My own V4.0a system confirms the descrepancy:

# grep gethostid /usr/include/netdb.h
extern int gethostid __((void));
# grep gethostid /usr/include/unistd.h
extern long gethostid __((void));
#

  The man page for gethostid on my V4.0a system says the definition of gethostid
as an "int" is correct, but a response to QAR #50254 in the OSF_QAR database on
GORGE suggests that per the UNIX95 branding specification, the definition of
gethostid as a "long" is correct.  To complicate matters, the same response to
the QAR, indicates that the correct definition for UNIX98 branding is still a 
"work in progress".  Bottom line is I don't know whether the definition in 
netdb.h (and the man page reference) is wrong or the definition in unistd.h is
wrong.

  I understand that a long term fix may be a ways off, but in the meantime how
should I advise the customer to proceed?  Should the customer hack up unistd.h
(kind of an ugly solution IMHO)?  Can he code around the conficting definitions
in the two header files somehow?  Is any kind of a patch kit for V4.0[n] systems
available?  Any pointers/suggestions, etc. would be appreciated, cheers...


						Tony Swierkowski
						Digital Equipment Corporation
						Software Partner Engineering
						Palo Alto, California
						(415) 617-3601
						"[email protected]"
T.RTitleUserPersonal
Name
DateLines
9117.1Forget the standards the thing has to work firstNETRIX::"[email protected]"markTue Mar 11 1997 22:5311
The correct answer can not be long ! Why you ask. Long on Digital
UNIX will get you a nice 64bit quantity (8 bytes) hostid is 
most definitely a 32bit quantity (4 bytes). This looks like
a some standards body work. Got any good jokes about standards 
bodies. :)
          Cheers
                Mark :)



[Posted by WWW Notes gateway]
9117.2Hack up unistd.hNETRIX::"[email protected]"Brian HaleyWed Mar 12 1997 10:2031
Hi,

As the owner of the qar I'm compelled to answer.

In order to pass UNIX95 branding:

	The function long gethostid(void) shall be declared
	with the correct prototype in unistd.h.
(it is).
And:
	A call to long gethostid(void) shall return a 32-bit
	identifier for the current host.
(it does).

So therefore gethostid is returning an *int*.  My advice to you is to
remove the entry in netdb.h (or comment if you wish) and change the
entry in unistd.h to be an int, matching the man page, because that is
what will be returned by the call.  We can't just go and do this without
regressing from the standard - we'll get that addressed in Steel.

I guess I don't see the importance of a patch for this, as either
definition won't bite you - you can stuff the returned int in a long
no problem (if you're using the netdb.h definition).

BTW, if this partner is using the returned value of gethostid for some
kind of license-checking, they really should find a better way.  Anyone
can set their hostid to anything they wish and possibly bypass the check.

-Brian
	
[Posted by WWW Notes gateway]
9117.3'long' isn't necessarily wrongWIBBIN::NOYCEPulling weeds, pickin' stonesWed Mar 12 1997 11:528
> The correct answer can not be long ! Why you ask. Long on Digital
> UNIX will get you a nice 64bit quantity (8 bytes) hostid is 
> most definitely a 32bit quantity (4 bytes). 

If the standard says the return type is long, what's the problem?
A 32-bit hostid fits into a long (easily, with 32 bits to spare).
And because an int is returned sign-extended in a 64-bit register,
there's no problem with getting the wrong value.
9117.4A poem.WTFN::SCALESDespair is appropriate and inevitable.Wed Mar 12 1997 13:1929
.1> Got any good jokes about standards bodies. :)

Why, as a matter of fact, yes:


			I'M ON A COMMITTEE

	Oh, give me your pity -- I'm on a committee,
		Which means that from morning to night,
	We attend and amend and contend and defend
		Without a conclusion in sight.

	We confer and concur, we defer and demur
		And re-iterate all of our thoughts.
	We revise the agenda with frequent addenda
		And consider a load of reports.

	We compose and propose, we suppose and oppose,
		And the points of procedure are fun!
	But though various notions are bought up as motions,
		There's terribly little gets done.

	We resolve and absolve, but never dissolve,
		Since it's out the question for us --
	What a shattering pity to end our committee,
		Where else could we make such a fuss?


				[author lost...]
9117.5Suggestion passed along re: unistd.h...AMCUCS::SWIERKOWSKIQuot homines tot sententiaeWed Mar 12 1997 17:3318
Greetings!

  Thanks for the prompt feedback! (especially in .2).  The customer mostly just 
wanted a "work-around" until the next release, ("Steel" maybe?...).  Anyway I
passed along the gist of your reply and await a response.

  FWIW, .4 is classic!  What a hoot!  I think I'll have it engraved on a plaque 
above my desk.  As someone said somewhere; "Standards are wonderful, you have so
many to choose from...".  As for committees in general, if you're up on your 
Latin, translate my "/PERSONAL_NAME" string in the note header, cheers...


						Tony Swierkowski
						Digital Equipment Corporation
						Software Partner Engineering
						Palo Alto, California
						(415) 617-3601
						"[email protected]"
9117.6More standards humorQUARRY::reevesJon Reeves, UNIX compiler groupThu Mar 13 1997 15:3841
[Note: the accuracy of this account has been questioned.  It still
makes a good story.]

How Specs Live Forever

The US Standard railroad gauge (distance between the rails) is 4
feet, 8.5 inches. That's an exceedingly odd number. Why was that
gauge used? Because that's the way they built them in England,
and the US railroads were built by English expatriates.

Why did the English people build them like that? Because the
first rail lines were built by the same people who built the
pre-railroad tramways, and that's the gauge they used.
Why did "they" use that gauge then? Because the people who built the
tramways used the same jigs and tools that they used for
building wagons, which used that wheel spacing.

Okay! Why did the wagons use that odd wheel spacing? Well, if
they tried to use any other spacing the wagons would break on
some of the old, long distance roads, because that's the spacing of
the old wheel ruts.

So who built these old rutted roads? The first long distance
roads in Europe were built by Imperial Rome for the benefit of
their legions. The roads have been used ever since. And the
ruts? The initial ruts, which everyone else had to match for fear
of destroying their wagons, were first made by Roman war
chariots. Since the chariots were made for or by Imperial Rome
they were all alike in the matter of wheel spacing.

Thus, we have the answer to the original questions. The United
State standard railroad gauge of 4 feet, 8.5 inches derives from the
original specification  for an Imperial Roman
army war chariot. Specs and Bureaucracies live forever.
So, the next time you are handed a specification and wonder what
horse's ass came up with it, you may be exactly right. Because
the Imperial Roman chariots were made to be just wide enough to
accommodate the back-ends of two war horses.

Professor Tom O'Hare   Germanic Lanuages (512) 471-4123
University of Texas at Austin [email protected]
9117.7An Englishman writes...IOSG::MARSHALLTue Jun 03 1997 07:4917
The British railway gauge of 4' 8.5" was set by George Stephenson, inventor of
"Locomotion", the "Rocket", et al.

In trying to work out the most suitable dimensions for his rolling stock, he
took an average of the measurements of a number of other passenger- and
goods-carrying vehicles in the area at the time.

It is unlikely that any of these actually had a track of 4' 8.5"; the link with
tramways and width of ruts on roads is probably rather tenuous.

There were in fact several competing gauges at the time (Brunel, notably,
proposed a wider gauge which in retrospect would have been better), but
Stephenson's became accepted as the de-facto standard following the commercial
success of his early railways.  Any link with roman chariots is sentimentality I
think rather than engineering cause-and-effect.

Scott