• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/elements/genericProc/programs/qthread-1.4/include/osx_compat/taskimpl.h

00001 /* Copyright (c) 2005-2006 Russ Cox, MIT; see COPYRIGHT */
00002 #ifndef TASKIMPL_H
00003 #define TASKIMPL_H
00004 
00005 #ifdef HAVE_CONFIG_H
00006 # include <config.h>
00007 #endif
00008 
00009 /* HAS_UCONTEXT affects the include files on some systems (I think) */
00010 #if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) || (defined(__SVR4) && defined (__sun))
00011 #define HAS_UCONTEXT 1
00012 #endif
00013 
00014 #if defined(__APPLE__)
00015 #if !defined(_BSD_PPC_SETJMP_H_)
00016 #include <setjmp.h>
00017 #define HAS_UCONTEXT 1
00018 #endif
00019 #endif
00020 
00021 #if defined(__tile__)
00022 #ifdef HAVE_STDARG_H
00023 # include <stdarg.h>
00024 #endif
00025 #include <stddef.h>
00026 #include "tile-ucontext.h"
00027 #define NEEDTILEMAKECONTEXT
00028 #define NEEDSWAPCONTEXT
00029 #endif
00030 
00031 #if defined(__FreeBSD__) ||  defined(__APPLE__)
00032 
00033 #ifdef HAVE_STDARG_H
00034 # include <stdarg.h>
00035 #endif
00036 #include <errno.h>
00037 #ifdef HAVE_STDLIB_H
00038 # include <stdlib.h>
00039 #endif
00040 #ifdef HAVE_UNISTD_H
00041 # include <unistd.h>
00042 #endif
00043 #ifdef HAVE_STRING_H
00044 # include <string.h>
00045 #endif
00046 #if TIME_WITH_SYS_TIME
00047 # include <sys/time.h>
00048 # include <time.h>
00049 #else
00050 # if HAVE_SYS_TIME_H
00051 #  include <sys/time.h>
00052 # else
00053 #  include <time.h>
00054 # endif
00055 #endif
00056 #ifdef HAVE_SYS_TYPES_H
00057 # include <sys/types.h>
00058 #endif
00059 #ifdef HAVE_SYS_WAIT_H
00060 # include <sys/wait.h>
00061 #endif
00062 #ifdef HAVE_SCHED_H
00063 # include <sched.h>
00064 #endif
00065 #ifdef HAVE_SIGNAL_H
00066 # include <signal.h>
00067 #endif
00068 #ifdef HAVE_SYS_UTSNAME_H
00069 # include <sys/utsname.h>
00070 #endif
00071 #ifdef HAVE_INTTYPES_H
00072 # include <inttypes.h>
00073 #endif
00074 #ifdef HAVE_SYS_UCONTEXT_H
00075 # include <sys/ucontext.h>
00076 #endif
00077 typedef unsigned long ulong;
00078 
00079 #if defined(__FreeBSD__) && __FreeBSD__ < 5
00080 extern  int             getmcontext(mcontext_t*);
00081 extern  void            setmcontext(mcontext_t*);
00082 #define setcontext(u)   setmcontext(&(u)->uc_mcontext)
00083 #define getcontext(u)   getmcontext(&(u)->uc_mcontext)
00084 extern  int             swapcontext(ucontext_t*, ucontext_t*);
00085 extern  void            makecontext(ucontext_t*, void(*)(), int, ...);
00086 #endif
00087 
00088 #if defined(__APPLE__)
00089 #       define mcontext libthread_mcontext
00090 #       define mcontext_t libthread_mcontext_t
00091 #       define ucontext libthread_ucontext
00092 #       define ucontext_t libthread_ucontext_t
00093 #       if defined(__i386__) || defined(__x86_64__)
00094 #               include "386-ucontext.h"
00095 #       else
00096 #               include "power-ucontext.h"
00097 #       endif
00098 #endif
00099 
00100 #if defined(__OpenBSD__)
00101 #       define mcontext libthread_mcontext
00102 #       define mcontext_t libthread_mcontext_t
00103 #       define ucontext libthread_ucontext
00104 #       define ucontext_t libthread_ucontext_t
00105 #       if defined(__i386__) || defined(__x86_64__)
00106 #               include "386-ucontext.h"
00107 #       else
00108 #               include "power-ucontext.h"
00109 #       endif
00110 extern pid_t rfork_thread(int, void*, int(*)(void*), void*);
00111 #endif
00112 
00113 #if 0 &&  defined(__sun__)
00114 #       define mcontext libthread_mcontext
00115 #       define mcontext_t libthread_mcontext_t
00116 #       define ucontext libthread_ucontext
00117 #       define ucontext_t libthread_ucontext_t
00118 #       include "sparc-ucontext.h"
00119 #endif
00120 
00121 #if defined(__arm__)
00122 int getmcontext(mcontext_t*);
00123 void setmcontext(const mcontext_t*);
00124 #define setcontext(u)   setmcontext(&(u)->uc_mcontext)
00125 #define getcontext(u)   getmcontext(&(u)->uc_mcontext)
00126 #endif
00127 
00128 #if defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__))
00129 # define NEEDX86MAKECONTEXT
00130 # define NEEDSWAPCONTEXT
00131 # if defined(__x86_64__)
00132 #  define NEEDX86REGISTERARGS
00133 # endif
00134 #endif
00135 
00136 #if defined(__APPLE__) && (defined(__ppc__) || defined(__ppc64__))
00137 #define NEEDPOWERMAKECONTEXT
00138 #define NEEDSWAPCONTEXT
00139 #endif
00140 
00141 #if defined(__FreeBSD__) && defined(__i386__) && __FreeBSD__ < 5
00142 #define NEEDX86MAKECONTEXT
00143 #define NEEDSWAPCONTEXT
00144 #endif
00145 
00146 #endif
00147 #endif
00148 

Generated on Fri Oct 22 2010 11:02:24 for SST by  doxygen 1.7.1