Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2016 10:59:04 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Cc:        Christian Peron <csjp@sqrt.ca>, dayanidhi sreenivasan <dayanidhi.sreenivasan@gmail.com>
Subject:   Re: FIONBIO support in freebsd for bpf
Message-ID:  <2277475.FAchkNOHDZ@ralph.baldwin.cx>
In-Reply-To: <5DCCBADE-B367-46DA-9B48-9393F7A3C2AD@sqrt.ca>
References:  <CADrQwqrpsvG6bdmK=-bmYqFqTUYjby6=xcscc-uFo1_7=tGXNw@mail.gmail.com> <20160427013155.GA3880@xor.gateway.mts.net> <5DCCBADE-B367-46DA-9B48-9393F7A3C2AD@sqrt.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, April 26, 2016 08:49:50 PM Christian Peron wrote:
> Actually, upon inspection of the code, it appears that ioctl(fd, FION=
BIO, ..); works as expected. This ioctl cmd appears to be handled furth=
er up the stack=E2=80=A6

Yes, it's a bit odd, but when F_SETFL tries to set O_NONBLOCK, the kern=
el
passes FIONBIO down to the device to "ask" if it's ok to use the desire=
d
setting (in *(int *)data) of non-blocking.  In this case bpf is just sa=
ying
it supports either setting by returning 0 regardless of the value in da=
ta.

> > On Apr 26, 2016, at 8:31 PM, Christian Peron <csjp@sqrt.ca> wrote:
> >=20
> > It is supported. If you want to put the descriptor into non-blockin=
g 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 certai=
n why it can't be done using this
> > method.
> >=20
> > Hope this helps.
> >=20
> > On Tue, Apr 26, 2016 at 07:22:20PM -0400, dayanidhi sreenivasan wro=
te:
> >> Hi Guys,
> >> Can somebody tell me why there is no support for non blocking IO f=
or bpf yet?
> >>=20
> >> static  int
> >> bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
> >>    struct thread *td)
> >> {
> >>=20
> >> ......
> >>=20
> >> case FIONBIO:       /* Non-blocking I/O */
> >>        break;
> >>=20
> >> }
> >>=20
> >> Thanks
> >> Daya
> >> _______________________________________________
> >> freebsd-arch@freebsd.org mailing list
> >> https://lists.freebsd.org/mailman/listinfo/freebsd-arch
> >> To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd=
.org"
>=20
> _______________________________________________
> freebsd-arch@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.or=
g"


--=20
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2277475.FAchkNOHDZ>