procfs.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
  5. */
  6. #ifndef _SYS_PROCFS_H
  7. #define _SYS_PROCFS_H 1
  8. /* This is somewhat modelled after the file of the same name on SVR4
  9. systems. It provides a definition of the core file format for ELF
  10. used on Linux. It doesn't have anything to do with the /proc file
  11. system, even though Linux has one.
  12. Anyway, the whole purpose of this file is for GDB and GDB only.
  13. Don't read too much into it. Don't use it for anything other than
  14. GDB unless you know what you are doing. */
  15. #include <features.h>
  16. #include <sys/time.h>
  17. #include <sys/types.h>
  18. #include <sys/user.h>
  19. #include <asm/ptrace.h>
  20. __BEGIN_DECLS
  21. /* Type for a general-purpose register. */
  22. typedef unsigned long elf_greg_t;
  23. #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
  24. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  25. typedef struct { } elf_fpregset_t;
  26. /* Signal info. */
  27. struct elf_siginfo
  28. {
  29. int si_signo; /* Signal number. */
  30. int si_code; /* Extra code. */
  31. int si_errno; /* Errno. */
  32. };
  33. /* Definitions to generate Intel SVR4-like core files. These mostly
  34. have the same names as the SVR4 types with "elf_" tacked on the
  35. front to prevent clashes with Linux definitions, and the typedef
  36. forms have been avoided. This is mostly like the SVR4 structure,
  37. but more Linuxy, with things that Linux does not support and which
  38. GDB doesn't really use excluded. */
  39. struct elf_prstatus
  40. {
  41. struct elf_siginfo pr_info; /* Info associated with signal. */
  42. short int pr_cursig; /* Current signal. */
  43. unsigned long int pr_sigpend; /* Set of pending signals. */
  44. unsigned long int pr_sighold; /* Set of held signals. */
  45. __pid_t pr_pid;
  46. __pid_t pr_ppid;
  47. __pid_t pr_pgrp;
  48. __pid_t pr_sid;
  49. struct timeval pr_utime; /* User time. */
  50. struct timeval pr_stime; /* System time. */
  51. struct timeval pr_cutime; /* Cumulative user time. */
  52. struct timeval pr_cstime; /* Cumulative system time. */
  53. elf_gregset_t pr_reg; /* GP registers. */
  54. int pr_fpvalid; /* True if math copro being used. */
  55. };
  56. #define ELF_PRARGSZ (80) /* Number of chars for args. */
  57. struct elf_prpsinfo
  58. {
  59. char pr_state; /* Numeric process state. */
  60. char pr_sname; /* Char for pr_state. */
  61. char pr_zomb; /* Zombie. */
  62. char pr_nice; /* Nice val. */
  63. unsigned long int pr_flag; /* Flags. */
  64. unsigned short int pr_uid;
  65. unsigned short int pr_gid;
  66. int pr_pid, pr_ppid, pr_pgrp, pr_sid;
  67. /* Lots missing */
  68. char pr_fname[16]; /* Filename of executable. */
  69. char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
  70. };
  71. /* The rest of this file provides the types for emulation of the
  72. Solaris <proc_service.h> interfaces that should be implemented by
  73. users of libthread_db. */
  74. /* Addresses. */
  75. typedef void *psaddr_t;
  76. /* Register sets. Linux has different names. */
  77. typedef elf_gregset_t prgregset_t;
  78. typedef elf_fpregset_t prfpregset_t;
  79. /* We don't have any differences between processes and threads,
  80. therefore have only one PID type. */
  81. typedef __pid_t lwpid_t;
  82. /* Process status and info. In the end we do provide typedefs for them. */
  83. typedef struct elf_prstatus prstatus_t;
  84. typedef struct elf_prpsinfo prpsinfo_t;
  85. __END_DECLS
  86. #endif /* sys/procfs.h */