Back to index

glibc  2.9
Defines | Functions | Variables
tst-makecontext.c File Reference
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <ucontext.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

void cf (int i)
int do_test (void)

Variables

ucontext_t ucp
char st1 [8192]
__thread int thr
int somevar = -76
long othervar = -78L

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 69 of file tst-makecontext.c.


Function Documentation

void cf ( int  i)

Definition at line 32 of file tst-makecontext.c.

{
  if (i != othervar || thr != 94)
    {
      printf ("i %d thr %d\n", i, thr);
      exit (1);
    }
  exit (0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int do_test ( void  )

Definition at line 43 of file tst-makecontext.c.

{
  if (getcontext (&ucp) != 0)
    {
      if (errno == ENOSYS)
       {
         puts ("context handling not supported");
         return 0;
       }

      puts ("getcontext failed");
      return 1;
    }
  thr = 94;
  ucp.uc_link = NULL;
  ucp.uc_stack.ss_sp = st1;
  ucp.uc_stack.ss_size = sizeof st1;
  makecontext (&ucp, (void (*) (void)) cf, 1, somevar - 2);
  if (setcontext (&ucp) != 0)
    {
      puts ("setcontext failed");
      return 1;
    }
  return 2;
}

Here is the call graph for this function:


Variable Documentation

long othervar = -78L

Definition at line 29 of file tst-makecontext.c.

int somevar = -76

Definition at line 28 of file tst-makecontext.c.

char st1[8192]

Definition at line 25 of file tst-makecontext.c.

__thread int thr

Definition at line 26 of file tst-makecontext.c.

Definition at line 24 of file tst-makecontext.c.