aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-07 20:39:34 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-07 20:39:34 +0000
commit232fdf8cab8d30925b2829446e6033e9c3955956 (patch)
treee2bacc9275c4f1d2a1125eae6badf85d4f6551ea /stdlib
parent4ee87eccd95908f1804412f274ef8595fff376b7 (diff)
downloadglibc-232fdf8cab8d30925b2829446e6033e9c3955956.tar
glibc-232fdf8cab8d30925b2829446e6033e9c3955956.tar.gz
glibc-232fdf8cab8d30925b2829446e6033e9c3955956.tar.bz2
glibc-232fdf8cab8d30925b2829446e6033e9c3955956.zip
Update.
* stdlib/tst-setcontext.c (main): Add a test for setcontext.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/tst-setcontext.c16
1 files changed, 16 insertions, 0 deletions
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];