Commit 667da139 authored by unknown's avatar unknown

Fixed pthread_cond_timedwait() for HPUX and DCE threads

Cleanup of LIBWRAP handling


Docs/manual.texi:
  Changelog
include/my_pthread.h:
  Fixed pthread_cond_timedwait() for HPUX and DCE threads
mysys/my_pthread.c:
  Fixed pthread_cond_timedwait() for HPUX and DCE threads
sql/item_func.cc:
  Fixed the GET_LOCK() works with HPUX and DCE threads
sql/mysqld.cc:
  Cleanup of LIBWRAP handling
sql/sql_parse.cc:
  Safety fix
parent 0eb87707
...@@ -46854,7 +46854,6 @@ users use this code as the rest of the code and because of this we are ...@@ -46854,7 +46854,6 @@ users use this code as the rest of the code and because of this we are
not yet 100% confident in this code. not yet 100% confident in this code.
@menu @menu
* News-3.23.51::
* News-3.23.50:: Changes in release 3.23.50 * News-3.23.50:: Changes in release 3.23.50
* News-3.23.49:: Changes in release 3.23.49 * News-3.23.49:: Changes in release 3.23.49
* News-3.23.48:: Changes in release 3.23.48 * News-3.23.48:: Changes in release 3.23.48
...@@ -46909,20 +46908,19 @@ not yet 100% confident in this code. ...@@ -46909,20 +46908,19 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0 * News-3.23.0:: Changes in release 3.23.0
@end menu @end menu
@node News-3.23.51, News-3.23.50, News-3.23.x, News-3.23.x @node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.51 @appendixsubsec Changes in release 3.23.50
@itemize @bullet @itemize @bullet
@item @item
Fixed timeout for @code{GET_LOCK()} on HPUX with DCE threads.
@item
Fixed memory allocation bug in the glibc library used to build Linux
binaries, which caused mysqld to die in 'free()'.
@item
Fixed @code{SIGINT} and @code{SIGQUIT} problems in @code{mysql}. Fixed @code{SIGINT} and @code{SIGQUIT} problems in @code{mysql}.
@item @item
Fixed bug in character table converts when used with big ( > 64K) strings. Fixed bug in character table converts when used with big ( > 64K) strings.
@end itemize
@node News-3.23.50, News-3.23.49, News-3.23.51, News-3.23.x
@appendixsubsec Changes in release 3.23.50
@itemize @bullet
@item @item
@code{InnoDB} now retains foreign key constraints through @code{ALTER TABLE} @code{InnoDB} now retains foreign key constraints through @code{ALTER TABLE}
and @code{CREATE/DROP INDEX}. and @code{CREATE/DROP INDEX}.
...@@ -349,6 +349,13 @@ extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority); ...@@ -349,6 +349,13 @@ extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
#undef HAVE_GETHOSTBYADDR_R /* No definition */ #undef HAVE_GETHOSTBYADDR_R /* No definition */
#endif #endif
#if defined(HAVE_DEC_THREADS)
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
struct timespec *abstime);
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
#endif
#if defined(OS2) #if defined(OS2)
#define my_pthread_getspecific(T,A) ((T) &(A)) #define my_pthread_getspecific(T,A) ((T) &(A))
#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) #define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
......
...@@ -410,9 +410,23 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr) ...@@ -410,9 +410,23 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
#endif #endif
/* Change functions on HP to work according to POSIX */
#ifdef HAVE_DEC_THREADS
#undef pthread_cond_timedwait
int my_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
struct timespec *abstime)
{
int error=pthread_cond_timedwait(cond,mutex,abstime);
return error == EAGAIN ? ETIMEDOUT : error;
}
#endif /* HAVE_DEC_THREADS */
/* /*
** Emulate SOLARIS style calls, not because it's better, but just to make the Emulate SOLARIS style calls, not because it's better, but just to make the
** usage of getbostbyname_r simpler. usage of getbostbyname_r simpler.
*/ */
#if !defined(my_gethostbyname_r) && defined(HAVE_GETHOSTBYNAME_R) #if !defined(my_gethostbyname_r) && defined(HAVE_GETHOSTBYNAME_R)
......
...@@ -1514,7 +1514,7 @@ longlong Item_func_get_lock::val_int() ...@@ -1514,7 +1514,7 @@ longlong Item_func_get_lock::val_int()
while (!thd->killed && while (!thd->killed &&
(error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime)) (error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime))
!= ETIME && error != ETIMEDOUT && ull->locked) ; != ETIME && error != ETIMEDOUT && error != EINVAL && ull->locked) ;
if (thd->killed) if (thd->killed)
error=EINTR; // Return NULL error=EINTR; // Return NULL
if (ull->locked) if (ull->locked)
......
...@@ -89,6 +89,16 @@ extern "C" { // Because of SCO 3.2V4.2 ...@@ -89,6 +89,16 @@ extern "C" { // Because of SCO 3.2V4.2
#endif /* NEED_SYS_SYSLOG_H */ #endif /* NEED_SYS_SYSLOG_H */
int allow_severity = LOG_INFO; int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING; int deny_severity = LOG_WARNING;
#ifdef __linux__
#define my_fromhost(A) fromhost()
#define my_hosts_access(A) hosts_access()
#define my_eval_client(A) eval_client()
#else
#define my_fromhost(A) fromhost(A)
#define my_hosts_access(A) hosts_access(A)
#define my_eval_client(A) eval_client(A)
#endif
#endif /* HAVE_LIBWRAP */ #endif /* HAVE_LIBWRAP */
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
...@@ -2258,7 +2268,6 @@ static void create_new_thread(THD *thd) ...@@ -2258,7 +2268,6 @@ static void create_new_thread(THD *thd)
if (cached_thread_count > wake_thread) if (cached_thread_count > wake_thread)
{ {
start_cached_thread(thd); start_cached_thread(thd);
(void) pthread_mutex_unlock(&LOCK_thread_count);
} }
else else
{ {
...@@ -2285,9 +2294,9 @@ static void create_new_thread(THD *thd) ...@@ -2285,9 +2294,9 @@ static void create_new_thread(THD *thd)
(void) pthread_mutex_unlock(&LOCK_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
(void) pthread_mutex_unlock(&LOCK_thread_count);
} }
(void) pthread_mutex_unlock(&LOCK_thread_count);
} }
DBUG_PRINT("info",("Thread created")); DBUG_PRINT("info",("Thread created"));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -2415,29 +2424,27 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) ...@@ -2415,29 +2424,27 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
struct request_info req; struct request_info req;
signal(SIGCHLD, SIG_DFL); signal(SIGCHLD, SIG_DFL);
request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL); request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
#ifndef __linux__ my_fromhost(&req);
fromhost(&req); if (!my_hosts_access(&req))
if (!hosts_access(&req))
{
// This may be stupid but refuse() includes an exit(0)
// which we surely don't want...
// clean_exit() - same stupid thing ...
syslog(deny_severity, "refused connect from %s", eval_client(&req));
#else
fromhost();
if (!hosts_access())
{ {
syslog(deny_severity, "refused connect from %s", eval_client()); /*
#endif This may be stupid but refuse() includes an exit(0)
which we surely don't want...
clean_exit() - same stupid thing ...
*/
syslog(deny_severity, "refused connect from %s",
my_eval_client(&req));
/*
C++ sucks (the gibberish in front just translates the supplied
sink function pointer in the req structure from a void (*sink)();
to a void(*sink)(int) if you omit the cast, the C++ compiler
will cry...
*/
if (req.sink) if (req.sink)
((void (*)(int))req.sink)(req.fd); ((void (*)(int))req.sink)(req.fd);
// C++ sucks (the gibberish in front just translates the supplied (void) shutdown(new_sock,2);
// sink function pointer in the req structure from a void (*sink)();
// to a void(*sink)(int) if you omit the cast, the C++ compiler
// will cry...
(void) shutdown(new_sock,2); // This looks fine to me...
(void) closesocket(new_sock); (void) closesocket(new_sock);
continue; continue;
} }
......
...@@ -530,7 +530,7 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -530,7 +530,7 @@ pthread_handler_decl(handle_one_connection,arg)
if ((error=check_connections(thd))) if ((error=check_connections(thd)))
{ // Wrong permissions { // Wrong permissions
if (error > 0) if (error > 0)
net_printf(net,error,thd->host ? thd->host : thd->ip); net_printf(net,error,thd->host ? thd->host : (thd->ip ? thd->ip : ""));
#ifdef __NT__ #ifdef __NT__
if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE) if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE)
sleep(1); /* must wait after eof() */ sleep(1); /* must wait after eof() */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment