mailing list of musl libc
 help / color / mirror / code / Atom feed
* getcontext, setcontext, makecontext and swapcontext
@ 2018-01-28 12:24 Tmp File
  2018-01-29 15:38 ` William Pitcock
  2018-01-29 18:47 ` Rich Felker
  0 siblings, 2 replies; 3+ messages in thread
From: Tmp File @ 2018-01-28 12:24 UTC (permalink / raw)
  To: musl

Hello all.

I'm compiling many software in a musl box and (by far) the biggest wall I hit regards the functions getcontext, setcontext, makecontext and swapcontext. I understand they are deprecated, but they are used in many programs and it's usually really troublesome/tricky to modify the upstream source code to accomodate for them being unavailable on musl.

David du Colombier from plan9port mentioned[0] a simple coroutine library called libstak[1] that should help.
I see 2 possible approaches:
(i) musl imports libstak 
(ii} users somehow compile libstak and make it available for programs that need the *context functions

In case you aren't interested in (i) could somebody help us get (ii) to work?
Then musl distros like Alpine could have libstak as some kind of "compatibility" layer.
Of course (i) might be a better solution, if you aren't so concerned about getcontext, setcontext, makecontext and swapcontext "deprecation status".

Thank you.

[0] https://github.com/9fans/plan9port/issues/36#issuecomment-123992042
[1] https://github.com/0intro/libtask


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

* Re: getcontext, setcontext, makecontext and swapcontext
  2018-01-28 12:24 getcontext, setcontext, makecontext and swapcontext Tmp File
@ 2018-01-29 15:38 ` William Pitcock
  2018-01-29 18:47 ` Rich Felker
  1 sibling, 0 replies; 3+ messages in thread
From: William Pitcock @ 2018-01-29 15:38 UTC (permalink / raw)
  To: musl

Hi,

On Sun, Jan 28, 2018 at 6:24 AM, Tmp File <tmpfile@mail.com> wrote:
> Hello all.
>
> I'm compiling many software in a musl box and (by far) the biggest wall I hit regards the functions getcontext, setcontext, makecontext and swapcontext. I understand they are deprecated, but they are used in many programs and it's usually really troublesome/tricky to modify the upstream source code to accomodate for them being unavailable on musl.
>
> David du Colombier from plan9port mentioned[0] a simple coroutine library called libstak[1] that should help.
> I see 2 possible approaches:
> (i) musl imports libstak
> (ii} users somehow compile libstak and make it available for programs that need the *context functions
>
> In case you aren't interested in (i) could somebody help us get (ii) to work?
> Then musl distros like Alpine could have libstak as some kind of "compatibility" layer.
> Of course (i) might be a better solution, if you aren't so concerned about getcontext, setcontext, makecontext and swapcontext "deprecation status".

Unfortunately, libtask does not actually contain/provide getcontext()
or setcontext().  It only provides makecontext() and swapcontext().
Implementing a library that has these functions is on my todo list.

William


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

* Re: getcontext, setcontext, makecontext and swapcontext
  2018-01-28 12:24 getcontext, setcontext, makecontext and swapcontext Tmp File
  2018-01-29 15:38 ` William Pitcock
@ 2018-01-29 18:47 ` Rich Felker
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Felker @ 2018-01-29 18:47 UTC (permalink / raw)
  To: musl

On Sun, Jan 28, 2018 at 01:24:58PM +0100, Tmp File wrote:
> Hello all.
> 
> I'm compiling many software in a musl box and (by far) the biggest
> wall I hit regards the functions getcontext, setcontext, makecontext
> and swapcontext. I understand they are deprecated, but they are used
> in many programs and it's usually really troublesome/tricky to
> modify the upstream source code to accomodate for them being
> unavailable on musl.
> 
> David du Colombier from plan9port mentioned[0] a simple coroutine library called libstak[1] that should help.
> I see 2 possible approaches:
> (i) musl imports libstak 
> (ii} users somehow compile libstak and make it available for programs that need the *context functions
> 
> In case you aren't interested in (i) could somebody help us get (ii) to work?
> Then musl distros like Alpine could have libstak as some kind of "compatibility" layer.
> Of course (i) might be a better solution, if you aren't so concerned about getcontext, setcontext, makecontext and swapcontext "deprecation status".

I know this can sound frustrating, but the reason the ucontext
functions are not include (yet? maybe they will be) is not simply
missing implementations for the archs we support (which raises the
question: does libstak actually support all the archs we support?) but
the maintenance and new-arch-porting cost of having to provide these
interfaces, relative to their value. They're all delicate stuff that's
easy to get subtly wrong, and quite a large amount of work to write
compared to the existing, super-tiny amount of asm it takes to port
musl to a new arch. They also may be difficult or impossible to
support for new targets -- things like wasm or pnacl.

Even if policy and namespace conformance issues allowed pulling in
third-party libraries, the maintenance effort and complexity of doing
that would greatly outweigh the effort of just writing these functions
for the archs we support (or copying implementations with compatible
license). But the big issue is how choices like this affect future
requirements on musl, not immediate work right now. Supporting dubious
nonstandard and deprecated interfaces has gotten us in big trouble in
the past -- see the malloc_usable_size issue.

I'm not sure yet what the right way forward is.

One clean option, since the ucontext functions don't really have
significant (any?) interaction with libc stuff, is just using a
separate third-party library when linking programs that need them.

Alternatively, at some point we may add them to libc. This would
probably make the most sense if (1) it really turns out to be
impossible to extricate some key software from them, and (2) there end
up being reasons they do need to interact with libc somehow.

Rich


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

end of thread, other threads:[~2018-01-29 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-28 12:24 getcontext, setcontext, makecontext and swapcontext Tmp File
2018-01-29 15:38 ` William Pitcock
2018-01-29 18:47 ` Rich Felker

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).