Skip to content

Commit

Permalink
get stacksize from mysql variable if not available from thread info o…
Browse files Browse the repository at this point in the history
…n OS

*	modified:   Makefile.am
*	modified:   Makefile.in
*	modified:   preg.c
  • Loading branch information
raw committed Aug 14, 2013
1 parent 9276576 commit 54777e8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Makefile.am
Expand Up @@ -33,7 +33,8 @@ SUBDIRS=test doc
DIFFPROGRAM:=kompare - DIFFPROGRAM:=kompare -


lib_mysqludf_preg_la_CFLAGS = -DSTANDARD -DMYSQL_SERVER @MYSQL_CFLAGS@ @MYSQL_HEADERS@ @PCRE_CFLAGS@ @GHMYSQL_CFLAGS@ @PTHREAD_CFLAGS@ lib_mysqludf_preg_la_CFLAGS = -DSTANDARD -DMYSQL_SERVER @MYSQL_CFLAGS@ @MYSQL_HEADERS@ @PCRE_CFLAGS@ @GHMYSQL_CFLAGS@ @PTHREAD_CFLAGS@
lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version -no-undefined @PCRE_LIBS@ @PTHREAD_LIBS@ #lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version -no-undefined @PCRE_LIBS@ @PTHREAD_LIBS@
lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version @PCRE_LIBS@ @PTHREAD_LIBS@


EXTRA_DIST = *.sql EXTRA_DIST = *.sql


Expand Down
3 changes: 2 additions & 1 deletion Makefile.in
Expand Up @@ -405,7 +405,8 @@ DLL_OBJS = $(CFILES:%.c=.libs/lib_mysqludf_preg_la-%.o)
SUBDIRS = test doc SUBDIRS = test doc
DIFFPROGRAM := kompare - DIFFPROGRAM := kompare -
lib_mysqludf_preg_la_CFLAGS = -DSTANDARD -DMYSQL_SERVER @MYSQL_CFLAGS@ @MYSQL_HEADERS@ @PCRE_CFLAGS@ @GHMYSQL_CFLAGS@ @PTHREAD_CFLAGS@ lib_mysqludf_preg_la_CFLAGS = -DSTANDARD -DMYSQL_SERVER @MYSQL_CFLAGS@ @MYSQL_HEADERS@ @PCRE_CFLAGS@ @GHMYSQL_CFLAGS@ @PTHREAD_CFLAGS@
lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version -no-undefined @PCRE_LIBS@ @PTHREAD_LIBS@ #lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version -no-undefined @PCRE_LIBS@ @PTHREAD_LIBS@
lib_mysqludf_preg_la_LDFLAGS = -module -avoid-version @PCRE_LIBS@ @PTHREAD_LIBS@
EXTRA_DIST = *.sql EXTRA_DIST = *.sql
all: config.h all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive $(MAKE) $(AM_MAKEFLAGS) all-recursive
Expand Down
19 changes: 15 additions & 4 deletions preg.c
Expand Up @@ -587,13 +587,24 @@ void pregSetLimits(pcre_extra *extra)
thread_stack_avail = 0 ; thread_stack_avail = 0 ;
#endif #endif


if (thread_stack_avail == 0) { if (thread_stack_avail == 0)
// Checks failed, assume the MySQL defaults (64/32 bit) {
// Checks failed or OS (ie OSX) doesn't support getting current thread stack size
// Use information from mysqld global variable
//
extern unsigned long my_thread_stack_size;
thread_stack_size = my_thread_stack_size ;

if( !thread_stack_size ) {
// Checks failed, assume the MySQL defaults (64/32 bit)
// Shouldn't ever really get here, though.
ghlogprintf( "Ignoring mysqld:thread_stack. Using mysql defaults.") ;
#ifdef _LP64 #ifdef _LP64
thread_stack_size = 256*1024; thread_stack_size = 256*1024;
#else #else
thread_stack_size = 192*1024; thread_stack_size = 192*1024;
#endif #endif
}
// And assume a current usage of 25% (_wild_ guess!) // And assume a current usage of 25% (_wild_ guess!)
thread_stack_avail = thread_stack_size*0.75; thread_stack_avail = thread_stack_size*0.75;
} }
Expand Down

0 comments on commit 54777e8

Please sign in to comment.