Commit f6660539 authored by Marc Alff's avatar Marc Alff

Bug#51878 Build break in HPUX involving mysql_prlock on a client

This is a fix specific for HPUX,
for which the compiler does not resolve properly dependencies
involving unused inline functions.
(See existing comments in mysql_thread.h)

In include/mysql/psi/mysql_thread.h,
the instrumentation helpers for mysql_prlock_*
uses the pr lock apis.

These apis are implemented in mysys/thr_rwlock.c,
which is not linked to client code.

As a result, the code does not link in libmysql_r, on HPUX.

The fix is to cut dependencies explicitely,
by introducing -DDISABLE_MYSQL_RWLOCK_H,
when building client code.
parent 58559ac8
...@@ -192,6 +192,8 @@ typedef struct st_mysql_cond mysql_cond_t; ...@@ -192,6 +192,8 @@ typedef struct st_mysql_cond mysql_cond_t;
on some platforms. on some platforms.
The proper fix would be to cut these extra dependencies in the calling code. The proper fix would be to cut these extra dependencies in the calling code.
DISABLE_MYSQL_THREAD_H is a work around to limit dependencies. DISABLE_MYSQL_THREAD_H is a work around to limit dependencies.
DISABLE_MYSQL_PRLOCK_H is similar, and is used to disable specifically
the prlock wrappers.
*/ */
#ifndef DISABLE_MYSQL_THREAD_H #ifndef DISABLE_MYSQL_THREAD_H
...@@ -714,6 +716,7 @@ static inline int inline_mysql_rwlock_init( ...@@ -714,6 +716,7 @@ static inline int inline_mysql_rwlock_init(
return my_rwlock_init(&that->m_rwlock, NULL); return my_rwlock_init(&that->m_rwlock, NULL);
} }
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_init( static inline int inline_mysql_prlock_init(
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
PSI_rwlock_key key, PSI_rwlock_key key,
...@@ -728,6 +731,7 @@ static inline int inline_mysql_prlock_init( ...@@ -728,6 +731,7 @@ static inline int inline_mysql_prlock_init(
#endif #endif
return rw_pr_init(&that->m_prlock); return rw_pr_init(&that->m_prlock);
} }
#endif
static inline int inline_mysql_rwlock_destroy( static inline int inline_mysql_rwlock_destroy(
mysql_rwlock_t *that) mysql_rwlock_t *that)
...@@ -742,6 +746,7 @@ static inline int inline_mysql_rwlock_destroy( ...@@ -742,6 +746,7 @@ static inline int inline_mysql_rwlock_destroy(
return rwlock_destroy(&that->m_rwlock); return rwlock_destroy(&that->m_rwlock);
} }
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_destroy( static inline int inline_mysql_prlock_destroy(
mysql_prlock_t *that) mysql_prlock_t *that)
{ {
...@@ -754,6 +759,7 @@ static inline int inline_mysql_prlock_destroy( ...@@ -754,6 +759,7 @@ static inline int inline_mysql_prlock_destroy(
#endif #endif
return rw_pr_destroy(&that->m_prlock); return rw_pr_destroy(&that->m_prlock);
} }
#endif
static inline int inline_mysql_rwlock_rdlock( static inline int inline_mysql_rwlock_rdlock(
mysql_rwlock_t *that mysql_rwlock_t *that
...@@ -781,6 +787,7 @@ static inline int inline_mysql_rwlock_rdlock( ...@@ -781,6 +787,7 @@ static inline int inline_mysql_rwlock_rdlock(
return result; return result;
} }
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_rdlock( static inline int inline_mysql_prlock_rdlock(
mysql_prlock_t *that mysql_prlock_t *that
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
...@@ -806,6 +813,7 @@ static inline int inline_mysql_prlock_rdlock( ...@@ -806,6 +813,7 @@ static inline int inline_mysql_prlock_rdlock(
#endif #endif
return result; return result;
} }
#endif
static inline int inline_mysql_rwlock_wrlock( static inline int inline_mysql_rwlock_wrlock(
mysql_rwlock_t *that mysql_rwlock_t *that
...@@ -833,6 +841,7 @@ static inline int inline_mysql_rwlock_wrlock( ...@@ -833,6 +841,7 @@ static inline int inline_mysql_rwlock_wrlock(
return result; return result;
} }
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_wrlock( static inline int inline_mysql_prlock_wrlock(
mysql_prlock_t *that mysql_prlock_t *that
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
...@@ -858,6 +867,7 @@ static inline int inline_mysql_prlock_wrlock( ...@@ -858,6 +867,7 @@ static inline int inline_mysql_prlock_wrlock(
#endif #endif
return result; return result;
} }
#endif
static inline int inline_mysql_rwlock_tryrdlock( static inline int inline_mysql_rwlock_tryrdlock(
mysql_rwlock_t *that mysql_rwlock_t *that
...@@ -885,6 +895,7 @@ static inline int inline_mysql_rwlock_tryrdlock( ...@@ -885,6 +895,7 @@ static inline int inline_mysql_rwlock_tryrdlock(
return result; return result;
} }
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_tryrdlock( static inline int inline_mysql_prlock_tryrdlock(
mysql_prlock_t *that mysql_prlock_t *that
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
...@@ -910,6 +921,7 @@ static inline int inline_mysql_prlock_tryrdlock( ...@@ -910,6 +921,7 @@ static inline int inline_mysql_prlock_tryrdlock(
#endif #endif
return result; return result;
} }
#endif
static inline int inline_mysql_rwlock_trywrlock( static inline int inline_mysql_rwlock_trywrlock(
mysql_rwlock_t *that mysql_rwlock_t *that
...@@ -937,6 +949,7 @@ static inline int inline_mysql_rwlock_trywrlock( ...@@ -937,6 +949,7 @@ static inline int inline_mysql_rwlock_trywrlock(
return result; return result;
} }
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_trywrlock( static inline int inline_mysql_prlock_trywrlock(
mysql_prlock_t *that mysql_prlock_t *that
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
...@@ -962,6 +975,7 @@ static inline int inline_mysql_prlock_trywrlock( ...@@ -962,6 +975,7 @@ static inline int inline_mysql_prlock_trywrlock(
#endif #endif
return result; return result;
} }
#endif
static inline int inline_mysql_rwlock_unlock( static inline int inline_mysql_rwlock_unlock(
mysql_rwlock_t *that) mysql_rwlock_t *that)
...@@ -980,6 +994,7 @@ static inline int inline_mysql_rwlock_unlock( ...@@ -980,6 +994,7 @@ static inline int inline_mysql_rwlock_unlock(
return result; return result;
} }
#ifndef DISABLE_MYSQL_PRLOCK_H
static inline int inline_mysql_prlock_unlock( static inline int inline_mysql_prlock_unlock(
mysql_prlock_t *that) mysql_prlock_t *that)
{ {
...@@ -996,6 +1011,7 @@ static inline int inline_mysql_prlock_unlock( ...@@ -996,6 +1011,7 @@ static inline int inline_mysql_prlock_unlock(
result= rw_pr_unlock(&that->m_prlock); result= rw_pr_unlock(&that->m_prlock);
return result; return result;
} }
#endif
static inline int inline_mysql_cond_init( static inline int inline_mysql_cond_init(
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
......
...@@ -20,9 +20,11 @@ ...@@ -20,9 +20,11 @@
# #
# This file is public domain and comes with NO WARRANTY of any kind # This file is public domain and comes with NO WARRANTY of any kind
target = libmysqlclient_r.la target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ target_defs = -DDISABLE_MYSQL_PRLOCK_H -DDONT_USE_RAID \
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) @ZLIB_INCLUDES@ $(openssl_includes) @ZLIB_INCLUDES@
......
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