Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
cb0d8aba
Commit
cb0d8aba
authored
Oct 12, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/jimw/my/mysql-4.1-8731b
into mysql.com:/home/jimw/my/mysql-4.1-clean
parents
626c8a1c
c8a6c2c6
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
77 additions
and
99 deletions
+77
-99
configure.in
configure.in
+3
-13
include/config-win.h
include/config-win.h
+1
-1
include/my_pthread.h
include/my_pthread.h
+21
-14
mysql-test/r/wait_timeout.result
mysql-test/r/wait_timeout.result
+8
-0
mysql-test/t/wait_timeout-master.opt
mysql-test/t/wait_timeout-master.opt
+1
-0
mysql-test/t/wait_timeout.test
mysql-test/t/wait_timeout.test
+11
-0
mysys/my_pthread.c
mysys/my_pthread.c
+0
-17
mysys/thr_alarm.c
mysys/thr_alarm.c
+7
-17
sql/mysqld.cc
sql/mysqld.cc
+5
-32
vio/vio.c
vio/vio.c
+12
-4
vio/viosocket.c
vio/viosocket.c
+8
-1
No files found.
configure.in
View file @
cb0d8aba
...
...
@@ -1102,7 +1102,7 @@ case $SYSTEM_TYPE in
*
darwin5
*
)
if
test
"
$ac_cv_prog_gcc
"
=
"yes"
then
FLAGS
=
"-traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
FLAGS
=
"-traditional-cpp -DHAVE_DARWIN
5
_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
CFLAGS
=
"
$CFLAGS
$FLAGS
"
CXXFLAGS
=
"
$CXXFLAGS
$FLAGS
"
MAX_C_OPTIMIZE
=
"-O"
...
...
@@ -1112,23 +1112,13 @@ case $SYSTEM_TYPE in
*
darwin6
*
)
if
test
"
$ac_cv_prog_gcc
"
=
"yes"
then
FLAGS
=
"-D
HAVE_DARWIN_THREADS -D
_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
FLAGS
=
"-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
CFLAGS
=
"
$CFLAGS
$FLAGS
"
CXXFLAGS
=
"
$CXXFLAGS
$FLAGS
"
MAX_C_OPTIMIZE
=
"-O"
fi
;;
*
darwin[[7-8]]
*
)
# don't forget to escape [] like above
if
test
"
$ac_cv_prog_gcc
"
=
"yes"
then
FLAGS
=
"-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT"
CFLAGS
=
"
$CFLAGS
$FLAGS
"
CXXFLAGS
=
"
$CXXFLAGS
$FLAGS
"
MAX_C_OPTIMIZE
=
"-O"
fi
;;
*
darwin9
*
)
*
darwin
*
)
if
test
"
$ac_cv_prog_gcc
"
=
"yes"
then
FLAGS
=
"-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT"
...
...
include/config-win.h
View file @
cb0d8aba
...
...
@@ -192,7 +192,7 @@ typedef uint rf_SetTimer;
/* Convert some simple functions to Posix */
#define sigset(A,B) signal((A),(B))
#define
my_
sigset(A,B) signal((A),(B))
#define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000)
#define popen(A) popen(A,B) _popen((A),(B))
...
...
include/my_pthread.h
View file @
cb0d8aba
...
...
@@ -289,8 +289,6 @@ extern int my_pthread_create_detached;
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
#undef HAVE_SNPRINTF
#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
#define signal(A,B) pthread_signal((A),(void (*)(int)) (B))
#define my_pthread_attr_setprio(A,B)
#endif
/* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
...
...
@@ -322,14 +320,26 @@ extern int my_pthread_cond_init(pthread_cond_t *mp,
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
int
sigwait
(
sigset_t
*
setp
,
int
*
sigp
);
/* Use our implemention */
#endif
#if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset)
#define sigset(A,B) do { struct sigaction s; sigset_t set; \
/*
We define my_sigset() and use that instead of the system sigset() so that
we can favor an implementation based on sigaction(). On some systems, such
as Mac OS X, sigset() results in flags such as SA_RESTART being set, and
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
#define my_sigset(A,B) do { struct sigaction s; sigset_t set; \
sigemptyset(&set); \
s.sa_handler = (B); \
s.sa_mask = set; \
s.sa_flags = 0; \
sigaction((A), &s, (struct sigaction *) NULL); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
#define my_sigset(A,B) sigset((A),(B))
#elif !defined(my_sigset)
#define my_sigset(A,B) signal((A),(B))
#endif
#ifndef my_pthread_setprio
...
...
@@ -409,16 +419,13 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
#endif
#ifdef HAVE_DARWIN_THREADS
#ifdef HAVE_DARWIN
5
_THREADS
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
#define pthread_kill(A,B) pthread_dummy(0)
#define pthread_condattr_init(A) pthread_dummy(0)
#define pthread_condattr_destroy(A) pthread_dummy(0)
#define pthread_signal(A,B) pthread_dummy(0)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
#undef sigset
#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
#endif
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
...
...
mysql-test/r/wait_timeout.result
0 → 100644
View file @
cb0d8aba
select 1;
1
1
select 2;
ERROR HY000: MySQL server has gone away
select 3;
3
3
mysql-test/t/wait_timeout-master.opt
0 → 100644
View file @
cb0d8aba
--wait-timeout=2
mysql-test/t/wait_timeout.test
0 → 100644
View file @
cb0d8aba
#
# Bug #8731: wait_timeout does not work on Mac OS X
#
--
disable_reconnect
select
1
;
# wait_timeout is 2, so we should get disconnected now
--
sleep
5
--
error
2006
select
2
;
--
enable_reconnect
select
3
;
mysys/my_pthread.c
View file @
cb0d8aba
...
...
@@ -404,23 +404,6 @@ int sigwait(sigset_t *setp, int *sigp)
#endif
/* DONT_USE_SIGSUSPEND */
#endif
/* HAVE_SIGWAIT */
/*****************************************************************************
** Implement pthread_signal for systems that can't use signal() with threads
** Currently this is only used with BSDI 3.0
*****************************************************************************/
#ifdef USE_PTHREAD_SIGNAL
int
pthread_signal
(
int
sig
,
void
(
*
func
)())
{
struct
sigaction
sact
;
sact
.
sa_flags
=
0
;
sact
.
sa_handler
=
func
;
sigemptyset
(
&
sact
.
sa_mask
);
sigaction
(
sig
,
&
sact
,
(
struct
sigaction
*
)
0
);
return
0
;
}
#endif
/****************************************************************************
The following functions fixes that all pthread functions should work
...
...
mysys/thr_alarm.c
View file @
cb0d8aba
...
...
@@ -80,17 +80,7 @@ void init_thr_alarm(uint max_alarms)
pthread_mutex_init
(
&
LOCK_alarm
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
COND_alarm
,
NULL
);
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
#if defined(HAVE_mit_thread)
sigset
(
THR_CLIENT_ALARM
,
thread_alarm
);
/* int. thread system calls */
#else
{
struct
sigaction
sact
;
sact
.
sa_flags
=
0
;
bzero
((
char
*
)
&
sact
,
sizeof
(
sact
));
sact
.
sa_handler
=
thread_alarm
;
sigaction
(
THR_CLIENT_ALARM
,
&
sact
,
(
struct
sigaction
*
)
0
);
}
#endif
my_sigset
(
THR_CLIENT_ALARM
,
thread_alarm
);
#endif
sigemptyset
(
&
s
);
sigaddset
(
&
s
,
THR_SERVER_ALARM
);
...
...
@@ -110,12 +100,12 @@ void init_thr_alarm(uint max_alarms)
#elif defined(USE_ONE_SIGNAL_HAND)
pthread_sigmask
(
SIG_BLOCK
,
&
s
,
NULL
);
/* used with sigwait() */
#if THR_SERVER_ALARM == THR_CLIENT_ALARM
sigset
(
THR_CLIENT_ALARM
,
process_alarm
);
/* Linuxthreads */
my_
sigset
(
THR_CLIENT_ALARM
,
process_alarm
);
/* Linuxthreads */
pthread_sigmask
(
SIG_UNBLOCK
,
&
s
,
NULL
);
#endif
#else
my_sigset
(
THR_SERVER_ALARM
,
process_alarm
);
pthread_sigmask
(
SIG_UNBLOCK
,
&
s
,
NULL
);
sigset
(
THR_SERVER_ALARM
,
process_alarm
);
#endif
DBUG_VOID_RETURN
;
}
...
...
@@ -290,7 +280,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
printf
(
"thread_alarm
\n
"
);
fflush
(
stdout
);
#endif
#ifdef DONT_REMEMBER_SIGNAL
sigset
(
THR_CLIENT_ALARM
,
process_alarm
);
/* int. thread system calls */
my_
sigset
(
THR_CLIENT_ALARM
,
process_alarm
);
/* int. thread system calls */
#endif
return
;
}
...
...
@@ -310,7 +300,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
process_alarm_part2
(
sig
);
#ifndef USE_ALARM_THREAD
#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
sigset
(
THR_SERVER_ALARM
,
process_alarm
);
my_
sigset
(
THR_SERVER_ALARM
,
process_alarm
);
#endif
pthread_mutex_unlock
(
&
LOCK_alarm
);
pthread_sigmask
(
SIG_SETMASK
,
&
old_mask
,
NULL
);
...
...
@@ -512,7 +502,7 @@ static sig_handler thread_alarm(int sig)
printf
(
"thread_alarm
\n
"
);
fflush
(
stdout
);
#endif
#ifdef DONT_REMEMBER_SIGNAL
sigset
(
sig
,
thread_alarm
);
/* int. thread system calls */
my_
sigset
(
sig
,
thread_alarm
);
/* int. thread system calls */
#endif
}
#endif
...
...
@@ -916,7 +906,7 @@ static sig_handler print_signal_warning(int sig)
printf
(
"Warning: Got signal %d from thread %s
\n
"
,
sig
,
my_thread_name
());
fflush
(
stdout
);
#ifdef DONT_REMEMBER_SIGNAL
sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
my_
sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
#endif
#ifndef OS2
if
(
sig
==
SIGALRM
)
...
...
sql/mysqld.cc
View file @
cb0d8aba
...
...
@@ -860,7 +860,7 @@ static void __cdecl kill_server(int sig_ptr)
RETURN_FROM_KILL_SERVER
;
kill_in_progress
=
TRUE
;
abort_loop
=
1
;
// This should be set
signal
(
sig
,
SIG_IGN
);
my_sigset
(
sig
,
SIG_IGN
);
if
(
sig
==
MYSQL_KILL_SIGNAL
||
sig
==
0
)
sql_print_information
(
ER
(
ER_NORMAL_SHUTDOWN
),
my_progname
);
else
...
...
@@ -908,11 +908,6 @@ extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
}
#endif
#if defined(__amiga__)
#undef sigset
#define sigset signal
#endif
extern
"C"
sig_handler
print_signal_warning
(
int
sig
)
{
if
(
!
DBUG_IN_USE
)
...
...
@@ -922,7 +917,7 @@ extern "C" sig_handler print_signal_warning(int sig)
sig
,
my_thread_id
());
}
#ifdef DONT_REMEMBER_SIGNAL
sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
my_
sigset
(
sig
,
print_signal_warning
);
/* int. thread system calls */
#endif
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
if
(
sig
==
SIGALRM
)
...
...
@@ -1587,23 +1582,6 @@ void flush_thread_cache()
}
/*
Aborts a thread nicely. Commes here on SIGPIPE
TODO: One should have to fix that thr_alarm know about this
thread too.
*/
#ifdef THREAD_SPECIFIC_SIGPIPE
extern
"C"
sig_handler
abort_thread
(
int
sig
__attribute__
((
unused
)))
{
THD
*
thd
=
current_thd
;
DBUG_ENTER
(
"abort_thread"
);
if
(
thd
)
thd
->
killed
=
1
;
DBUG_VOID_RETURN
;
}
#endif
/******************************************************************************
Setup a signal thread with handles all signals.
Because Linux doesn't support schemas use a mutex to check that
...
...
@@ -2019,8 +1997,8 @@ static void init_signals(void)
DBUG_ENTER
(
"init_signals"
);
if
(
test_flags
&
TEST_SIGINT
)
sigset
(
THR_KILL_SIGNAL
,
end_thread_signal
);
sigset
(
THR_SERVER_ALARM
,
print_signal_warning
);
// Should never be called!
my_
sigset
(
THR_KILL_SIGNAL
,
end_thread_signal
);
my_
sigset
(
THR_SERVER_ALARM
,
print_signal_warning
);
// Should never be called!
if
(
!
(
test_flags
&
TEST_NO_STACKTRACE
)
||
(
test_flags
&
TEST_CORE_ON_SIGNAL
))
{
...
...
@@ -2054,13 +2032,8 @@ static void init_signals(void)
}
#endif
(
void
)
sigemptyset
(
&
set
);
#ifdef THREAD_SPECIFIC_SIGPIPE
sigset
(
SIGPIPE
,
abort_thread
);
sigaddset
(
&
set
,
SIGPIPE
);
#else
(
void
)
signal
(
SIGPIPE
,
SIG_IGN
);
// Can't know which thread
my_sigset
(
SIGPIPE
,
SIG_IGN
);
sigaddset
(
&
set
,
SIGPIPE
);
#endif
sigaddset
(
&
set
,
SIGINT
);
#ifndef IGNORE_SIGHUP_SIGQUIT
sigaddset
(
&
set
,
SIGQUIT
);
...
...
vio/vio.c
View file @
cb0d8aba
...
...
@@ -136,10 +136,18 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
vio
->
sd
);
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
#if !defined(NO_FCNTL_NONBLOCK)
#if defined(__FreeBSD__)
fcntl
(
sd
,
F_SETFL
,
vio
->
fcntl_mode
);
/* Yahoo! FreeBSD patch */
#endif
vio
->
fcntl_mode
=
fcntl
(
sd
,
F_GETFL
);
/*
We call fcntl() to set the flags and then immediately read them back
to make sure that we and the system are in agreement on the state of
things.
An example of why we need to do this is FreeBSD (and apparently some
other BSD-derived systems, like Mac OS X), where the system sometimes
reports that the socket is set for non-blocking when it really will
block.
*/
fcntl
(
sd
,
F_SETFL
,
vio
->
fcntl_mode
);
vio
->
fcntl_mode
=
fcntl
(
sd
,
F_GETFL
);
#elif defined(HAVE_SYS_IOCTL_H)
/* hpux */
/* Non blocking sockets doesn't work good on HPUX 11.0 */
(
void
)
ioctl
(
sd
,
FIOSNBIO
,
0
);
...
...
vio/viosocket.c
View file @
cb0d8aba
...
...
@@ -92,7 +92,14 @@ int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode,
else
vio
->
fcntl_mode
|=
O_NONBLOCK
;
/* set bit */
if
(
old_fcntl
!=
vio
->
fcntl_mode
)
r
=
fcntl
(
vio
->
sd
,
F_SETFL
,
vio
->
fcntl_mode
);
{
r
=
fcntl
(
vio
->
sd
,
F_SETFL
,
vio
->
fcntl_mode
);
if
(
r
==
-
1
)
{
DBUG_PRINT
(
"info"
,
(
"fcntl failed, errno %d"
,
errno
));
vio
->
fcntl_mode
=
old_fcntl
;
}
}
}
#else
r
=
set_blocking_mode
?
0
:
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment