1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-04 12:52:15 +00:00

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)
This commit is contained in:
Ed Schouten 2008-06-03 12:38:00 +00:00
parent 4e95375678
commit 5db88944ac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179519

View File

@ -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