IOCTL_TGID
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
// !todo move to a header file
|
||||
#define IOCTL_MAGIC_NUMBER 'k'
|
||||
#define IOCTL_PID _IOWR(IOCTL_MAGIC_NUMBER, 2, int)
|
||||
#define IOCTL_TGID _IOWR(IOCTL_MAGIC_NUMBER, 3, int)
|
||||
|
||||
static int task_info_extract(void *buf, unsigned int len, void *) {
|
||||
int *et_type;
|
||||
@@ -122,6 +123,25 @@ static void do_pid(char *arg) {
|
||||
do_dump("");
|
||||
}
|
||||
|
||||
static void do_tgid(char *arg) {
|
||||
int pid = 0;
|
||||
int ret;
|
||||
|
||||
sscanf(optarg, "%d", &pid);
|
||||
if (pid <= 0) {
|
||||
printf("参数错误\n");
|
||||
return;
|
||||
}
|
||||
printf("获取 tgid 信息: %d\n", pid);
|
||||
ret = diag_call_ioctl(IOCTL_TGID, (long)&pid);
|
||||
if (ret) {
|
||||
printf("获取线程信息错误: %d\n", ret);
|
||||
}
|
||||
sleep(3);
|
||||
|
||||
do_dump("");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
run_in_host = check_in_host();
|
||||
|
||||
@@ -151,7 +171,7 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
}
|
||||
|
||||
option_index = 2;
|
||||
// option_index = 2;
|
||||
|
||||
switch (option_index) {
|
||||
case 0: // help
|
||||
@@ -163,6 +183,9 @@ int main(int argc, char *argv[]) {
|
||||
case 2: // pid
|
||||
do_pid(optarg);
|
||||
break;
|
||||
case 3: // tgid
|
||||
do_tgid(optarg);
|
||||
break;
|
||||
default:
|
||||
// usage_pupil();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user