at v2.6.12 30 lines 688 B view raw
1#include <stdio.h> 2#include <kernel-offsets.h> 3 4void print_ptr(char *name, char *type, int offset) 5{ 6 printf("#define %s(task) ((%s *) &(((char *) (task))[%d]))\n", name, type, 7 offset); 8} 9 10void print(char *name, char *type, int offset) 11{ 12 printf("#define %s(task) *((%s *) &(((char *) (task))[%d]))\n", name, type, 13 offset); 14} 15 16int main(int argc, char **argv) 17{ 18 printf("/*\n"); 19 printf(" * Generated by mk_task\n"); 20 printf(" */\n"); 21 printf("\n"); 22 printf("#ifndef __TASK_H\n"); 23 printf("#define __TASK_H\n"); 24 printf("\n"); 25 print_ptr("TASK_REGS", "union uml_pt_regs", TASK_REGS); 26 print("TASK_PID", "int", TASK_PID); 27 printf("\n"); 28 printf("#endif\n"); 29 return(0); 30}