|
Namazu for hns による簡易全文検索 詳しくは 詳細指定/ヘルプを参照して下さい |
|||||||||||||||||||||||||||||||||||||||||||||||||
2015年10月23日(金) 旧暦 [n年日記] [更新:"2015/10/23 15:28:44"]#1 [pkgsrc] open-vm-tools implicit declaration of 'gethostbyname_r'
gethostbyname_r がないと言われて
/export/WRKOBJDIR/wip-git/open-vm-tools/work/ open-vm-tools-9.4.0-1280544/lib/include/posix.h:215:4: error: implicit declaration of function 'gethostbyname_r'前にも一度見たことがあるなと思ったが、同じところだった。 2014/03/27 @ FreeBSD の場合:
FreeBSD はどうしているのかなと思ったら、
/usr/src/lib/libc/net/gethostnamadr.c の中に定義してあって、しかもこれは内部関数で、
491 int
492 gethostbyname_r(const char *name, struct hostent *he, char *buffer,
493 size_t buflen, struct hostent **result, int *h_errnop)
494 {
495 res_state statp;
496
497 statp = __res_state();
498 if ((statp->options & RES_INIT) == 0 && res_ninit(statp) == -1) {
499 RES_SET_H_ERRNO(statp, NETDB_INTERNAL);
500 return (-1);
501 }
502 if (statp->options & RES_USE_INET6) {
503 if (fakeaddr(name, AF_INET, he, buffer, buflen, statp) == 0) {
504 *result = he;
505 return (0);
506 }
507 if (gethostbyname_internal(name, AF_INET6, he, buffer, buflen,
508 result, h_errnop, statp) == 0)
509 return (0);
510 }
511 return (gethostbyname_internal(name, AF_INET, he, buffer, buflen,
512 result, h_errnop, statp));
513 }
gethostname から呼出していて、gethostname は reentrant 版になっているらしい
669 struct hostent *
670 gethostbyname(const char *name)
671 {
672 struct hostdata *hd;
673 struct hostent *rval;
674 int ret_h_errno;
675
676 if ((hd = __hostdata_init()) == NULL)
677 return (NULL);
678 if (gethostbyname_r(name, &hd->host, hd->data, sizeof(hd->data), &rval,
679 &ret_h_errno) != 0)
680 return (NULL);
681 return (rval);
682 }
と思ったら、NetBSD も同様の気がする。( つっこみ )
|
最近の日記 2025年11月22日 ・crash dump 2025年10月25日 ・recover from disk error 2025年10月23日 ・dd does not duplicate Windows 11 boot disk ? 2025年10月13日 ・missing package 2025年10月04日 ・pkgin search pkgname segfaults | ||