mailing list of musl libc
 help / color / mirror / code / Atom feed
* termios ugliness
@ 2012-11-16  3:52 Rich Felker
  2012-11-16  4:42 ` Kurt H Maier
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rich Felker @ 2012-11-16  3:52 UTC (permalink / raw)
  To: musl

Hi all,

In the process of integrating the powerpc port, it's come to my
attention that the termios structure (used for setting terminal
attributes) differs gratuitously between archs at the kernel level.
glibc (and thus the LSB ABI, which we've tried to follow) fudges
around this by always using the same userspace structure and
translating from the kernelspace structure. I'm not sure what the
benefit of this is (aside from having extra slots for expansion in
c_cc array), but the downsides are (1) binary bloat and ugly
arch-specific code for conversion, and (2) failure of a direct TCGETS
ioctl (as opposed to a tcgetattr function call) to fill the struct
properly, since it bypasses the translation.

My leaning is to ignore the existing ABI on this and just use the
arch-specific structure from the kernel on ppc and any other archs
with this brokenness (alpha seems to be the main other one, possibly
the only). Unlike x86, x86_64, or arm, I don't see a lot of usefulness
in running glibc binaries on musl-powerpc; if it's ever needed, we
could do patch-up work in the dynamic linker (which will eventually be
needed anyway to deal with wrong regoff_t on x86_64 and 32-bit-off_t
functions on 32-bit archs) to load such apps/libs.

Since it's a decision we can't really change later without breaking
ABI, though, I'd like to ask the community: does anybody have a strong
feeling about whether we should use the kernel termios structure
directly or do like glibc and use an arch-generic userspace termios
structure and code to convert to/from the kernel version?

The powerpc port will probably be considered experimental in the
upcoming release, so we can take our time on the issue a bit, but I'd
still rather hear comments sooner than later if you have some.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: termios ugliness
  2012-11-16  3:52 termios ugliness Rich Felker
@ 2012-11-16  4:42 ` Kurt H Maier
  2012-11-16  8:27 ` Justin Cormack
  2012-11-16 16:34 ` John Spencer
  2 siblings, 0 replies; 6+ messages in thread
From: Kurt H Maier @ 2012-11-16  4:42 UTC (permalink / raw)
  To: musl

On Thu, Nov 15, 2012 at 10:52:11PM -0500, Rich Felker wrote:
> Since it's a decision we can't really change later without breaking
> ABI, though, I'd like to ask the community: does anybody have a strong
> feeling about whether we should use the kernel termios structure
> directly or do like glibc and use an arch-generic userspace termios
> structure and code to convert to/from the kernel version?

I will always support the cleaner solution.  If this can be worked
around in the dynamic linker, that's where it should go.  This has the
advantage of not hosing up static stuff, and leaves the possibility open
to implement clean per-architecture implementations in the future.  I
have a feeling glibc does it their way in the (misguided) name of being
easier to maintain across platforms... but I'd rather have the 'right'
code.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: termios ugliness
  2012-11-16  3:52 termios ugliness Rich Felker
  2012-11-16  4:42 ` Kurt H Maier
@ 2012-11-16  8:27 ` Justin Cormack
  2012-11-16 16:34 ` John Spencer
  2 siblings, 0 replies; 6+ messages in thread
From: Justin Cormack @ 2012-11-16  8:27 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

On 16 Nov 2012 03:52, "Rich Felker" <dalias@aerifal.cx> wrote:
>
> Hi all,
>
> In the process of integrating the powerpc port, it's come to my
> attention that the termios structure (used for setting terminal
> attributes) differs gratuitously between archs at the kernel level.
> glibc (and thus the LSB ABI, which we've tried to follow) fudges
> around this by always using the same userspace structure and
> translating from the kernelspace structure. I'm not sure what the
> benefit of this is (aside from having extra slots for expansion in
> c_cc array), but the downsides are (1) binary bloat and ugly
> arch-specific code for conversion, and (2) failure of a direct TCGETS
> ioctl (as opposed to a tcgetattr function call) to fill the struct
> properly, since it bypasses the translation.
>
> My leaning is to ignore the existing ABI on this and just use the
> arch-specific structure from the kernel on ppc and any other archs
> with this brokenness (alpha seems to be the main other one, possibly
> the only). Unlike x86, x86_64, or arm, I don't see a lot of usefulness
> in running glibc binaries on musl-powerpc; if it's ever needed, we
> could do patch-up work in the dynamic linker (which will eventually be
> needed anyway to deal with wrong regoff_t on x86_64 and 32-bit-off_t
> functions on 32-bit archs) to load such apps/libs.
>
> Since it's a decision we can't really change later without breaking
> ABI, though, I'd like to ask the community: does anybody have a strong
> feeling about whether we should use the kernel termios structure
> directly or do like glibc and use an arch-generic userspace termios
> structure and code to convert to/from the kernel version?
>
> The powerpc port will probably be considered experimental in the
> upcoming release, so we can take our time on the issue a bit, but I'd
> still rather hear comments sooner than later if you have some.
>
> Rich

I would prefer the kernel structure.

Justin

[-- Attachment #2: Type: text/html, Size: 2339 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: termios ugliness
  2012-11-16  3:52 termios ugliness Rich Felker
  2012-11-16  4:42 ` Kurt H Maier
  2012-11-16  8:27 ` Justin Cormack
@ 2012-11-16 16:34 ` John Spencer
  2012-11-16 18:59   ` Rich Felker
  2 siblings, 1 reply; 6+ messages in thread
From: John Spencer @ 2012-11-16 16:34 UTC (permalink / raw)
  To: musl

On 11/16/2012 04:52 AM, Rich Felker wrote:
> Since it's a decision we can't really change later without breaking
> ABI, though, I'd like to ask the community: does anybody have a strong
> feeling about whether we should use the kernel termios structure
> directly or do like glibc and use an arch-generic userspace termios
> structure and code to convert to/from the kernel version?
i think that it's not worthwile to support glibc abi compatibility on 
that platform, if that means that we have to bloat the code and/or use 
hacks to achieve it.

+1 for the straight approach.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: termios ugliness
  2012-11-16 16:34 ` John Spencer
@ 2012-11-16 18:59   ` Rich Felker
  2012-11-17  1:46     ` Alex Caudill
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2012-11-16 18:59 UTC (permalink / raw)
  To: musl

On Fri, Nov 16, 2012 at 05:34:49PM +0100, John Spencer wrote:
> On 11/16/2012 04:52 AM, Rich Felker wrote:
> >Since it's a decision we can't really change later without breaking
> >ABI, though, I'd like to ask the community: does anybody have a strong
> >feeling about whether we should use the kernel termios structure
> >directly or do like glibc and use an arch-generic userspace termios
> >structure and code to convert to/from the kernel version?
> i think that it's not worthwile to support glibc abi compatibility
> on that platform, if that means that we have to bloat the code
> and/or use hacks to achieve it.
> 
> +1 for the straight approach.

Note that even the GNU folks did not care about ABI compatibility on
ppc. They changed long double from ld64 to ld128 and broke everything.
Since we're going to be using the ld64 variant anyway which is already
incompatible with current glibc, I see little point in aiming for
glibc compat on ppc.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: termios ugliness
  2012-11-16 18:59   ` Rich Felker
@ 2012-11-17  1:46     ` Alex Caudill
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Caudill @ 2012-11-17  1:46 UTC (permalink / raw)
  To: musl

FWIW, +1 for using the kernel structure.

On Fri, Nov 16, 2012 at 1:59 PM, Rich Felker <dalias@aerifal.cx> wrote:
> On Fri, Nov 16, 2012 at 05:34:49PM +0100, John Spencer wrote:
>> On 11/16/2012 04:52 AM, Rich Felker wrote:
>> >Since it's a decision we can't really change later without breaking
>> >ABI, though, I'd like to ask the community: does anybody have a strong
>> >feeling about whether we should use the kernel termios structure
>> >directly or do like glibc and use an arch-generic userspace termios
>> >structure and code to convert to/from the kernel version?
>> i think that it's not worthwile to support glibc abi compatibility
>> on that platform, if that means that we have to bloat the code
>> and/or use hacks to achieve it.
>>
>> +1 for the straight approach.
>
> Note that even the GNU folks did not care about ABI compatibility on
> ppc. They changed long double from ld64 to ld128 and broke everything.
> Since we're going to be using the ld64 variant anyway which is already
> incompatible with current glibc, I see little point in aiming for
> glibc compat on ppc.
>
> Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-17  1:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-16  3:52 termios ugliness Rich Felker
2012-11-16  4:42 ` Kurt H Maier
2012-11-16  8:27 ` Justin Cormack
2012-11-16 16:34 ` John Spencer
2012-11-16 18:59   ` Rich Felker
2012-11-17  1:46     ` Alex Caudill

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).