I can't find pid.h in /usr/include/linux

I want to know how to install these header file.
My kernel version is 5.4.61

when i use these commands in c file

#include <linux/pid.h>
#include <linux/kthread.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/printk.h>
#include <linux/jiffies.h>
#include <linux/kmod.h>


You need to install the linux headers for your running kernel.
This command will automatically install the headers for all your installed kernels, not only for 5.4:

sudo pacman -S $(pacman -Qsq "^linux" | grep "^linux[0-9]*[-rt]*$" | awk '{print $1"-headers"}' ORS=' ')
1 Like

I’ve marked the below answer as the solution to your question as it is by far the best answer you’ll get.

However, if you disagree with my choice, please feel free to take any other answer as the solution to your question or even remove the solution altogether: You are in control! (I just want to avoid even more subjective opinions being posted and confusing you even more)

P.S. In the future, please mark a solution like this:
so that the next person that has the exact same problem you just had will benefit from your post as well as your question will now be in the “solved” status.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.