~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to extra/jemalloc/test/thread_tcache_enabled.c

  • Committer: Package Import Robot
  • Author(s): James Page, Otto Kekäläinen
  • Date: 2014-02-17 16:51:52 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140217165152-k315d3175g865kkx
Tags: 5.5.35-1
[ Otto Kekäläinen ]
* New upstream release, fixing the following security issues:
  - Buffer overflow in client/mysql.cc (Closes: #737597).
    - CVE-2014-0001
  - http://www.oracle.com/technetwork/topics/security/cpujan2014-1972949.html
    - CVE-2013-5891
    - CVE-2013-5908
    - CVE-2014-0386
    - CVE-2014-0393
    - CVE-2014-0401
    - CVE-2014-0402
    - CVE-2014-0412
    - CVE-2014-0420
    - CVE-2014-0437
* Upstream https://mariadb.atlassian.net/browse/MDEV-4902
  fixes compatibility with Bison 3.0 (Closes: #733002)
* Updated Russian debconf translation (Closes: #734426)
* Updated Japanese debconf translation (Closes: #735284)
* Updated French debconf translation (Closes: #736480)
* Renamed SONAME properly (Closes: #732967)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#define JEMALLOC_MANGLE
 
2
#include "jemalloc_test.h"
 
3
 
 
4
void *
 
5
je_thread_start(void *arg)
 
6
{
 
7
        int err;
 
8
        size_t sz;
 
9
        bool e0, e1;
 
10
 
 
11
        sz = sizeof(bool);
 
12
        if ((err = mallctl("thread.tcache.enabled", &e0, &sz, NULL, 0))) {
 
13
                if (err == ENOENT) {
 
14
#ifdef JEMALLOC_TCACHE
 
15
                        assert(false);
 
16
#endif
 
17
                }
 
18
                goto label_return;
 
19
        }
 
20
 
 
21
        if (e0) {
 
22
                e1 = false;
 
23
                assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz)
 
24
                    == 0);
 
25
                assert(e0);
 
26
        }
 
27
 
 
28
        e1 = true;
 
29
        assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
 
30
        assert(e0 == false);
 
31
 
 
32
        e1 = true;
 
33
        assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
 
34
        assert(e0);
 
35
 
 
36
        e1 = false;
 
37
        assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
 
38
        assert(e0);
 
39
 
 
40
        e1 = false;
 
41
        assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
 
42
        assert(e0 == false);
 
43
 
 
44
        free(malloc(1));
 
45
        e1 = true;
 
46
        assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
 
47
        assert(e0 == false);
 
48
 
 
49
        free(malloc(1));
 
50
        e1 = true;
 
51
        assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
 
52
        assert(e0);
 
53
 
 
54
        free(malloc(1));
 
55
        e1 = false;
 
56
        assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
 
57
        assert(e0);
 
58
 
 
59
        free(malloc(1));
 
60
        e1 = false;
 
61
        assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
 
62
        assert(e0 == false);
 
63
 
 
64
        free(malloc(1));
 
65
label_return:
 
66
        return (NULL);
 
67
}
 
68
 
 
69
int
 
70
main(void)
 
71
{
 
72
        int ret = 0;
 
73
        je_thread_t thread;
 
74
 
 
75
        malloc_printf("Test begin\n");
 
76
 
 
77
        je_thread_start(NULL);
 
78
 
 
79
        je_thread_create(&thread, je_thread_start, NULL);
 
80
        je_thread_join(thread, (void *)&ret);
 
81
 
 
82
        je_thread_start(NULL);
 
83
 
 
84
        je_thread_create(&thread, je_thread_start, NULL);
 
85
        je_thread_join(thread, (void *)&ret);
 
86
 
 
87
        je_thread_start(NULL);
 
88
 
 
89
        malloc_printf("Test end\n");
 
90
        return (ret);
 
91
}