Removed unused #includes. Ifdefed a conditionally used #include.
Fixed nonblocking mode. It was per-device instead of per-file. Don't depend on gcc's misfeature of rewriting char args in old-style function definitions to match wrong prototypes. Break K&R1 support to fix this quickly.
This commit is contained in:
parent
4a162126e5
commit
d96bc99dac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31280
@ -20,20 +20,20 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/filio.h>
|
||||
#include <sys/ioctl_compat.h> /* Oooh..We need O/NTTYDISC */
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
|
||||
#include <sys/ioctl_compat.h>
|
||||
#endif
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/kernel.h>
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
#endif /*DEVFS*/
|
||||
|
||||
#include <sys/snoop.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
static d_open_t snpopen;
|
||||
static d_close_t snpclose;
|
||||
@ -144,9 +144,8 @@ snpread(dev, uio, flag)
|
||||
|
||||
do {
|
||||
if (snp->snp_len == 0) {
|
||||
if (snp->snp_flags & SNOOP_NBIO) {
|
||||
return EWOULDBLOCK;
|
||||
}
|
||||
if (flag & IO_NDELAY)
|
||||
return (EWOULDBLOCK);
|
||||
snp->snp_flags |= SNOOP_RWAIT;
|
||||
tsleep((caddr_t) snp, (PZERO + 1) | PCATCH, "snoopread", 0);
|
||||
}
|
||||
@ -186,9 +185,7 @@ snpread(dev, uio, flag)
|
||||
}
|
||||
|
||||
int
|
||||
snpinc(snp, c)
|
||||
struct snoop *snp;
|
||||
char c;
|
||||
snpinc(struct snoop *snp, char c)
|
||||
{
|
||||
char buf[1];
|
||||
|
||||
@ -453,10 +450,6 @@ snpioctl(dev, cmd, data, flags, p)
|
||||
break;
|
||||
|
||||
case FIONBIO:
|
||||
if (*(int *) data)
|
||||
snp->snp_flags |= SNOOP_NBIO;
|
||||
else
|
||||
snp->snp_flags &= ~SNOOP_NBIO;
|
||||
break;
|
||||
|
||||
case FIOASYNC:
|
||||
|
@ -20,20 +20,20 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/filio.h>
|
||||
#include <sys/ioctl_compat.h> /* Oooh..We need O/NTTYDISC */
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
|
||||
#include <sys/ioctl_compat.h>
|
||||
#endif
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/kernel.h>
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
#endif /*DEVFS*/
|
||||
|
||||
#include <sys/snoop.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
static d_open_t snpopen;
|
||||
static d_close_t snpclose;
|
||||
@ -144,9 +144,8 @@ snpread(dev, uio, flag)
|
||||
|
||||
do {
|
||||
if (snp->snp_len == 0) {
|
||||
if (snp->snp_flags & SNOOP_NBIO) {
|
||||
return EWOULDBLOCK;
|
||||
}
|
||||
if (flag & IO_NDELAY)
|
||||
return (EWOULDBLOCK);
|
||||
snp->snp_flags |= SNOOP_RWAIT;
|
||||
tsleep((caddr_t) snp, (PZERO + 1) | PCATCH, "snoopread", 0);
|
||||
}
|
||||
@ -186,9 +185,7 @@ snpread(dev, uio, flag)
|
||||
}
|
||||
|
||||
int
|
||||
snpinc(snp, c)
|
||||
struct snoop *snp;
|
||||
char c;
|
||||
snpinc(struct snoop *snp, char c)
|
||||
{
|
||||
char buf[1];
|
||||
|
||||
@ -453,10 +450,6 @@ snpioctl(dev, cmd, data, flags, p)
|
||||
break;
|
||||
|
||||
case FIONBIO:
|
||||
if (*(int *) data)
|
||||
snp->snp_flags |= SNOOP_NBIO;
|
||||
else
|
||||
snp->snp_flags &= ~SNOOP_NBIO;
|
||||
break;
|
||||
|
||||
case FIOASYNC:
|
||||
|
Loading…
Reference in New Issue
Block a user