232
43 int main(int argc, char *argv[]) {
44
PMEMobjpool *pop= pmemobj_create("/mnt/pmem/pool",
45
POBJ_LAYOUT_NAME(example),
46
(1024 * 1024 * 100), 0666);
47
48
TX_BEGIN(pop) {
49
TOID(struct my_root) root
50
= POBJ_ROOT(pop, struct my_root);
51
52
// adding full root to the transaction
53
TX_ADD(root);
54
55
D_RW(root)->value = 4;
56
D_RW(root)->is_odd = D_RO(root)->value % 2;
57
} TX_END
58
59
return 0;
60 }
If we run the code through pmemcheck, as shown in Listing 12-25, no issues are
reported.
Listing 12-25. Running pmemcheck with code Listing 12-24
$ valgrind --tool=pmemcheck ./listing_12-24
==80721== pmemcheck-1.0, a simple persistent store checker
==80721== Copyright (c) 2014-2016, Intel Corporation
==80721== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright
info
==80721== Command: ./listing_12-24
==80721==
==80721==
==80721== Number of stores not made persistent: 0
==80721== ERROR SUMMARY: 0 errors
Chapter 12 Debugging persistent MeMory appliCations
43 int main(int argc, char *argv[]) {
44
PMEMobjpool *pop= pmemobj_create("/mnt/pmem/pool",
45
POBJ_LAYOUT_NAME(example),
46
(1024 * 1024 * 100), 0666);
47
48
TX_BEGIN(pop) {
49
TOID(struct my_root) root
50
= POBJ_ROOT(pop, struct my_root);
51
52
// adding full root to the transaction
53
TX_ADD(root);
54
55
D_RW(root)->value = 4;
56
D_RW(root)->is_odd = D_RO(root)->value % 2;
57
} TX_END
58
59
return 0;
60 }
If we run the code through pmemcheck, as shown in Listing 12-25, no issues are
reported.
Listing 12-25. Running pmemcheck with code Listing 12-24
$ valgrind --tool=pmemcheck ./listing_12-24
==80721== pmemcheck-1.0, a simple persistent store checker
==80721== Copyright (c) 2014-2016, Intel Corporation
==80721== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright
info
==80721== Command: ./listing_12-24
==80721==
==80721==
==80721== Number of stores not made persistent: 0
==80721== ERROR SUMMARY: 0 errors
Chapter 12 Debugging persistent MeMory appliCations
