Re: How to get the device number of 'bpf_get_ns_current_pid_tgid' helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yonghong Song <yhs@xxxxxx> 于2022年2月22日周二 14:24写道:
>
>
>
> On 2/21/22 7:43 PM, Li Qiang wrote:
> > Hello all,
> >
> > As we know, to call 'bpf_get_ns_current_pid_tgid' helper we need dev
> > and inode number. The inode number is quite easy to get by 'ls -lh
> > /proc/xx/ns/'. So how can we get the device number easily in practice?
> > the kernel test just uses 0 to test.
>
> You can use the following command inside the namespace to
> get the dev number and inode number.
>

Thanks Yonghong, this just remind me to look the stat syscall and it
also contains the device info.



> $ stat -L /proc/self/ns/pid
>    File: /proc/self/ns/pid
>    Size: 0               Blocks: 0          IO Block: 4096   regular
> empty file
> Device: 4h/4d   Inode: 4026531836  Links: 1
> Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
> Access: 2022-02-21 22:22:48.782383342 -0800
> Modify: 2022-02-21 22:22:48.782383342 -0800
> Change: 2022-02-21 22:22:48.782383342 -0800
>   Birth: -
>
>
> >
> > Thanks,
> > Li Qiang




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux