summaryrefslogtreecommitdiffstats
path: root/tests/helpers
diff options
context:
space:
mode:
authorKarel Zak2015-04-24 15:53:28 +0200
committerKarel Zak2015-04-24 15:53:28 +0200
commita539def58999a587fe42f5d42c48f261dcd489a7 (patch)
treeb728e790fa0d3b50123fba850cffe7b23ab3c52c /tests/helpers
parenttest_uuidd: make objdump more robust (diff)
downloadkernel-qcow2-util-linux-a539def58999a587fe42f5d42c48f261dcd489a7.tar.gz
kernel-qcow2-util-linux-a539def58999a587fe42f5d42c48f261dcd489a7.tar.xz
kernel-qcow2-util-linux-a539def58999a587fe42f5d42c48f261dcd489a7.zip
test_uuidd: add pid, tid and idx back to object
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/helpers')
-rw-r--r--tests/helpers/test_uuidd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/helpers/test_uuidd.c b/tests/helpers/test_uuidd.c
index 7a4f8eb97..f098c4ac4 100644
--- a/tests/helpers/test_uuidd.c
+++ b/tests/helpers/test_uuidd.c
@@ -47,7 +47,9 @@ typedef struct threadentry thread_t;
/* this is in shared memory, keep it as small as possible */
struct objectentry {
uuid_t uuid;
- thread_t *thread;
+ pthread_t tid;
+ pid_t pid;
+ size_t idx;
};
typedef struct objectentry object_t;
@@ -123,7 +125,9 @@ static void *create_uuids(thread_t *th)
object_t *obj = &objects[i];
object_uuid_create(obj);
- obj->thread = th;
+ obj->tid = th->tid;
+ obj->pid = th->proc->pid;
+ obj->idx = th->index + i;;
}
return 0;
}
@@ -230,8 +234,9 @@ static void object_dump(size_t idx, object_t *obj)
fprintf(stderr, "object[%zu]: {\n", idx);
fprintf(stderr, " uuid: <%s>\n", p);
- fprintf(stderr, " process: %d\n", obj->thread && obj->thread->proc ? (int) obj->thread->proc->pid : 0);
- fprintf(stderr, " thread: %d\n", obj->thread ? (int) obj->thread->tid : 0);
+ fprintf(stderr, " idx: %zu\n", obj->idx);
+ fprintf(stderr, " process: %d\n", (int) obj->pid);
+ fprintf(stderr, " thread: %d\n", (int) obj->tid);
fprintf(stderr, "}\n");
}
@@ -289,7 +294,7 @@ int main(int argc, char *argv[])
object_t *obj1 = &objects[i],
*obj2 = &objects[i + 1];
- if (!obj1->thread) {
+ if (!obj1->tid) {
LOG(3, (stderr, "ignore unused object #%zu\n", i));
nignored++;
continue;