2000-07-06
2000-07-06 00:30:32 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
-
07eda2eb7df8abefe2895d2a945540a96b00b80b
(32 lines)
(+31/-1)
[
Show
| Annotate
]
Branch: 7.9
fixilifix, allow binaries compiled on glibc2.0 run on glibc2.1
Rev: src/main.c:1.92
5:
\*/
/**/
#include "global.h"
- RCSID("$Id: main.c,v 1.91 2000/06/23 06:17:58 hubbe Exp $");
+ RCSID("$Id: main.c,v 1.92 2000/07/06 00:30:32 hubbe Exp $");
#include "fdlib.h"
#include "backend.h"
#include "module.h"
33:
#include "constants.h"
#include "version.h"
+ #ifdef HAVE_PTHREAD_INITIAL_THREAD_BOS
+ #if defined(HAVE_DLOPEN)
+ #ifdef HAVE_DLFCN_H
+ #include <dlfcn.h>
+ #endif
+ #endif
+ #endif
+
#include "las.h"
#include <errno.h>
425: Inside #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK)
stack_top += STACK_DIRECTION * lim.rlim_cur;
#ifdef HAVE_PTHREAD_INITIAL_THREAD_BOS
+ #if defined(HAVE_DLOPEN) && defined(HAVE_DLFCN_H)
+ /* FIXME: this code should be used on all linux glibc systems
+ * even those without __pthread_initial_thread_bos
+ * -Hubbe
+ */
{
-
+ char ** bos_location;
+ void *handle;
+ if((handle=dlopen(0, RTLD_LAZY)))
+ {
+ bos_location=dlsym(handle,"__pthread_initial_thread_bos");
+ dlclose(handle);
+
+ if(bos_location && *bos_location &&
+ (*bos_location - stack_top) *STACK_DIRECTION < 0)
+ stack_top=*bos_location;
+ }
+ }
+ #else
+
+ {
extern char * __pthread_initial_thread_bos;
/* Linux glibc threads are limited to a 4 Mb stack
* __pthread_initial_thread_bos is the actual limit
436: Inside #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK) and #if defined(HAVE_PTHREAD_INITIAL_THREAD_BOS)
stack_top=__pthread_initial_thread_bos;
}
#endif
+ #endif
stack_top -= STACK_DIRECTION * 8192 * sizeof(char *);
#ifdef STACK_DEBUG