iovisor / iovisor/bcc

FD to pathname

Open
#237 21 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

Would like a macro or function for mapping a file descriptor to a pathname. I was trying something like (this may be wrong):

``` C
#include
#include
#include

int kprobe__vfs_fstat(struct pt_regs *ctx, unsigned int fd)
{
struct file *file = (struct file *)¤t->files->fdt[fd];
bpf_trace_printk("fstat file %d %s\\n", fd, file->f_path.dentry->d_iname);
return 0;
}
```

and got:

``` Shell
error: couldn't allocate output register for constraint 'r' at line 2148418561
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.