diff options
author | green <green@FreeBSD.org> | 1999-09-19 17:00:25 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 1999-09-19 17:00:25 +0000 |
commit | 140cb4ff83b0061eeba0756f708f3f7c117e76e5 (patch) | |
tree | dbfb58e46547ab96401ba9719626c5b12448fbfd /sys/compat/svr4/svr4_termios.c | |
parent | c171f3b18205ec5324a32cba54aff58ae5594701 (diff) | |
download | FreeBSD-src-140cb4ff83b0061eeba0756f708f3f7c117e76e5.zip FreeBSD-src-140cb4ff83b0061eeba0756f708f3f7c117e76e5.tar.gz |
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
Diffstat (limited to 'sys/compat/svr4/svr4_termios.c')
-rw-r--r-- | sys/compat/svr4/svr4_termios.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/compat/svr4/svr4_termios.c b/sys/compat/svr4/svr4_termios.c index 450c084..12d533b 100644 --- a/sys/compat/svr4/svr4_termios.c +++ b/sys/compat/svr4/svr4_termios.c @@ -502,8 +502,6 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data) struct svr4_termios st; struct svr4_termio t; int error, new; - int (*ctl) __P((struct file *, u_long, caddr_t, struct proc *)) = - fp->f_ops->fo_ioctl; *retval = 0; @@ -513,7 +511,7 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data) case SVR4_TCGETA: case SVR4_TCGETS: DPRINTF(("ioctl(TCGET%c);\n", cmd == SVR4_TCGETA ? 'A' : 'S')); - if ((error = (*ctl)(fp, TIOCGETA, (caddr_t) &bt, p)) != 0) + if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, p)) != 0) return error; memset(&st, 0, sizeof(st)); @@ -540,7 +538,7 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data) case SVR4_TCSETSF: DPRINTF(("TCSET{A,S,AW,SW,AF,SF}\n")); /* get full BSD termios so we don't lose information */ - if ((error = (*ctl)(fp, TIOCGETA, (caddr_t) &bt, p)) != 0) + if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, p)) != 0) return error; switch (cmd) { @@ -591,14 +589,14 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data) print_svr4_termios(&st); #endif /* DEBUG_SVR4 */ - return (*ctl)(fp, cmd, (caddr_t) &bt, p); + return fo_ioctl(fp, cmd, (caddr_t) &bt, p); case SVR4_TIOCGWINSZ: DPRINTF(("TIOCGWINSZ\n")); { struct svr4_winsize ws; - error = (*ctl)(fp, TIOCGWINSZ, (caddr_t) &ws, p); + error = fo_ioctl(fp, TIOCGWINSZ, (caddr_t) &ws, p); if (error) return error; return copyout(&ws, data, sizeof(ws)); @@ -611,7 +609,7 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data) if ((error = copyin(data, &ws, sizeof(ws))) != 0) return error; - return (*ctl)(fp, TIOCSWINSZ, (caddr_t) &ws, p); + return fo_ioctl(fp, TIOCSWINSZ, (caddr_t) &ws, p); } default: |