From 232fdf8cab8d30925b2829446e6033e9c3955956 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 7 Apr 2001 20:39:34 +0000 Subject: [PATCH] Update. * stdlib/tst-setcontext.c (main): Add a test for setcontext. --- ChangeLog | 2 ++ NEWS | 3 +++ stdlib/tst-setcontext.c | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index dc1631e3ab..a2cd7b0380 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2001-04-07 Ulrich Drepper + * stdlib/tst-setcontext.c (main): Add a test for setcontext. + * sysdeps/unix/sysv/linux/i386/getcontext.S: New file. * sysdeps/unix/sysv/linux/i386/setcontext.S: New file. * sysdeps/unix/sysv/linux/i386/makecontext.S: New file. diff --git a/NEWS b/NEWS index f1dce8d578..44427eb3fa 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,9 @@ Version 2.2.3 * Martin Schwidefsky implemented the setcontext family of functions for Linux/S390. + +* Ulrich Drepper implemented the setcontext family + of functions for Linux/x86. Version 2.2.2 diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c index ed53f9e288..637c2c54bb 100644 --- a/stdlib/tst-setcontext.c +++ b/stdlib/tst-setcontext.c @@ -71,6 +71,8 @@ f2 (void) was_in_f2 = 1; } +volatile int global; + int main (void) { @@ -85,6 +87,20 @@ main (void) printf ("%s: getcontext: %m\n", __FUNCTION__); exit (1); } + + /* Play some tricks with this context. */ + if (++global == 1) + if (setcontext (&ctx[1]) != 0) + { + printf ("%s: setcontext: %m\n", __FUNCTION__); + exit (1); + } + if (global != 2) + { + printf ("%s: 'global' not incremented twice\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];