summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2017-07-20 08:56:09 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2017-07-20 08:56:09 +0300
commita481de30bb972f055cff088a84a211c1acd5be38 (patch)
tree680d500eddf7b51bd2086218a01a42b28efa1f51 /mysys
parente8a2a751212a04e835b2b03408132ecbbab52410 (diff)
parent59fca5806af65c8379a993f9e604cb0b20a76e2b (diff)
downloadmariadb-git-a481de30bb972f055cff088a84a211c1acd5be38.tar.gz
Merge tag 'mariadb-5.5.57' into 5.5-galera
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_fopen.c2
-rw-r--r--mysys/my_rdtsc.c25
-rw-r--r--mysys/my_symlink.c2
-rw-r--r--mysys/mysys_priv.h11
-rw-r--r--mysys/stacktrace.c2
5 files changed, 38 insertions, 4 deletions
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 99a9035c0c2..9131a2549e0 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -143,7 +143,7 @@ static int no_close(void *cookie __attribute__((unused)))
/*
A hack around a race condition in the implementation of freopen.
- The race condition steams from the fact that the current fd of
+ The race condition stems from the fact that the current fd of
the stream is closed before its number is used to duplicate the
new file descriptor. This defeats the desired atomicity of the
close and duplicate of dup2().
diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c
index 028c7f810d4..ad11e8c6a6c 100644
--- a/mysys/my_rdtsc.c
+++ b/mysys/my_rdtsc.c
@@ -129,6 +129,31 @@ ulonglong my_timer_cycles_il_x86_64();
clock_gettime(CLOCK_SGI_CYCLE) for Irix platforms,
or on read_real_time for aix platforms. There is
nothing for Alpha platforms, they would be tricky.
+
+ On the platforms that do not have a CYCLE timer,
+ "wait" events are initialized to use NANOSECOND instead of CYCLE
+ during performance_schema initialization (at the server startup).
+
+ Linux performance monitor (see "man perf_event_open") can
+ provide cycle counter on the platforms that do not have
+ other kinds of cycle counters. But we don't use it so far.
+
+ ARM notes
+ ---------
+ During tests on ARMv7 Debian, perf_even_open() based cycle counter provided
+ too low frequency with too high overhead:
+ MariaDB [performance_schema]> SELECT * FROM performance_timers;
+ +-------------+-----------------+------------------+----------------+
+ | TIMER_NAME | TIMER_FREQUENCY | TIMER_RESOLUTION | TIMER_OVERHEAD |
+ +-------------+-----------------+------------------+----------------+
+ | CYCLE | 689368159 | 1 | 970 |
+ | NANOSECOND | 1000000000 | 1 | 308 |
+ | MICROSECOND | 1000000 | 1 | 417 |
+ | MILLISECOND | 1000 | 1000 | 407 |
+ | TICK | 127 | 1 | 612 |
+ +-------------+-----------------+------------------+----------------+
+ Therefore, it was decided not to use perf_even_open() on ARM
+ (i.e. go without CYCLE and have "wait" events use NANOSECOND by default).
*/
ulonglong my_timer_cycles(void)
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index ed35fff41e9..12959f1f24a 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -197,7 +197,7 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd)
{
- char buf[PATH_MAX+1];
+ char buf[FN_REFLEN + 1];
char *s= buf, *e= buf+1, *end= strnmov(buf, pathname, sizeof(buf));
int fd, dfd= -1;
diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h
index 661c4c184f1..1004bf8889f 100644
--- a/mysys/mysys_priv.h
+++ b/mysys/mysys_priv.h
@@ -107,12 +107,21 @@ const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd);
res= AT; \
if (dfd >= 0) close(dfd); \
return res;
-#elif defined(HAVE_REALPATH)
+#elif defined(HAVE_REALPATH) && defined(PATH_MAX)
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
char buf[PATH_MAX+1]; \
if (realpath(pathname, buf) == NULL) return -1; \
if (strcmp(pathname, buf)) { errno= ENOTDIR; return -1; } \
return NOAT;
+#elif defined(HAVE_REALPATH)
+#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
+ char *buf= realpath(pathname, NULL); \
+ int res; \
+ if (buf == NULL) return -1; \
+ if (strcmp(pathname, buf)) { errno= ENOTDIR; res= -1; } \
+ else res= NOAT; \
+ free(buf); \
+ return res;
#else
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
return NOAT;
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index 402520990b6..ae715c04621 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -744,7 +744,7 @@ void my_safe_print_str(const char *val, int len)
size_t my_write_stderr(const void *buf, size_t count)
{
- return (size_t) write(STDERR_FILENO, buf, count);
+ return (size_t) write(fileno(stderr), buf, count);
}