TSP: The Transport Sample Protocol



Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

affinity.h

00001 #ifndef _AFFINITY_H
00002 #define _AFFINITY_H
00003 
00004 #include <sched.h>
00005 #include <unistd.h>
00006 #include <linux/unistd.h>
00007 #include <sys/syscall.h> 
00008 #include <sys/types.h> 
00009 
00010 #define _syscall3_pic(type,name,type1,arg1,type2,arg2,type3,arg3) \
00011 type name (type1 arg1,type2 arg2,type3 arg3) \
00012 { \
00013 long __res; \
00014 __asm__ volatile ( \
00015         "pushl %%ebx\n\t" \
00016         "movl %%eax,%%ebx\n\t" \
00017         "movl %1,%%eax\n\t" \
00018         "int $0x80\n\t" \
00019         "popl %%ebx" \
00020         : "=a" (__res) \
00021         : "i" (__NR_##name),"a" ((long)(arg1)),"c" ((long)(arg2)), "d" ((long)(arg3)) ); \
00022 __syscall_return(type,__res); \
00023 }
00024  
00025 
00026 
00027 /*
00028  * provide the proper syscall information if our libc is not yet updated.
00029  * It is suggested you check your kernel to make sure these are right for
00030  * your architecture.
00031  */
00032 //#ifndef __NR_sched_setaffinity
00033 
00034 #if defined(__i386__)
00035 #define __NR_sched_setaffinity  241
00036 #define __NR_sched_getaffinity  242
00037 #endif
00038 
00039 #if defined(__powerpc__)
00040 #define __NR_sched_setaffinity  223
00041 #define __NR_sched_getaffinity  222
00042 #endif
00043 
00044 _syscall3_pic(int, sched_setaffinity, pid_t, pid, unsigned int, len,
00045           unsigned long *, user_mask_ptr)
00046 _syscall3_pic(int, sched_getaffinity, pid_t, pid, unsigned int, len,
00047           unsigned long *, user_mask_ptr)
00048 
00049 //#endif /* __NR_sched_setaffinity */
00050 
00051 #endif /* _AFFINITY_H */
Framework Home Page.

Beware !! TSP wave is coming...