From: Joe Mario <mario@zk3.dec.com>
Cc: Stefan Schwarzer <sts@boa.ica1.uni-stuttgart.de>
Subject: Re: gethostbyname
Date: Tue, 19 Dec 2000 17:14:10 -0500 [thread overview]
Message-ID: <3A3FDDB2.9051F11E@zk3.dec.com> (raw)
In-Reply-To: 91e35j$14j$1@infosun2.rus.uni-stuttgart.de
Starting in V5.0, gethostbyname and gethostbyaddr became thread safe
by default. As a result h_errno handling became thread safe as well.
The global h_errno was left behind, but we can not guarantee it's
acuracy.
To get the thread value you need a prototype and to use the
_Get_h_errno() function, like this:
extern int _Get_h_errno();
main () {
gethostbyname(host);
if (_Get_h_errno() > 0)
herror();
}
To set h_error, applications should use _Set_h_errno(error) with the
following prototype:
extern int _Set_h_errno();
Using _Get_h_errno() returns 0 as expected.
Joe
prev parent reply other threads:[~2000-12-19 22:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-15 21:41 gethostbyname Stefan Schwarzer
2000-12-19 22:14 ` Joe Mario [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox