Discussion:
FIONBIO support in freebsd for bpf
dayanidhi sreenivasan
2016-04-26 23:22:20 UTC
Permalink
Hi Guys,
Can somebody tell me why there is no support for non blocking IO for bpf yet?

static int
bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
struct thread *td)
{

......

case FIONBIO: /* Non-blocking I/O */
break;

}

Thanks
Daya
Christian Peron
2016-04-27 01:31:55 UTC
Permalink
It is supported. If you want to put the descriptor into non-blocking mode, open it up with
the device with the O_NONBLOCK flag specified. It probably wouldn't be too difficult to implement
this via ioctl(FIONBIO) but I would need to look at it. Not certain why it can't be done using this
method.

Hope this helps.
Post by dayanidhi sreenivasan
Hi Guys,
Can somebody tell me why there is no support for non blocking IO for bpf yet?
static int
bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
struct thread *td)
{
......
case FIONBIO: /* Non-blocking I/O */
break;
}
Thanks
Daya
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
Christian Peron
2016-04-27 01:49:50 UTC
Permalink
Actually, upon inspection of the code, it appears that ioctl(fd, FIONBIO, ..); works as expected. This ioctl cmd appears to be handled further up the stack…
Post by Christian Peron
It is supported. If you want to put the descriptor into non-blocking mode, open it up with
the device with the O_NONBLOCK flag specified. It probably wouldn't be too difficult to implement
this via ioctl(FIONBIO) but I would need to look at it. Not certain why it can't be done using this
method.
Hope this helps.
Post by dayanidhi sreenivasan
Hi Guys,
Can somebody tell me why there is no support for non blocking IO for bpf yet?
static int
bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
struct thread *td)
{
......
case FIONBIO: /* Non-blocking I/O */
break;
}
Thanks
Daya
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
John Baldwin
2016-04-27 17:59:04 UTC
Permalink
Post by Christian Peron
Actually, upon inspection of the code, it appears that ioctl(fd, FIONBIO, ..); works as expected. This ioctl cmd appears to be handled further up the stack…
Yes, it's a bit odd, but when F_SETFL tries to set O_NONBLOCK, the kernel
passes FIONBIO down to the device to "ask" if it's ok to use the desired
setting (in *(int *)data) of non-blocking. In this case bpf is just saying
it supports either setting by returning 0 regardless of the value in data.
Post by Christian Peron
Post by Christian Peron
It is supported. If you want to put the descriptor into non-blocking mode, open it up with
the device with the O_NONBLOCK flag specified. It probably wouldn't be too difficult to implement
this via ioctl(FIONBIO) but I would need to look at it. Not certain why it can't be done using this
method.
Hope this helps.
Post by dayanidhi sreenivasan
Hi Guys,
Can somebody tell me why there is no support for non blocking IO for bpf yet?
static int
bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
struct thread *td)
{
......
case FIONBIO: /* Non-blocking I/O */
break;
}
Thanks
Daya
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
--
John Baldwin
Loading...