procfs.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _SYS_PROCFS_H
  16. #define _SYS_PROCFS_H 1
  17. /* This is somehow modelled after the file of the same name on SysVr4
  18. systems. It provides a definition of the core file format for ELF
  19. used on Linux. */
  20. #include <features.h>
  21. #include <signal.h>
  22. #include <sys/time.h>
  23. #include <sys/types.h>
  24. #include <sys/ucontext.h>
  25. #include <sys/user.h>
  26. #include <bits/wordsize.h>
  27. __BEGIN_DECLS
  28. #if __WORDSIZE == 64
  29. #define ELF_NGREG 36
  30. typedef struct
  31. {
  32. unsigned long pr_regs[32];
  33. unsigned long pr_fsr;
  34. unsigned long pr_gsr;
  35. unsigned long pr_fprs;
  36. } elf_fpregset_t;
  37. #else /* sparc32 */
  38. #define ELF_NGREG 38
  39. typedef struct
  40. {
  41. union
  42. {
  43. unsigned long pr_regs[32];
  44. double pr_dregs[16];
  45. } pr_fr;
  46. unsigned long __unused;
  47. unsigned long pr_fsr;
  48. unsigned char pr_qcnt;
  49. unsigned char pr_q_entrysize;
  50. unsigned char pr_en;
  51. unsigned int pr_q[64];
  52. } elf_fpregset_t;
  53. #endif /* sparc32 */
  54. typedef unsigned long elf_greg_t;
  55. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  56. struct elf_siginfo
  57. {
  58. int si_signo; /* Signal number. */
  59. int si_code; /* Extra code. */
  60. int si_errno; /* Errno. */
  61. };
  62. /* Definitions to generate Intel SVR4-like core files. These mostly
  63. have the same names as the SVR4 types with "elf_" tacked on the
  64. front to prevent clashes with linux definitions, and the typedef
  65. forms have been avoided. This is mostly like the SVR4 structure,
  66. but more Linuxy, with things that Linux does not support and which
  67. gdb doesn't really use excluded. Fields present but not used are
  68. marked with "XXX". */
  69. struct elf_prstatus
  70. {
  71. struct elf_siginfo pr_info; /* Info associated with signal. */
  72. short int pr_cursig; /* Current signal. */
  73. unsigned long int pr_sigpend; /* Set of pending signals. */
  74. unsigned long int pr_sighold; /* Set of held signals. */
  75. __pid_t pr_pid;
  76. __pid_t pr_ppid;
  77. __pid_t pr_pgrp;
  78. __pid_t pr_sid;
  79. struct timeval pr_utime; /* User time. */
  80. struct timeval pr_stime; /* System time. */
  81. struct timeval pr_cutime; /* Cumulative user time. */
  82. struct timeval pr_cstime; /* Cumulative system time. */
  83. elf_gregset_t pr_reg; /* GP registers. */
  84. int pr_fpvalid; /* True if math copro being used. */
  85. };
  86. #define ELF_PRARGSZ (80) /* Number of chars for args */
  87. struct elf_prpsinfo
  88. {
  89. char pr_state; /* Numeric process state. */
  90. char pr_sname; /* Char for pr_state. */
  91. char pr_zomb; /* Zombie. */
  92. char pr_nice; /* Nice val. */
  93. unsigned long int pr_flag; /* Flags. */
  94. #if __WORDSIZE == 64
  95. unsigned int pr_uid;
  96. unsigned int pr_gid;
  97. #else
  98. unsigned short int pr_uid;
  99. unsigned short int pr_gid;
  100. #endif
  101. int pr_pid, pr_ppid, pr_pgrp, pr_sid;
  102. /* Lots missing */
  103. char pr_fname[16]; /* Filename of executable. */
  104. char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
  105. };
  106. /* Addresses. */
  107. typedef void *psaddr_t;
  108. /* Register sets. Linux has different names. */
  109. typedef elf_gregset_t prgregset_t;
  110. typedef elf_fpregset_t prfpregset_t;
  111. /* We don't have any differences between processes and threads,
  112. therefore have only one PID type. */
  113. typedef __pid_t lwpid_t;
  114. typedef struct elf_prstatus prstatus_t;
  115. typedef struct elf_prpsinfo prpsinfo_t;
  116. #if __WORDSIZE == 64
  117. /* Provide 32-bit variants so that BFD can read 32-bit
  118. core files. */
  119. #define ELF_NGREG32 38
  120. typedef struct
  121. {
  122. union
  123. {
  124. unsigned int pr_regs[32];
  125. double pr_dregs[16];
  126. } pr_fr;
  127. unsigned int __unused;
  128. unsigned int pr_fsr;
  129. unsigned char pr_qcnt;
  130. unsigned char pr_q_entrysize;
  131. unsigned char pr_en;
  132. unsigned int pr_q[64];
  133. } elf_fpregset_t32;
  134. typedef unsigned int elf_greg_t32;
  135. typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG32];
  136. struct elf_prstatus32
  137. {
  138. struct elf_siginfo pr_info; /* Info associated with signal. */
  139. short int pr_cursig; /* Current signal. */
  140. unsigned int pr_sigpend; /* Set of pending signals. */
  141. unsigned int pr_sighold; /* Set of held signals. */
  142. __pid_t pr_pid;
  143. __pid_t pr_ppid;
  144. __pid_t pr_pgrp;
  145. __pid_t pr_sid;
  146. struct
  147. {
  148. int tv_sec, tv_usec;
  149. } pr_utime, /* User time. */
  150. pr_stime, /* System time. */
  151. pr_cutime, /* Cumulative user time. */
  152. pr_cstime; /* Cumulative system time. */
  153. elf_gregset_t32 pr_reg; /* GP registers. */
  154. int pr_fpvalid; /* True if math copro being used. */
  155. };
  156. struct elf_prpsinfo32
  157. {
  158. char pr_state; /* Numeric process state. */
  159. char pr_sname; /* Char for pr_state. */
  160. char pr_zomb; /* Zombie. */
  161. char pr_nice; /* Nice val. */
  162. unsigned int pr_flag; /* Flags. */
  163. unsigned short int pr_uid;
  164. unsigned short int pr_gid;
  165. int pr_pid, pr_ppid, pr_pgrp, pr_sid;
  166. /* Lots missing */
  167. char pr_fname[16]; /* Filename of executable. */
  168. char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
  169. };
  170. typedef elf_gregset_t32 prgregset32_t;
  171. typedef elf_fpregset_t32 prfpregset32_t;
  172. typedef struct elf_prstatus32 prstatus32_t;
  173. typedef struct elf_prpsinfo32 prpsinfo32_t;
  174. #endif /* sparc64 */
  175. __END_DECLS
  176. #endif /* sys/procfs.h */