summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorzy <[email protected]>2023-12-06 03:20:22 -0500
committerzy <[email protected]>2023-12-06 03:20:22 -0500
commitd131daad164de74c07dbf337877f4a47dcb04cc8 (patch)
tree614e87218f9752a23540d40b096b4d277979ea95 /source
parent1a45d3e409edf39c496d20c91a089adf96cc6a50 (diff)
ucli: true_value
Diffstat (limited to 'source')
-rw-r--r--source/ucli/ucli.cc14
-rw-r--r--source/ucli/ucli.h2
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 {