Messages in this thread | | | Date | Fri, 25 Jul 1997 13:57:54 +0200 | From | Anders Östling <> | Subject | Reentrant socket code ? |
| |
Hi
I have an application that is running on Linux 2.0.30, AIX 4.1, Digital UNIX 3.2, Windows NT 4.0 and OpenVMS (5.5 and 6.2 with DCE threads). This app is threaded using pthreads on all platforms except VMS that has DCE threads. The pthread support on AIX and DU is a little bit ancient (draft 4 and 7) but it is working quite good now with interplatform data exchange over multiple threads.
There were a problem with the getXbyY routines on AIX that I solved by using the AIX libc_r.a library. From what I understand, these are included in glibc 2 on Linux. Is this correct ? I have (not yet) had any reentrancy problem on Linux, but since I prefer to do things the "correct way", I would like to use the getXbyY_r instead.
I downloaded glibc-2.0.4 today, but there is no manpages included that describes these calls. From what I can see in the netdb.h file, there is libc support for them, BUT my problem is that the argument lists for ex getservbyname_r is different from the one on AIX.
So my question(s) are; is there a standard for the _r routines ? The arguments for getservbyname_r are
extern int getservbyname_r __P (( __const char *__name, \ Same, no fuzz here __const char *__proto,\ Ok struct servent *__result_buf, \ Ptr to normal servent, ok char *__buf, PTR TO SOMETHING. WHAT ? size_t __buflen, \ Size of this unknown buffer ! struct servent **__result\ Another ptr to a servent ptr ??? );
The AIX declaration is
extern int getservbyname_r( const char *name, Same as above const char *proto, Ok struct servent *servptr, Ok struct servent_data *serv_data This is another AIX structure ! );
#ifdef _THREAD_SAFE struct servent_data { /* should be considered opaque */ FILE *serv_fp; char line[_MAXLINELEN]; char *serv_aliases[_MAXALIASES]; int _serv_stayopen; char *current; int currentlen; void *_serv_reserv1; /* reserved for future use */ void *_serv_reserv2; /* reserved for future use */ }; #endif /* _THREAD_SAFE */
Can I assume that "*__buf" is a pointer to a similliar structure ? Do I have to build the structure myself, or is it enough to pass a pointer ? Do the pointer need to be initialised ? etc etc.
I would be very grateful If someone can help me understand these new calls.
Thanx in advance
Anders
-- +--------------------------------------------------------------+ | Anders Östling IKEA Svenska AB (European IS Dept.) | | E-mail address anders.ostling<at>neurope.ikea.com | | Postal address Box 228 260 35 Odakra, Sweden | | Voice +46-42-25 73 45 | +-------------------------------------- Linux rules -----------+
| |