Simple coroutine library / objects in plain C Snapshot
Functions
stacks.c File Reference
#include <sys/mman.h>
#include <unistd.h>
#include "stacks.h"
#include <stdio.h>

Go to the source code of this file.

Functions

STACK_DIR stack_dir (int *ptr)
int stack_direction ()
int STACKS_init (STACKS *stack, int num_stacks, int pages_per_stack)
int STACKS_destroy (STACKS *stack)
void * STACKS_get (STACKS *stack, STACK_ENTRY **rentry)
int STACKS_release (STACK_ENTRY *entry)

Function Documentation

STACK_DIR stack_dir ( int *  ptr)

Definition at line 6 of file stacks.c.

{
   int a = 0;
   if ((size_t) &a < (size_t) ptr ) {
     return STACK_DIR_GROWING_DOWN; 
   }
   return STACK_DIR_GROWING_UP;
}
int stack_direction ( )

Definition at line 15 of file stacks.c.

{
  int a = 0;

  return stack_dir( & a );
}