gen-offsets.c 656 B

123456789101112131415161718192021222324252627282930
  1. #include <stdio.h>
  2. #include <stddef.h>
  3. #include <ucontext.h>
  4. #define UC(N,X) \
  5. printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))
  6. #define SC(N,X) \
  7. printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))
  8. int
  9. main (void)
  10. {
  11. printf (
  12. "/* Linux-specific definitions: */\n\n"
  13. "/* Define various structure offsets to simplify cross-compilation. */\n\n"
  14. "/* Offsets for MIPS Linux \"ucontext_t\": */\n\n");
  15. UC ("FLAGS", uc_flags);
  16. UC ("LINK", uc_link);
  17. UC ("STACK", uc_stack);
  18. UC ("MCONTEXT", uc_mcontext);
  19. UC ("SIGMASK", uc_sigmask);
  20. UC ("MCONTEXT_GREGS", uc_mcontext.gregs);
  21. return 0;
  22. }