You are not logged in.

#1 2017-07-27 10:05:06

nanxiao
Member
Registered: 2017-07-27
Posts: 21

[Solved]How to install "<uapi/...>" directory?

Hi all,

I am trying to use ebpf in Arch Linux, and find many ebpf code include following directory: 

#include <uapi/linux/ptrace.h>

But my /usr/include/uapi is empty. How to install uapi related stuff in Arch Linux?

Thanks very much in advance!

Best Regards
Nan Xiao

Last edited by nanxiao (2017-07-28 12:31:38)

Offline

#2 2017-07-27 10:21:15

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,319
Website

Re: [Solved]How to install "<uapi/...>" directory?

You can use 'pacman -F' or pkgfile to identify what package (if any) provides a file or directory:

$ pkgfile -d /usr/include/uapi/
core/linux-api-headers

$ pacman -Fo /usr/include/uapi/
usr/include/uapi/ is owned by core/linux-api-headers 4.10.1-1

Note that you need to download the file databases first. Check the man pages for details.

Mod note: Moving to NC.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2017-07-27 11:10:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved]How to install "<uapi/...>" directory?

Wormzy, he clearly has linux-api-headers already installed as he has that directory - but it is empty.  The linux-api-headers package does not contain anything in that directory, just the empty directory.

However, nanxiao, this sounds a bit like an X-Y problem.  Why do you think you need to include something from that directory?  What are you trying to do?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2017-07-27 11:15:30

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,319
Website

Re: [Solved]How to install "<uapi/...>" directory?

Ah, my bad. I didn't realise that the directory was empty in the package.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2017-07-27 13:52:12

nanxiao
Member
Registered: 2017-07-27
Posts: 21

Re: [Solved]How to install "<uapi/...>" directory?

@Trilby

> However, nanxiao, this sounds a bit like an X-Y problem.  Why do you think you need to include something from that directory?  What are you trying to do?

I am reading this script, and come across following include statement: 

#include <uapi/linux/ptrace.h>

Per my understanding, it should be in `/usr/include` directory. Does my understand right?

Thanks very much in advance!

Offline

#6 2017-07-27 14:27:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved]How to install "<uapi/...>" directory?

No, that is in kernel-modules, so it's at /usr/lib/modules/$(uname -r)/build/include/uapi/linux/ptrace.h

But why does it matter where it is?  I assume you are getting some sort of error - if you want help, tell us what you are trying to do and what error you are getting.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2017-07-28 03:13:34

nanxiao
Member
Registered: 2017-07-27
Posts: 21

Re: [Solved]How to install "<uapi/...>" directory?

Hi Trilby,

It seems I get the answer:  "/usr/include/uapi" is used for user-space programming. When I refer pidpersec.py

# load BPF program
b = BPF(text="""
#include <uapi/linux/ptrace.h>
...
...)

It is actually compiled into a kernel module, so it should refer "/usr/lib/modules/$(uname -r)/build/include/..." directory to find related files.

Is my understanding right? Thanks very much in advance!

Offline

#8 2017-07-28 11:40:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved]How to install "<uapi/...>" directory?

nanxiao wrote:

It is actually compiled into a kernel module, so it should refer "/usr/lib/modules/$(uname -r)/build/include/..." directory to find related files.

Yes.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2017-07-28 12:31:22

nanxiao
Member
Registered: 2017-07-27
Posts: 21

Re: [Solved]How to install "<uapi/...>" directory?

Hi Trilby,

Thanks very much for your confirmation!

Offline

#10 2017-07-29 14:44:37

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,779

Re: [Solved]How to install "<uapi/...>" directory?

Nanxiao,

Are you aware that there is a BPF Compiler Collection - C library and examples package in AUR ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#11 2017-07-31 00:46:43

nanxiao
Member
Registered: 2017-07-27
Posts: 21

Re: [Solved]How to install "<uapi/...>" directory?

@Lone_Wolf,

> Are you aware that there is a BPF Compiler Collection - C library and examples package in AUR ?

Yes, I know. I have installed it.

Offline

Board footer

Powered by FluxBB