Date: Thu, 8 Aug 2002 08:50:04 -0700 (PDT) From: Maxim Sobolev <sobomax@FreeBSD.org> To: gnome@FreeBSD.org Subject: Re: ports/41209: www/mozilla browser serializes DNS lookups Message-ID: <200208081550.g78Fo4jR058907@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/41209; it has been noted by GNATS. From: Maxim Sobolev <sobomax@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org, Andriy Gapon <agapon@excite.com> Cc: Subject: Re: ports/41209: www/mozilla browser serializes DNS lookups Date: Thu, 08 Aug 2002 18:43:16 +0300 This is a multi-part message in MIME format. --------------AC92BCB950830E8C721B2BF3 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Andriy Gapon wrote: > > Maxim, > > thank you for your time. > > On Thu, 8 Aug 2002, Maxim Sobolev wrote: > > > ones present in other unices out there (Solaris, HP-UX, BSDI), or to > > modify gethostbyXXX(3) functions to return pointers to a per thread > > storage. > > I assumed this appoach was used in libc_r, my bad, should have checked > before making a suggestion. > > > Another approach is to modify Mozilla to use getaddrinfo(3) function, > > which is available on BSDs and is thread-safe by design, instead of > > gethostbyname(3). > > I'll look into that. Attached please find my attempt to emulate gethostbyname_r(3) using getaddrinfo(3). I'm currently thinking about putting it into FreeBSD libc, but haven't finally decided yet and it will take some time anyway, so that feel free to add it as a patch for Mozilla. Sincerely, Maxim --------------AC92BCB950830E8C721B2BF3 Content-Type: application/x-unknown-content-type-UltraEdit.c; name="gethostbyname_r.c" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="gethostbyname_r.c" LyoKICogQ29weXJpZ2h0IChjKSAyMDAyIE1heGltIFNvYm9sZXYgPHNvYm9tYXhARnJlZUJT RC5vcmc+CiAqIEFsbCByaWdodHMgcmVzZXJ2ZWQuCiAqCiAqIFJlZGlzdHJpYnV0aW9uIGFu ZCB1c2UgaW4gc291cmNlIGFuZCBiaW5hcnkgZm9ybXMsIHdpdGggb3Igd2l0aG91dAogKiBt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FpcC0+YWlfbmV4dCkgewoJCSh2b2lkICopYWRkciA9IGFpcC0+YWlf YWRkcjsKCQlDSEVDS01FTShjcCwgcmVzdWx0LT5oX2xlbmd0aCk7CgkJKih1aW50MzJfdCAq KWNwID0gYWRkci0+c2luX2FkZHIuc19hZGRyOwoJCWNwICs9IHJlc3VsdC0+aF9sZW5ndGg7 CgkJbmFkZHJzKys7Cgl9CglDSEVDS01FTShjcCwgc2l6ZW9mKGNoYXIgKikgKiAobmFkZHJz ICsgMSkpOwoJcmVzdWx0LT5oX2FkZHJfbGlzdCA9IChjaGFyICoqKWNwOwoJY3AgLT0gbmFk ZHJzICogcmVzdWx0LT5oX2xlbmd0aDsKCWZvciAoaSA9IDA7IGkgPCBuYWRkcnM7IGkrKykK CQlyZXN1bHQtPmhfYWRkcl9saXN0W2ldID0gY3AgKyAoaSAqIHJlc3VsdC0+aF9sZW5ndGgp OwoJcmVzdWx0LT5oX2FkZHJfbGlzdFtuYWRkcnNdID0gTlVMTDsKCglmcmVlYWRkcmluZm8o cmVzKTsKCSpoZXJyID0gTkVUREJfU1VDQ0VTUzsKCXJldHVybiAoTkVUREJfU1VDQ0VTUyk7 Cgpub21lbToKCWZyZWVhZGRyaW5mbyhyZXMpOwoJKmhlcnIgPSBORVREQl9JTlRFUk5BTDsK CXJldHVybiAoRVJBTkdFKTsKfQovKgppbnQgbWFpbigpCnsKCXN0cnVjdCBob3N0ZW50IGVu dCwgKmVudDE7CgljaGFyIGJ1ZlsyMDQ4XTsKCWludCBoZXJyOwoKCWVudDEgPSBnZXRob3N0 YnluYW1lKCJ3d3cueWFob28uY29tIik7CglnZXRob3N0YnluYW1lX3IoInd3dy55YWhvby5j b20iLCAmZW50LCBidWYsIHNpemVvZihidWYpLCAmaGVycik7Cn0qLwo= --------------AC92BCB950830E8C721B2BF3-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-gnome" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208081550.g78Fo4jR058907>