summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/strsubr.c
diff options
context:
space:
mode:
authormeem <none@none>2005-09-16 14:42:39 -0700
committermeem <none@none>2005-09-16 14:42:39 -0700
commitad1660d085d30810ababff96bbae49ef2d5938ea (patch)
tree52768a95ade4361acd1c533fb05427bfa017bfe6 /usr/src/uts/common/os/strsubr.c
parent65b0c20e9bbaf87a200ce20a4decf18585e61a25 (diff)
downloadillumos-joyent-ad1660d085d30810ababff96bbae49ef2d5938ea.tar.gz
6322179 strfreectty() passed a stream that was not yet a ctty
6322765 <sys/strsubr.h> houses phantoms and interlopers 6322770 block comment above backenable() is stale 6323668 hascttyperm() and associated sess_t junk should be torched 6324338 enum jcaccess marooned on the isle of <sys/session.h>
Diffstat (limited to 'usr/src/uts/common/os/strsubr.c')
-rw-r--r--usr/src/uts/common/os/strsubr.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/usr/src/uts/common/os/strsubr.c b/usr/src/uts/common/os/strsubr.c
index b3826021d3..17e0cf8403 100644
--- a/usr/src/uts/common/os/strsubr.c
+++ b/usr/src/uts/common/os/strsubr.c
@@ -76,6 +76,7 @@
#include <sys/multidata.h>
#include <sys/pattr.h>
#include <sys/strft.h>
+#include <sys/fs/snode.h>
#include <sys/zone.h>
#define O_SAMESTR(q) (((q)->q_next) && \
@@ -3977,15 +3978,33 @@ strhup(stdata_t *stp)
}
void
-stralloctty(sess_t *sp, stdata_t *stp)
+stralloctty(stdata_t *stp)
{
+ proc_t *p = curproc;
+ sess_t *sp = p->p_sessp;
+
mutex_enter(&stp->sd_lock);
- mutex_enter(&pidlock);
- stp->sd_sidp = sp->s_sidp;
- stp->sd_pgidp = sp->s_sidp;
- PID_HOLD(stp->sd_pgidp);
- PID_HOLD(stp->sd_sidp);
- mutex_exit(&pidlock);
+ /*
+ * No need to hold the session lock or do a TTY_HOLD() because
+ * this is the only thread that can be the session leader and not
+ * have a controlling tty.
+ */
+ if ((stp->sd_flag &
+ (STRHUP|STRDERR|STWRERR|STPLEX|STRISTTY)) == STRISTTY &&
+ stp->sd_sidp == NULL && /* not allocated as ctty */
+ sp->s_sidp == p->p_pidp && /* session leader */
+ sp->s_flag != SESS_CLOSE && /* session is not closing */
+ sp->s_vp == NULL) { /* without ctty */
+ ASSERT(stp->sd_pgidp == NULL);
+ alloctty(p, makectty(stp->sd_vnode));
+
+ mutex_enter(&pidlock);
+ stp->sd_sidp = sp->s_sidp;
+ stp->sd_pgidp = sp->s_sidp;
+ PID_HOLD(stp->sd_pgidp);
+ PID_HOLD(stp->sd_sidp);
+ mutex_exit(&pidlock);
+ }
mutex_exit(&stp->sd_lock);
}
@@ -4004,38 +4023,8 @@ strfreectty(stdata_t *stp)
if (!(stp->sd_flag & STRHUP))
strhup(stp);
}
-
-void
-strctty(stdata_t *stp)
-{
- extern vnode_t *makectty();
- proc_t *p = curproc;
- sess_t *sp = p->p_sessp;
-
- mutex_enter(&stp->sd_lock);
- /*
- * No need to hold the session lock or do a TTYHOLD,
- * because this is the only thread that can be the
- * session leader and not have a controlling tty.
- */
- if ((stp->sd_flag & (STRHUP|STRDERR|STWRERR|STPLEX)) == 0 &&
- stp->sd_sidp == NULL && /* not allocated as ctty */
- sp->s_sidp == p->p_pidp && /* session leader */
- sp->s_flag != SESS_CLOSE && /* session is not closing */
- sp->s_vp == NULL) { /* without ctty */
- mutex_exit(&stp->sd_lock);
- ASSERT(stp->sd_pgidp == NULL);
- alloctty(p, makectty(stp->sd_vnode));
- stralloctty(sp, stp);
- mutex_enter(&stp->sd_lock);
- stp->sd_flag |= STRISTTY; /* just to be sure */
- }
- mutex_exit(&stp->sd_lock);
-}
-
/*
- * enable first back queue with svc procedure.
- * Use pri == -1 to avoid the setqback
+ * Backenable the first queue upstream from `q' with a service procedure.
*/
void
backenable(queue_t *q, uchar_t pri)