diff options
author | Brian Dessent <brian@dessent.net> | 2007-09-07 00:44:27 +0000 |
---|---|---|
committer | Brian Dessent <brian@dessent.net> | 2007-09-07 00:44:27 +0000 |
commit | 6e08b2f7f86c27d8f35abc2caa2e63fb20b0c714 (patch) | |
tree | 34b39976d706be90660f62b95cc7a7e2019f7852 | |
parent | e65aa07ac6fda806e128e0f72bd4315ecaa9c9fc (diff) | |
download | cygnal-6e08b2f7f86c27d8f35abc2caa2e63fb20b0c714.tar.gz cygnal-6e08b2f7f86c27d8f35abc2caa2e63fb20b0c714.tar.bz2 cygnal-6e08b2f7f86c27d8f35abc2caa2e63fb20b0c714.zip |
* include/cygwin/config.h (__getreent): Define inline version.
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/config.h | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c91abf2a0..d100a1574 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,9 @@ 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 that has the __SSTR flag set. (_ftrylockfile): Likewise. diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h index e3e09f051..0c2f157f8 100644 --- a/winsup/cygwin/include/cygwin/config.h +++ b/winsup/cygwin/include/cygwin/config.h @@ -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 |