summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/stack.c')
-rw-r--r--libglusterfs/src/stack.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c
index c8a3b792979..1531f0da43f 100644
--- a/libglusterfs/src/stack.c
+++ b/libglusterfs/src/stack.c
@@ -8,15 +8,16 @@
cases as published by the Free Software Foundation.
*/
-#include "statedump.h"
-#include "stack.h"
-#include "libglusterfs-messages.h"
+#include "glusterfs/statedump.h"
+#include "glusterfs/stack.h"
+#include "glusterfs/libglusterfs-messages.h"
call_frame_t *
create_frame(xlator_t *xl, call_pool_t *pool)
{
call_stack_t *stack = NULL;
call_frame_t *frame = NULL;
+ static uint64_t unique = 0;
if (!xl || !pool) {
return NULL;
@@ -52,6 +53,7 @@ create_frame(xlator_t *xl, call_pool_t *pool)
{
list_add(&stack->all_frames, &pool->all_frames);
pool->cnt++;
+ stack->unique = unique++;
}
UNLOCK(&pool->lock);
GF_ATOMIC_INC(pool->total_count);
@@ -90,7 +92,7 @@ gf_proc_dump_call_frame(call_frame_t *call_frame, const char *key_buf, ...)
};
int ret = -1;
- char timestr[256] = {
+ char timestr[GF_TIMESTR_SIZE] = {
0,
};
int len;
@@ -148,7 +150,7 @@ gf_proc_dump_call_frame(call_frame_t *call_frame, const char *key_buf, ...)
out:
if (ret) {
gf_proc_dump_write("Unable to dump the frame information",
- "(Lock acquisition failed) %p", my_frame);
+ "(Lock acquisition failed)");
return;
}
}
@@ -160,7 +162,7 @@ gf_proc_dump_call_stack(call_stack_t *call_stack, const char *key_buf, ...)
va_list ap;
call_frame_t *trav;
int32_t i = 1, cnt = 0;
- char timestr[256] = {
+ char timestr[GF_TIMESTR_SIZE] = {
0,
};
int len;
@@ -185,9 +187,9 @@ gf_proc_dump_call_stack(call_stack_t *call_stack, const char *key_buf, ...)
gf_proc_dump_write("uid", "%d", call_stack->uid);
gf_proc_dump_write("gid", "%d", call_stack->gid);
gf_proc_dump_write("pid", "%d", call_stack->pid);
- gf_proc_dump_write("unique", "%Ld", call_stack->unique);
+ gf_proc_dump_write("unique", "%" PRIu64, call_stack->unique);
gf_proc_dump_write("lk-owner", "%s", lkowner_utoa(&call_stack->lk_owner));
- gf_proc_dump_write("ctime", "%lld.%" GF_PRI_SNSECONDS,
+ gf_proc_dump_write("ctime", "%" GF_PRI_SECOND ".%" GF_PRI_SNSECONDS,
call_stack->tv.tv_sec, call_stack->tv.tv_nsec);
if (call_stack->type == GF_OP_TYPE_FOP)
@@ -224,7 +226,7 @@ gf_proc_dump_pending_frames(call_pool_t *call_pool)
gf_proc_dump_add_section("global.callpool");
section_added = _gf_true;
gf_proc_dump_write("callpool_address", "%p", call_pool);
- gf_proc_dump_write("callpool.cnt", "%d", call_pool->cnt);
+ gf_proc_dump_write("callpool.cnt", "%" PRId64, call_pool->cnt);
list_for_each_entry(trav, &call_pool->all_frames, all_frames)
{
@@ -327,6 +329,8 @@ gf_proc_dump_call_frame_to_dict(call_frame_t *call_frame, char *prefix,
if (tmp_frame.unwind_to) {
snprintf(key, sizeof(key), "%s.unwind_to", prefix);
ret = dict_set_dynstr(dict, key, gf_strdup(tmp_frame.unwind_to));
+ if (ret)
+ return;
}
return;