]> sourceware.org Git - newlib-cygwin.git/commitdiff
* include/cygwin/config.h (__getreent): Define inline version.
authorBrian Dessent <brian@dessent.net>
Fri, 7 Sep 2007 00:44:27 +0000 (00:44 +0000)
committerBrian Dessent <brian@dessent.net>
Fri, 7 Sep 2007 00:44:27 +0000 (00:44 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/include/cygwin/config.h

index c91abf2a0f1aa1c091dd2dfa161db06964d536eb..d100a1574637ee47cb38524a3b2f5804037eeffb 100644 (file)
@@ -1,3 +1,7 @@
+2007-09-06  Brian Dessent  <brian@dessent.net>
+
+       * include/cygwin/config.h (__getreent): Define inline version.
+
 2007-09-06  Brian Dessent  <brian@dessent.net>
 
        * include/sys/stdio.h (_flockfile): Don't try to lock a FILE
index e3e09f051ae1cd752c2dde2ab3ab8552b2224a46..0c2f157f8ab3d4dc2d9077206b892ce7fbf3db6f 100644 (file)
@@ -20,6 +20,27 @@ extern "C" {
 #define _CYGWIN_CONFIG_H
 
 #define __DYNAMIC_REENT__
+
+/* The following provides an inline version of __getreent() for newlib,
+   which will be used throughout the library whereever there is a _r
+   version of a function that takes _REENT.  This saves the overhead
+   of a function call for what amounts to a simple computation.
+   
+   The definition below is essentially equivalent to the one in cygtls.h
+   (&_my_tls.local_clib) however it uses a fixed precomputed
+   offset rather than dereferencing a field of a structure.
+   
+   Including tlsoffets.h here in order to get this constant offset
+   tls_local_clib is a bit of a hack, but the alternative would require
+   dragging the entire definition of struct _cygtls (a large and complex
+   Cygwin internal data structure) into newlib.  The machinery to
+   compute these offsets already exists for the sake of gendef so
+   we might as well just use it here.  */
+
+#include "../tlsoffsets.h"
+extern char *_tlsbase __asm__ ("%fs:4");
+#define __getreent() (struct _reent *)(_tlsbase + tls_local_clib)
+
 #define __FILENAME_MAX__ (260 - 1 /* NUL */)
 #define _READ_WRITE_RETURN_TYPE _ssize_t
 #define __LARGE64_FILES 1
This page took 0.034315 seconds and 5 git commands to generate.