[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: monit&dietlibc
From: |
Jan-Henrik Haukeland |
Subject: |
Re: monit&dietlibc |
Date: |
Wed, 13 Aug 2003 23:01:56 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Civil Service, linux) |
Christian Hopp <address@hidden> writes:
>> Still todo... (might be useful for other "normal" platforms)...
Yes
>> 1) replacement of gethostbyname against gethostbyname_r because...
>> "warning: gethostbyname() leaks memory. Use gethostbyname_r instead!"
It may leak memory if it is used in a multi-threaded environment, but
it does not leak memory per se!
> Let forget about it... it's gonna get really ugly... for Linux! The
> gethostbyname_r interface of Linux differs from all other system and
> it is not posix compatible.
Ehh? is the signature for gethostbyname_r in GLIBC different in
e.g. Linux glibc and Solaris glibc?
BTW, the problem with the _r functions is that there is not really a
standard for them and I'm pretty sure that they are not even mentioned
in POSIX.
> ; /* this glibc "invention" is so ugly, I'm going to throw up any minute
> ; * now */
> ; extern int gethostbyname_r(const char* NAME, struct hostent* RESULT_BUF,
> ; char* BUF, size_t BUFLEN, struct hostent** RESULT,
> ; int* H_ERRNOP) __THROW;
The implementation is not *that* different from Solaris
gethostbyname_r (and the one mentioned by Stevens in UNP):
struct hostent *gethostbyname_r(const char *name,
struct hostent *result, char *buffer, int buflen,
int *h_errnop);
and it looks easy to implement a wrapper that support both
versions. For instance (nb! untested):
struct hostent *gethostbyname_RRRR(const char *name,
struct hostent *result, char *buffer, int buflen,
int *h_errnop) {
#ifdef glibc
struct hostent *r;
gethostbyname(name, result, buffer, buflen, &r, h_errnop);
return r;
#else
/* solaris */
return gethostbyname_r(name, result, buffer, buflen, h_errnop);
#endif
}
--
Jan-Henrik Haukeland
- Re: monit&dietlibc, (continued)
- Re: monit&dietlibc, Christian Hopp, 2003/08/12
- Re: monit&dietlibc, Martin Pala, 2003/08/13
- Re: monit&dietlibc, Christian Hopp, 2003/08/13
- Re: monit&dietlibc, Martin Pala, 2003/08/13
- Re: monit&dietlibc, Jan-Henrik Haukeland, 2003/08/13
- Re: monit&dietlibc, Martin Pala, 2003/08/13
- Re: monit&dietlibc, Jan-Henrik Haukeland, 2003/08/13
- Re: monit&dietlibc, Martin Pala, 2003/08/14
- Re: monit&dietlibc, Jan-Henrik Haukeland, 2003/08/13
Re: monit&dietlibc, Christian Hopp, 2003/08/13
- Re: monit&dietlibc,
Jan-Henrik Haukeland <=