From d96bc99dacbe3701d7becff8b90dc25987c3dce0 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 18 Nov 1997 16:12:51 +0000 Subject: [PATCH] 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. --- sys/dev/snp/snp.c | 21 +++++++-------------- sys/kern/tty_snoop.c | 21 +++++++-------------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 98ac903c3154..738c871c2583 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -20,20 +20,20 @@ #include #include #include -#include /* Oooh..We need O/NTTYDISC */ +#if defined(COMPAT_43) || defined(COMPAT_SUNOS) +#include +#endif #include #include #include -#include #include #include -#include #include #ifdef DEVFS #include #endif /*DEVFS*/ - #include +#include 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: diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c index 98ac903c3154..738c871c2583 100644 --- a/sys/kern/tty_snoop.c +++ b/sys/kern/tty_snoop.c @@ -20,20 +20,20 @@ #include #include #include -#include /* Oooh..We need O/NTTYDISC */ +#if defined(COMPAT_43) || defined(COMPAT_SUNOS) +#include +#endif #include #include #include -#include #include #include -#include #include #ifdef DEVFS #include #endif /*DEVFS*/ - #include +#include 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: