[uClibc]rpc/rcmd && _LIBC_REENTRANT

Stefan Soucek ssoucek at coactive.com
Fri Feb 22 18:24:21 UTC 2002


I have put this code in for the time when we'd have multi-thread support. The problem with the rcmd functions is that they are not thread-safe the way they are implemented when _LIBC_REENTRANT is undefined. Unfortunately, the thread-safe versions rely on the thread-safe extensions for gethostbyname(), etc, as well as special functions to set h_errno. The fact that pthreads has been integrated does not mean that these are available. We have to go through the library and make sure all functions are actually thread-safe. This may take a little longer.

The "alloca" error message can be thrown out on MMU systems. On non-MMU systems alloca() is dangerous since it can easily blow the stack frame and then all hell may break loose. Those calls have to be replaced by malloc()/free() combinations. I just didn't have the time to put them in. But it should be easy.

If you don't plan on using rcmd with threads you can #undef _LIBC_REENTRANT in rcmd.c as a quick hack to proceed in compilation. The #error was intended to not forget about making this function thread-safe.

-Stefan

> -----Original Message-----
> From: Axel Barnitzke [mailto:barney at xkontor.com]
> Sent: Friday, February 22, 2002 9:25 AM
> To: andersen at codepoet.org
> Cc: uclibc at uclibc.org
> Subject: [uClibc]rpc/rcmd && _LIBC_REENTRANT
> 
> 
> Hi Eric,
> does the libpthreads obsolete the
> #ifdef _LIBC_REENTRANT and the __funcname_r()
> handling in libc/inet/rpc/rcmd.c ?
> 
> this function won't compile when I enable
> INCLUDE_RPC in the Config file :-(
> 
> make -C  rpc
> make[3]: Entering directory 
> `/home/barney/qt-embedded/uClibc/libc/inet/rpc'
> gcc -Wall -Os  -march=i586 -mpreferred-stack-boundary=2 
> -malign-functions=0 -malign-jumps=0 -malign-loops=0 -fno-builtin 
> -nostdinc -pipe -nostdinc -I../../../include 
> -I/usr/lib/gcc-lib/i486-suse-linux/2.95.3/include -I. -D_LIBC 
>  -DNDEBUG 
>   -fPIC -D_LIBC_REENTRANT -I../../../include/linux -c rcmd.c -o rcmd.o
> rcmd.c:97: #error "Fix the alloca stuff"
> rcmd.c:295: #error "Fix the alloca stuff!"
> rcmd.c:405: #error "Fix the alloca stuff"
> rcmd.c: In function `rcmd':
> rcmd.c:101: warning: implicit declaration of function 
> `__gethostbyname_r'
> rcmd.c:106: warning: implicit declaration of function `__set_h_errno'
> rcmd.c: In function `iruserok2':
> rcmd.c:410: warning: implicit declaration of function `__getpwnam_r'
> 
> 
> 
>     -- Barney
> 
> --------------------------------------
> ++ axel (barney) barnitzke
> ++ it consultant
> ++ xkontor IT solutions
> 
> 
> email :: mailto:barney at xkontor.com
> 
> 
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://uclibc.org/mailman/listinfo/uclibc
> 



More information about the uClibc mailing list