[PATCH] Fix minor breakage on Cygwin: auth-passwd.c andsession.c
Darren Tucker
dtucker at zip.com.au
Tue Aug 12 22:26:39 EST 2003
Corinna Vinschen wrote:
> On Mon, Aug 11, 2003 at 07:04:05PM +0200, Gert Doering wrote:
> > Well, it's not a "break" but a "BREAK" signal.
> > [...]
>
> Ok, but which functionality is ioctl(TIOCSBRK/TIOCCBRK)? Does
> it reflect tcflow(TCOOFF/TCOON), tcflow(TCIOFF/TCION) or tcsendbreak()?
tcsendbreak.
I had assumed (and this seems to be the case) that TIOCSBRK/TIOCCBRK are
"set break flag" and "clear break flag". I'll bet UARTs have a
corresponding flag in a register somewhere.
So: ioctl(TIOCSBRK) and the TD line on the port goes to +12V and stays
there until ioctl(TIOCCBRK) is called.
> Either way, it would be helpful to substitute the ioctl() by a more
> portable call instead of just ignoring it entirely if the ioctl()
> code isn't available.
The catch is the tcsendbreak can't (generally? portably?) specify the
duration of the break, you get a hard-coded delay.
So, we could do:
#if defined(TIOCSBRK) && defined(TIOCCBRK)
/* use ioctls */
#else
# if defined(HAVE_TCSENDBREAK)
/* use tcsendbreak */
# else
return 0;
# endif
#endif
If you forget about specifying duration and just use tcsendbreak, it'd be
cleaner. You can build a compatibility function using the ioctls where
necessary.
Also, tcsendbreak doesn't seem to block.
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
More information about the openssh-unix-dev
mailing list