]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
manual: Document getcontext uc_stack value on Linux [BZ #759]
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 16 May 2017 19:05:35 +0000 (16:05 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 8 Aug 2017 19:16:43 +0000 (16:16 -0300)
As decribed in BZ#759, Linux getcontext implementation on Linux does
differs from other SysV system about the returned uc_stack.  This is
true not only for i386, but for all the architecture I could actually
check (aarch64, arm, alpha, hppa, m68k, mips, mips64, mips64n32,
powerpc, powerpc64, powerpc64le, s390x, sh, sparc, sparc64, and x86).

And I think we should not change current behavior for some reasons:

1. POSIX 2008 removed this SySV interface for a good reason and changing
   this behavior adds nothing for current portable code.  POSIX 2001
   specification does states that stack should be saved [1] and current
   GLIBC code does in a arch-specific manner (inside the mcontext_t)
   which allows the setcontext to work correctly.

2. Changing this behavior would potentially require compat symbols and
   I see no gain in adding compat symbols for deprecated interfaces.

3. Also, for comment #2 in BZ#759, it is up to kernel do setup the contents
   for ucontext_t and currently it does not provide the stack information
   as well.  Trying to change it is also another fix that does not worth
   the possible gains.

Instead my proposal is to make it clear the current interface may differ
depending of the underlying operational system.

glibc documentation and close this bug as invalid.

[BZ #759]
* manual/setjmp.texi (getcontex): Document uc_stack value on Linux.

[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/getcontext.html

ChangeLog
manual/setjmp.texi

index 12d0a7d23e0e860b04686e005877406060cb0406..36dd9e6d38c20f06eee51bd91ab8e373ced7b182 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-08  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       [BZ #759]
+       * manual/setjmp.texi (getcontex): Document uc_stack value
+       compatibility differences.
+
 2017-08-08  Joseph Myers  <joseph@codesourcery.com>
 
        * malloc/mcheck.c (old_free_hook): Use void * instead of __ptr_t.
index 710252881ca14d2073258b1bf29fa794c3a8ed8c..3ce202d0244893247da306efc269eab14b3f1d09 100644 (file)
@@ -294,6 +294,11 @@ the content of the registers, the signal mask, and the current stack.
 Executing the contents would start at the point where the
 @code{getcontext} call just returned.
 
+@strong{Compatibility Note:} Depending on the operating system,
+information about the current context's stack may be in the
+@code{uc_stack} field of @var{ucp}, or it may instead be in
+architecture-specific subfields of the @code{uc_mcontext} field.
+
 The function returns @code{0} if successful.  Otherwise it returns
 @code{-1} and sets @var{errno} accordingly.
 @end deftypefun