From: dlg Date: Thu, 21 Jan 2021 12:33:14 +0000 (+0000) Subject: let vfs keep track of nonblocking state for us. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d9e31d9c6d1132d7449455b0aabc0d0041ca5197;p=openbsd let vfs keep track of nonblocking state for us. ok claudio@ mvs@ --- diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 02da0807260..fccc985e6d3 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.202 2021/01/17 02:27:29 dlg Exp $ */ +/* $OpenBSD: bpf.c,v 1.203 2021/01/21 12:33:14 dlg Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -379,7 +379,6 @@ bpfopen(dev_t dev, int flag, int mode, struct proc *p) sigio_init(&bd->bd_sigio); bd->bd_rtout = 0; /* no timeout by default */ - bd->bd_rnonblock = ISSET(flag, FNONBLOCK); bpf_get(bd); LIST_INSERT_HEAD(&bpf_d_list, bd, bd_list); @@ -497,7 +496,7 @@ bpfread(dev_t dev, struct uio *uio, int ioflag) ROTATE_BUFFERS(d); break; } - if (d->bd_rnonblock) { + if (ISSET(ioflag, IO_NDELAY)) { /* User requested non-blocking I/O */ error = EWOULDBLOCK; } else if (d->bd_rtout == 0) { @@ -982,10 +981,7 @@ bpfioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) break; case FIONBIO: /* Non-blocking I/O */ - if (*(int *)addr) - d->bd_rnonblock = 1; - else - d->bd_rnonblock = 0; + /* let vfs to keep track of this */ break; case FIOASYNC: /* Send signal on receive packets */ diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h index c2bfb50083e..f7508998487 100644 --- a/sys/net/bpfdesc.h +++ b/sys/net/bpfdesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bpfdesc.h,v 1.44 2021/01/02 02:46:06 cheloha Exp $ */ +/* $OpenBSD: bpfdesc.h,v 1.45 2021/01/21 12:33:14 dlg Exp $ */ /* $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $ */ /* @@ -80,7 +80,6 @@ struct bpf_d { struct bpf_if *bd_bif; /* interface descriptor */ uint64_t bd_rtout; /* [m] Read timeout in nanoseconds */ u_long bd_nreaders; /* [m] # threads asleep in bpfread() */ - int bd_rnonblock; /* true if nonblocking reads are set */ struct bpf_program_smr *bd_rfilter; /* read filter code */ struct bpf_program_smr