Re: [PATCH bpf-next v4 3/7] bpf: support epoll from bpf struct_ops links.

Martin KaFai Lau
2024-05-23T17:23:25Z

On 5/21/24 3:51 PM, Kui-Feng Lee wrote:
> +static __poll_t bpf_link_poll(struct file *file, struct poll_table_struct *pts)
> +{
> + struct bpf_link *link = file->private_data;
> +
> + if (link->ops->poll)
> + return link->ops->poll(file, pts);
> +
> + return 0;

The current bpf_link_fops.poll is NULL before this patch. From vfs_poll, it
seems to be DEFAULT_POLLMASK for this case. Please double check.

> +}
> +
> static const struct file_operations bpf_link_fops = {
> #ifdef CONFIG_PROC_FS
> .show_fdinfo = bpf_link_show_fdinfo,
> @@ -3157,6 +3167,7 @@ static const struct file_operations bpf_link_fops = {
> .release = bpf_link_release,
> .read = bpf_dummy_read,
> .write = bpf_dummy_write,
> + .poll = bpf_link_poll,

Same here. What does the epoll_ctl(EPOLL_CTL_ADD) currently expect for link
(e.g. cgroup) that does not support poll?

> };
>