Thread: FreeBSD Thread-safe functions ...
After hearing that FreeBSD wasn't thread safe, I posted to the FreeBSD lists to find out what is up ... FreeBSD 5.x has a getpwuid_r function that should be used ... and, the word I got from one of the developers was that getaddrinfo(3) should be used instead of gethostbyname ... Now, getpwuid_r is still not available in 4.x, so we still will fail over there, and I've seen nothing to indicate that it will be MFCd down, but getaddrinfo is available in both ...
"Marc G. Fournier" <scrappy@hub.org> writes: > FreeBSD 5.x has a getpwuid_r function that should be used ... and, the > word I got from one of the developers was that getaddrinfo(3) should be > used instead of gethostbyname ... Hm. A quick grep shows that our *only* use of gethostbyname is in src/port/getaddrinfo.c. Seems like we should omit this "porting requirement" on platforms that have getaddrinfo. regards, tom lane
Tom Lane wrote: > "Marc G. Fournier" <scrappy@hub.org> writes: > > FreeBSD 5.x has a getpwuid_r function that should be used ... and, the > > word I got from one of the developers was that getaddrinfo(3) should be > > used instead of gethostbyname ... > > Hm. A quick grep shows that our *only* use of gethostbyname is in > src/port/getaddrinfo.c. Seems like we should omit this "porting > requirement" on platforms that have getaddrinfo. See the post I just made --- fe-secure.c calls pqGethostbyname(), and that should be converted to getaddrinfo --- once that is done, we can omit the test on platforms with getaddrinfo() as you indicated. Can someone handle this. I am heading to Mexico tomorrow. I an adjust the test script when I return but I would like to see fe-secure.c adjusted. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Tom Lane wrote: >> Hm. A quick grep shows that our *only* use of gethostbyname is in >> src/port/getaddrinfo.c. Seems like we should omit this "porting >> requirement" on platforms that have getaddrinfo. > See the post I just made --- fe-secure.c calls pqGethostbyname(), and > that should be converted to getaddrinfo No, it should be diked out. The call you are referring to is in code that is #ifdef NOT_USED. The whole routine is pretty broken anyway (not IPv6-aware, for starters) and I think we should just rip it out rather than try to bring it up to speed. regards, tom lane
Marc G. Fournier wrote: > > After hearing that FreeBSD wasn't thread safe, I posted to the FreeBSD > lists to find out what is up ... > > FreeBSD 5.x has a getpwuid_r function that should be used ... and, the > word I got from one of the developers was that getaddrinfo(3) should be > used instead of gethostbyname ... > > Now, getpwuid_r is still not available in 4.x, so we still will fail over > there, and I've seen nothing to indicate that it will be MFCd down, but > getaddrinfo is available in both ... OK, I have adjusted the thread test program so it has its own Makefile and is now in src/tools/thread. I also added code so gethostbyname is tested only if getaddrinfo isn't present. Would people please retest their operating sysystems using this program? I think we had a few OS's that failed the test originally because gethostbyname wasn't thread-safe, and that is probably not tested anymore on that OS. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Bruce Momjian wrote: > Marc G. Fournier wrote: > > > > After hearing that FreeBSD wasn't thread safe, I posted to the FreeBSD > > lists to find out what is up ... > > > > FreeBSD 5.x has a getpwuid_r function that should be used ... and, the > > word I got from one of the developers was that getaddrinfo(3) should be > > used instead of gethostbyname ... > > > > Now, getpwuid_r is still not available in 4.x, so we still will fail over > > there, and I've seen nothing to indicate that it will be MFCd down, but > > getaddrinfo is available in both ... > > OK, I have adjusted the thread test program so it has its own Makefile > and is now in src/tools/thread. I also added code so gethostbyname is > tested only if getaddrinfo isn't present. > > Would people please retest their operating sysystems using this program? > I think we had a few OS's that failed the test originally because > gethostbyname wasn't thread-safe, and that is probably not tested > anymore on that OS. Oops, I have a few more adjustments to make. I now realize that to get the thread flags from the port files to the Makefile, you have to run configure and enable threads. I will let you know when it is ready. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073