GNU C Library master sources branch, master, updated. glibc-2.11-370-gef634a9

drepper@sourceware.org drepper@sourceware.org
Tue Apr 13 14:13:00 GMT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  ef634a94c7126bcd6ac02de495b598fb99ac544d (commit)
      from  ea42a20caed5b343ff20a0d4622ae6c17b77161b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ef634a94c7126bcd6ac02de495b598fb99ac544d

commit ef634a94c7126bcd6ac02de495b598fb99ac544d
Author: Andreas Schwab <schwab@redhat.com>
Date:   Tue Apr 13 07:13:00 2010 -0700

    Fix use of ucontext_t objects in tst-makecontext3
    
    Objects of type ucontext_t cannot be copied, only getcontext can
    properly initialize them.  For example, on powerpc the structure
    contains a pointer into itself, so makecontext modifies the original
    object by side effect.

diff --git a/ChangeLog b/ChangeLog
index 606bc22..be0dd16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-12  Andreas Schwab  <schwab@redhat.com>
+
+	* stdlib/tst-makecontext3.c (main): Initialize ucontext_t objects
+	only with getcontext.  Test for unimplemented makecontext by
+	checking errno.
+
 2010-04-09  Ulrich Drepper  <drepper@redhat.com>
 
 	* nscd/aicache.c (addhstaiX): Correct passing memory to address
diff --git a/stdlib/tst-makecontext3.c b/stdlib/tst-makecontext3.c
index f127c6a..a44169a 100644
--- a/stdlib/tst-makecontext3.c
+++ b/stdlib/tst-makecontext3.c
@@ -136,38 +136,42 @@ main (void)
       exit (1);
     }
 
-  ctx[1] = ctx[0];
+  if (getcontext (&ctx[1]) != 0)
+    {
+      printf ("%s: getcontext: %m\n", __FUNCTION__);
+      exit (1);
+    }
+
   ctx[1].uc_stack.ss_sp = st1;
   ctx[1].uc_stack.ss_size = sizeof st1;
   ctx[1].uc_link = &ctx[0];
-  {
-    ucontext_t tempctx = ctx[1];
-    makecontext (&ctx[1], (void (*) (void)) f1, 33,
-		 0x00000001 << flag, 0x00000004 << flag,
-		 0x00000012 << flag, 0x00000048 << flag,
-		 0x00000123 << flag, 0x0000048d << flag,
-		 0x00001234 << flag, 0x000048d1 << flag,
-		 0x00012345 << flag, 0x00048d15 << flag,
-		 0x00123456 << flag, 0x0048d159 << flag,
-		 0x01234567 << flag, 0x048d159e << flag,
-		 0x12345678 << flag, 0x48d159e2 << flag,
-		 0x23456789 << flag, 0x8d159e26 << flag,
-		 0x3456789a << flag, 0xd159e26a << flag,
-		 0x456789ab << flag, 0x159e26af << flag,
-		 0x56789abc << flag, 0x59e26af3 << flag,
-		 0x6789abcd << flag, 0x9e26af37 << flag,
-		 0x789abcde << flag, 0xe26af37b << flag,
-		 0x89abcdef << flag, 0x26af37bc << flag,
-		 0x9abcdef0 << flag, 0x6af37bc3 << flag,
-		 0xabcdef0f << flag);
-
-    /* Without this check, a stub makecontext can make us spin forever.  */
-    if (memcmp (&tempctx, &ctx[1], sizeof ctx[1]) == 0)
-      {
-	puts ("makecontext was a no-op, presuming not implemented");
-	return 0;
-      }
-  }
+  errno = 0;
+  makecontext (&ctx[1], (void (*) (void)) f1, 33,
+	       0x00000001 << flag, 0x00000004 << flag,
+	       0x00000012 << flag, 0x00000048 << flag,
+	       0x00000123 << flag, 0x0000048d << flag,
+	       0x00001234 << flag, 0x000048d1 << flag,
+	       0x00012345 << flag, 0x00048d15 << flag,
+	       0x00123456 << flag, 0x0048d159 << flag,
+	       0x01234567 << flag, 0x048d159e << flag,
+	       0x12345678 << flag, 0x48d159e2 << flag,
+	       0x23456789 << flag, 0x8d159e26 << flag,
+	       0x3456789a << flag, 0xd159e26a << flag,
+	       0x456789ab << flag, 0x159e26af << flag,
+	       0x56789abc << flag, 0x59e26af3 << flag,
+	       0x6789abcd << flag, 0x9e26af37 << flag,
+	       0x789abcde << flag, 0xe26af37b << flag,
+	       0x89abcdef << flag, 0x26af37bc << flag,
+	       0x9abcdef0 << flag, 0x6af37bc3 << flag,
+	       0xabcdef0f << flag);
+
+  /* Without this check, a stub makecontext can make us spin forever.  */
+  if (errno == ENOSYS)
+    {
+      puts ("makecontext not implemented");
+      back_in_main = 1;
+      return 0;
+    }
 
   /* Play some tricks with this context.  */
   if (++global == 1)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |    6 ++++
 stdlib/tst-makecontext3.c |   62 ++++++++++++++++++++++++---------------------
 2 files changed, 39 insertions(+), 29 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources



More information about the Glibc-cvs mailing list