Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/ptyfs use a counter to prevent from mounting ptyfs tw...
details: https://anonhg.NetBSD.org/src/rev/2438f97846ce
branches: trunk
changeset: 584783:2438f97846ce
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 01 05:30:12 2005 +0000
description:
use a counter to prevent from mounting ptyfs twice. Using save_ptm is not
good enough, because if we don't have COMPAT_BSDPTY, then it will stay NULL.
diffstat:
sys/fs/ptyfs/ptyfs_vfsops.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (59 lines):
diff -r 63abbb2c8891 -r 2438f97846ce sys/fs/ptyfs/ptyfs_vfsops.c
--- a/sys/fs/ptyfs/ptyfs_vfsops.c Sat Oct 01 04:11:19 2005 +0000
+++ b/sys/fs/ptyfs/ptyfs_vfsops.c Sat Oct 01 05:30:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptyfs_vfsops.c,v 1.10 2005/09/29 14:45:56 christos Exp $ */
+/* $NetBSD: ptyfs_vfsops.c,v 1.11 2005/10/01 05:30:12 christos Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.10 2005/09/29 14:45:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.11 2005/10/01 05:30:12 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -82,6 +82,7 @@
* ptm glue: When we mount, we make ptm point to us.
*/
struct ptm_pty *ptyfs_save_ptm;
+static int ptyfs_count;
struct ptm_pty ptm_ptyfspty = {
ptyfs__allocvp,
@@ -186,7 +187,7 @@
struct ptyfs_args args;
/* Don't allow more than one mount */
- if (ptyfs_save_ptm != NULL)
+ if (ptyfs_count)
return EBUSY;
if (UIO_MX & (UIO_MX - 1)) {
@@ -239,6 +240,7 @@
ptm_ptyfspty.arg = mp;
ptyfs_save_ptm = pty_sethandler(&ptm_ptyfspty);
+ ptyfs_count++;
return 0;
}
@@ -263,7 +265,6 @@
return (error);
/* Restore where pty access was pointing */
- KASSERT(ptyfs_save_ptm != NULL);
(void)pty_sethandler(ptyfs_save_ptm);
ptyfs_save_ptm = NULL;
ptm_ptyfspty.arg = NULL;
@@ -273,6 +274,7 @@
*/
free(mp->mnt_data, M_UFSMNT);
mp->mnt_data = 0;
+ ptyfs_count--;
return 0;
}
Home |
Main Index |
Thread Index |
Old Index