From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes Resent-Date: Sat, 30 Jan 1999 08:00:26 -0500 (EST) Message-Id: <9901301244.AA63428@ibmth.df.unipi.it> To: Drazen Kacar , zsh-workers@math.gatech.edu Subject: Re: PATCH: (more) Re: PATCH: 3.1.5* & 3.0.5: Re: strange xterm & zsh behaviour In-Reply-To: "Drazen Kacar"'s message of "Sat, 30 Jan 1999 06:54:41 NFT." <19990130065441.A25646@jagor.srce.hr> Date: Sat, 30 Jan 1999 13:43:54 +0100 From: Peter Stephenson Resent-Message-ID: <"DE1Iv3.0.PK7.g9mis"@math> Resent-From: zsh-workers@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Resent-Sender: zsh-workers-request@math.gatech.edu X-Mailing-List: 5117 Drazen Kacar wrote: > Since I don't have the latest zsh development source tree, could you > integrate this one in: > > #ifdef TIOCNXCL > if(open("dev/tty", O_RDWR) < 0 && errno == EBUSY) > ioctl(0, TIOCNXCL, 0); > #endif > > That will unlock terminal device (at least on Solaris) and something > should really do that (preferrably the shell). TIOCNXCL is defined in > termios.h. You mean something like the following? I don't quite know how to test for this, since you can't be assured fd 0 is /dev/tty. Maybe the ioctl() on its own is enough. --- Src/init.c.tiocnxcl Sat Jan 30 13:29:37 1999 +++ Src/init.c Sat Jan 30 13:42:31 1999 @@ -300,6 +300,19 @@ /* Make sure the tty is opened read/write. */ if (isatty(0)) { +#ifdef TIOCNXCL + /* + * See if the terminal claims to be busy. If so, and fd 0 + * is a terminal, try and set non-exclusive use for that. + * This is something to do with Solaris over-cleverness. + */ + int tmpfd; + if (tmpfd = open("/dev/tty", O_RDWR) < 0) { + if (errno == EBUSY) + ioctl(0, TIOCNXCL, 0); + } else + close(tmpfd); +#endif zsfree(ttystrname); if ((ttystrname = ztrdup(ttyname(0)))) SHTTY = movefd(open(ttystrname, O_RDWR | O_NOCTTY));