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
not yet 100% confident in this code.
@menu
* News-3.23.51::
* News-3.23.50:: Changes in release 3.23.50
* News-3.23.49:: Changes in release 3.23.49
* News-3.23.48:: Changes in release 3.23.48
......@@ -46909,20 +46908,19 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0
@end menu
@node News-3.23.51, News-3.23.50, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.51
@node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.50
@itemize @bullet
@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}.
@item
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
@code{InnoDB} now retains foreign key constraints through @code{ALTER TABLE}
and @code{CREATE/DROP INDEX}.
......@@ -349,6 +349,13 @@ extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
#undef HAVE_GETHOSTBYADDR_R /* No definition */
#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)
#define my_pthread_getspecific(T,A) ((T) &(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)
#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
** usage of getbostbyname_r simpler.
Emulate SOLARIS style calls, not because it's better, but just to make the
usage of getbostbyname_r simpler.
*/
#if !defined(my_gethostbyname_r) && defined(HAVE_GETHOSTBYNAME_R)
......
......@@ -1514,7 +1514,7 @@ longlong Item_func_get_lock::val_int()
while (!thd->killed &&
(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)
error=EINTR; // Return NULL
if (ull->locked)
......
......@@ -89,6 +89,16 @@ extern "C" { // Because of SCO 3.2V4.2
#endif /* NEED_SYS_SYSLOG_H */
int allow_severity = LOG_INFO;
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 */
#ifdef HAVE_SYS_MMAN_H
......@@ -2258,7 +2268,6 @@ static void create_new_thread(THD *thd)
if (cached_thread_count > wake_thread)
{
start_cached_thread(thd);
(void) pthread_mutex_unlock(&LOCK_thread_count);
}
else
{
......@@ -2285,9 +2294,9 @@ static void create_new_thread(THD *thd)
(void) pthread_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN;
}
(void) pthread_mutex_unlock(&LOCK_thread_count);
}
(void) pthread_mutex_unlock(&LOCK_thread_count);
}
DBUG_PRINT("info",("Thread created"));
DBUG_VOID_RETURN;
......@@ -2415,29 +2424,27 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
struct request_info req;
signal(SIGCHLD, SIG_DFL);
request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
#ifndef __linux__
fromhost(&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())
my_fromhost(&req);
if (!my_hosts_access(&req))
{
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)
((void (*)(int))req.sink)(req.fd);
// 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...
(void) shutdown(new_sock,2); // This looks fine to me...
(void) shutdown(new_sock,2);
(void) closesocket(new_sock);
continue;
}
......
......@@ -530,7 +530,7 @@ pthread_handler_decl(handle_one_connection,arg)
if ((error=check_connections(thd)))
{ // Wrong permissions
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__
if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE)
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