current-> pid如何在Linux中工作? [英] how does current->pid work for linux?

查看:44
本文介绍了current-> pid如何在Linux中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要包含一个库吗?有人可以详细说明吗?

Do I need to include a library? Can anyone please elaborate in it?

我知道用来获取当前任务的进程ID,

I know is used to get the process id of the current task where is being called from

但是我想用current-> pid

But I want to printk something with current->pid

printk(我当前的进程ID/pid为%d \ n",当前-> pid);

...给我一个错误

错误:将指针解引用为不完整的类型

推荐答案

您正在寻找 #include< linux/sched.h> .这就是 task_struct 的声明位置.

You're looking for #include <linux/sched.h>. That's where task_struct is declared.

这篇关于current-&gt; pid如何在Linux中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆