reentrant functions

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Sep 9 10:45:39 UTC 2008


On Sun, Jun 08, 2008 at 02:18:03PM +0200, Bernd Schmidt wrote:
> Bernhard Fischer wrote:
>> Just to make sure i understand correctly:
>>
>> - If a reentrant function exists then you want the non-reentrant func to
>>   be optional (via a central knob).
>> - If non-reentrant funcs are off then they are aliased to their
>>   reentrant counterpart.
>
> No, they have different calling conventions, so they'd just not exist.

ok. I have started to implement this via two knobs ¹), will follow-up once
it's finished.
>
>> What about the reverse, i.e. dropping *_r()?
>
> One of the gains from dropping the non-reentrant ones comes from  
> eliminating static arrays.  In current uClibc, these static arrays are  
> eliminated by the use of uc_malloc, which has the drawback that all of  
> these functions can suddenly call exit, contrary to their documentation.  
>  I'd like to get that reverted.
>
>> Think about no threads, i don't really need *_r() at all there, i
>> suppose.
>
> It would be better if the caller provided the buffers, so that they  
> don't have to exist in uClibc.  It's the better interface.

nod.

thanks,
Bernhard
¹)
Index: extra/Configs/Config.in
===================================================================
--- extra/Configs/Config.in	(revision 23338)
+++ extra/Configs/Config.in	(working copy)
@@ -704,13 +704,44 @@ config UCLIBC_PWD_BUFFER_SIZE
 config UCLIBC_GRP_BUFFER_SIZE
 	int "Buffer size for getgrnam() and friends"
 	default 256
-	range 256 1024
+	range 12 1024
 	help
 	  This sets the value of the buffer size for getgrnam() and
friends.
 	  By default, this is 256. (For reference, glibc uses 1024).
 	  The value can be found using sysconf() with the
_SC_GETGR_R_SIZE_MAX
 	  parameter.
 
+# Do not ever complain that you can disable both of them. Stay off that submenu
+# if you think it is too complicated or confusing. Could be a choice none|r|!r|both, of course
+config UCLIBC_HAS_NONREENTRANT
+	bool "Non-reentrant functions"
+	default y
+	help
+	  Per default, both reentrant functions and non-reentrant
+	  functions are exported.
+
+	  If you disable this option, then the non-reentrant variant
+	  will not be exported, but only the reentrant one.
+	  E.e. strerror_r() will be provided, but strerror() not.
+
+	  Functions which do not in general provide both reentrant
+	  and non-reentrant variants are not affected by this option.
+
+# see above
+config UCLIBC_HAS_REENTRANT
+	bool "Reentrant functions"
+	default y
+	help
+	  Per default, both reentrant functions and non-reentrant
+	  functions are exported.
+
+	  If you disable this option, then the reentrant variant
+	  will not be exported, but only the non-reentrant one.
+	  E.e. strerror() will be provided, but strerror_r() not.
+
+	  Functions which do not in general provide both reentrant
+	  and non-reentrant variants are not affected by this option.
+
 comment "Support various families of functions"
 
 config UCLIBC_LINUX_MODULE_24




More information about the uClibc mailing list