Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
To: axp-list@redhat.com
Subject: Re: cuax vs ttySx
Date: Sat, 17 Apr 1999 13:55:22 -0600 (MDT)	[thread overview]
Message-ID: <199904171955.NAA08689@ellpspace.math.ualberta.ca> (raw)
In-Reply-To: <Pine.BSF.4.02.9904171106120.4589-100000@ns1.fidalgo.net> from "Ron Farrer" at Apr 17, 99 11:12:22 am

Ron Farrer wrote:
> 
> > now cuax has been obsoleted, so your only choice is ttySx. (which 
> > might become /dev/tts/x if devfs goes into 2.3) 
> 
> Could be, I alway's used cuax for modems/routers/etc. and ttysx for
> terminals mostly because a few times cuax caused problems with some
> terminals.

'cuax' devices are really obsolete for a long time.  Mainly they
provide some primitive form of locking with ttySx devices; this locking
is more trouble than gain in any non-trivial situtation.

Ted Tso, who wrote the whole serial handler, describe once 'cuax'
devices as a "mistake" and tried quite hard to wean people from 'cuax'.
Persuasions did not seem to work so, in 2.2 kernels, any use of 'cuax'
logs an obnoxious message and these devices will be gone in future
kernel versions.  This should do it. :-)

Myself I am using /dev/ttySx for a long time and never had any problems.
We still probably need a slightly modified 'stty' which can open 
a serial port directly using O_NONBLOCK for situations when one got
stuck and CLOCAL is not set.  Normally 'stty' is used as
"stty <something, something> < /dev/ttyS1" and one cannot rely on a
shell that it will do that.  It might, but one never know.

Below is a detailed explanation from Ted about differences and pitfals
done better that I could have been able to. :-)  Note dates.

  Michal

Subject: Re: /dev/cua? Vs /dev/ttyS?
Date: Mon, 13 May 1996 19:51:04 +0200
Status: ROr

   Date:        Mon, 13 May 1996 07:57:09 +1000
   From: Tony Nugent <tonyn@sctnugen.ppp.gu.edu.au>

   Can someone kindly explain the difference between the /dev/cua? and
   /dev/ttyS? devices?

/dev/ttySxx devices are fully POSIX-compliant TTY devices.  If you are
only going to be using one set of tty devices, you should be using
/dev/ttySxx. 

/dev/cuaXX devices are different from /dev/ttySXX in two ways --- first
of all, they will allow you to open the device even if CLOCAL is not set
and the O_NONBLOCK flag was not given to the open device.  This allows
programs that don't use the POSIX-mandated interface for opening
/dev/ttySxx devices to be able to use /dev/cuaXX to make outgoing phone
calls on their modem (cu stands for "callout", and is taken from SunOS).

The second way in which /dev/cuaXX differs from /dev/ttySXX is that if
they are used, they will trigger a simplistic kernel-based locking
scheme:  If /dev/ttySXX is opened by one or more processes, then an
attempt to open /dev/cuaXX will return EAGAIN.  If /dev/cuaXX is opened
by one or more processes, then an attempt to open /dev/ttySXX will
result the open blocking until /dev/cuaXX is closed, and the carrier
detect line goes high.

While this will allow for simple lockouts between a user using a modem
for callout and a getty listening on the line for logins, it doesn't
work if you need to arbitrate between multiple programs wanting to do
dialout --- for example, users wanting to do dialout and UUCP.

I originally implemented the cuaXX/ttySXX lockout mechanism back before
FSSTND established a standard convention for the use of tty lock files.
Now that it's there, people should use the tty lock files and not try
using /dev/cuaXX.  The only reason why /dev/cuaXX hasn't disappeared yet
is for backwards compatibility reasons.

                                                - Ted


  parent reply	other threads:[~1999-04-17 20:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-17 18:12 cuax vs ttySx Ron Farrer
1999-04-17 19:53 ` Multia serial ports Daniel J. Frasnelli
1999-04-17 19:55 ` Michal Jaegermann [this message]
1999-04-17 20:30   ` cuax vs ttySx Ron Farrer
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox