From d131daad164de74c07dbf337877f4a47dcb04cc8 Mon Sep 17 00:00:00 2001 From: zy Date: Wed, 6 Dec 2023 03:20:22 -0500 Subject: [PATCH] ucli: true_value --- source/ucli/ucli.cc | 14 +++++++++++--- source/ucli/ucli.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/ucli/ucli.cc b/source/ucli/ucli.cc index e33ad1c..d3b9eb4 100644 --- a/source/ucli/ucli.cc +++ b/source/ucli/ucli.cc @@ -45,6 +45,10 @@ // return switch_namespace(pid, "pid"); // } +// int switch_to_user_namespace(pid_t pid) { +// return switch_namespace(pid, "user"); +// } + // void test(variable_monitor_task *tsk_info) { // // host // if (tsk_info->task.pid == tsk_info->task.container_pid){ @@ -66,6 +70,10 @@ // close(fd); // return; // } +// if (switch_to_user_namespace(tsk_info->task.pid) != 0) { +// close(fd); +// return; +// } // // Do something with tgid... // diag_printf_raw_stack(tsk_info->task.container_tgid, @@ -99,13 +107,13 @@ static int task_info_extract(void *buf, unsigned int len, void *) { printf("threshold exceeded, Timestamp %d :\n", vm_record->tv); for (int i = 0; i < vm_record->threshold_num; i++) { - printf("\t: pid: %d, name: %s, ptr: %p, threshold:%d\n", + printf("\t: pid: %d, name: %s, ptr: %p, threshold:%d, true_value:%d\n", vm_record->threshold_record[i].task_id, vm_record->threshold_record[i] .name, // Assuming name is a null-terminated string vm_record->threshold_record[i].ptr, - vm_record->threshold_record[i].threshold - // vm_record->threshold_record[i].true_value + vm_record->threshold_record[i].threshold, + vm_record->threshold_record[i].true_value ); } break; diff --git a/source/ucli/ucli.h b/source/ucli/ucli.h index 8730b07..a8fbb21 100644 --- a/source/ucli/ucli.h +++ b/source/ucli/ucli.h @@ -37,7 +37,7 @@ typedef struct { char name[MAX_NAME_LEN + 1]; // name void *ptr; // virtual address long long threshold; // threshold value - // long long true_value; // target true value + long long true_value; // target true value } threshold; typedef struct {