Hi Johan et al,
I'm trying to figure out what the status is of BOTHER and termios2 is in
various architectures, and I saw these patches:
1cee38f0363a88db374e50b232ca17b9a4c12fa0
fefe287e4bf6ee23a5d9422a0a49de5389acc712
As you might know glibc never implemented this stuff, and I'm trying to fix
that. One of their questions is whether there are architectures on which
capability does *NOT* exist at this point.
If you could help straighten this out it would be great.
Specifically, are there any platforms:
1. where simply stuffing values into c_ispeed or c_ospeed and setting BOTHER
can be used to set the baud rate, even for the "standard" baud rates
(obviously breaking if the kernel is too old -- how old is that?)
2. where c_ispeed and c_ospeed aren't set, even if the value in c_cflags isn't
BOTHER?
3.
Also:
4. I note alpha -- apparently as the only architecture -- doesn't define
BOTHER, even though it has B* constants that aren't the same as the
corresponding baud rates. It does, however, have c_[io]speed in its
legacy struct termios. Do you happen to know how this
is supposed to work on Alpha? There are claims that Alpha doesn't need it,
yet I see absolutely no support code for actually setting arbitary
In fact, as far as I can tell, we could actually end up overrunning the
baud_table[] array on Alpha, as the limit check is only done on cbaud &
CBAUDEX, and CBAUDEX on Alpha is zero, yet Alpha has 32 possible values for
c_cflags & CBAUD, and the array is only 31 entries long.
Should we just
#define BOTHER 037
on Alpha, which ought to solve both problems, or is there a solution that
works even on legacy kernels?
On a final note, <uapi/asm/termbits.h> isn't usable in building a libc, since
it pollutes the namespace. I would like to propose:
a. Break out the constants into a separate uapi file;
b. Rename the exported structures __kernel_termios, __kernel_termios2 etc,
for the users which have explicit ioctls and need these structures.
This is a common problem in the headers, which bites extra hard with
names that are tags and not typedefs. The only real solution is to use
a very hidden namespace like __kernel_ and use #define if needed.
c. [Optionally] use an #ifdef to add these defines or, perhaps better for
legacy users, *not* define them. Alternatively a libc that doesn't want
them could #undef them.
-hpa