diff options
author | ed <ed@FreeBSD.org> | 2008-06-03 12:38:00 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2008-06-03 12:38:00 +0000 |
commit | be822a5885327f36e1c261942514a0f42d3d0ed6 (patch) | |
tree | 84d9f628bcd87796e7d7c99f2f06ad3e7b9d5d8b /sys/kern/tty_tty.c | |
parent | 0b6c9d6ea7fe1f60bf282e884fbbb3f3466fe780 (diff) | |
download | FreeBSD-src-be822a5885327f36e1c261942514a0f42d3d0ed6.zip FreeBSD-src-be822a5885327f36e1c261942514a0f42d3d0ed6.tar.gz |
Remove unneeded Giant locking of /dev/tty.
The Giant lock is acquired in two places in tty_tty.c. In both places,
it is unneeded.
There is no reason to specify D_NEEDGIANT on this device node. The
device node has only been designed to return ENXIO when opened. It
doesn't make any sense to lock/unlock Giant, just to return this error.
D_TTY is also unneeded. The unimplemented functions don't need to be
patched by devfs.
We don't need to lock Giant when we want to lookup the proper TTY vnode.
s_ttyvp is already protected by proctree_lock (see devfs_vnops.c).
Approved by: philip (mentor)
Diffstat (limited to 'sys/kern/tty_tty.c')
-rw-r--r-- | sys/kern/tty_tty.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index f544347..040080a 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -43,7 +43,6 @@ static struct cdevsw ctty_cdevsw = { .d_version = D_VERSION, .d_open = cttyopen, .d_name = "ctty", - .d_flags = D_TTY | D_NEEDGIANT, }; static struct cdev *ctty; @@ -65,7 +64,6 @@ ctty_clone(void *arg, struct ucred *cred, char *name, int namelen, if (strcmp(name, "tty")) return; sx_sunlock(&clone_drain_lock); - mtx_lock(&Giant); sx_slock(&proctree_lock); sx_slock(&clone_drain_lock); dev_lock(); @@ -82,7 +80,6 @@ ctty_clone(void *arg, struct ucred *cred, char *name, int namelen, dev_refl(*dev); dev_unlock(); sx_sunlock(&proctree_lock); - mtx_unlock(&Giant); } static void |