1 /* Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _SYS_PROCFS_H 19 #define _SYS_PROCFS_H 1 20 21 /* This is somewhat modelled after the file of the same name on SVR4 22 systems. It provides a definition of the core file format for ELF 23 used on Linux. It doesn't have anything to do with the /proc file 24 system, even though Linux has one. 25 26 Anyway, the whole purpose of this file is for GDB and GDB only. 27 Don't read too much into it. Don't use it for anything other than 28 GDB unless you know what you are doing. */ 29 30 #include <features.h> 31 #include <sys/time.h> 32 #include <sys/types.h> 33 34 35 /* Type for a general-purpose register. */ 36 #ifndef ELF_GREG_T 37 #define ELF_GREG_T 38 typedef unsigned long elf_greg_t; 39 #endif 40 41 /* This is exactly the same as `struct pt_regs' in the kernel. */ 42 struct elf_gregset 43 { 44 elf_greg_t gpr[32]; /* General purpose registers. */ 45 46 elf_greg_t pc; /* program counter */ 47 elf_greg_t psw; /* program status word */ 48 elf_greg_t ear; /* Exception address register */ 49 elf_greg_t esr; /* Excep[tion Status Register */ 50 elf_greg_t fsr; /* FPU Status register */ 51 52 elf_greg_t kernel_mode; /* 1 if in `kernel mode', 0 if user mode */ 53 elf_greg_t single_step; /* 1 if in single step mode */ 54 }; 55 56 #ifndef ELF_NGREG 57 #define ELF_NGREG (sizeof (struct elf_gregset) / sizeof(elf_greg_t)) 58 #endif 59 60 #ifndef ELF_GREGSET_T 61 #define ELF_GREGSET_T 62 typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 63 #endif 64 65 /* Register set for the floating-point registers. */ 66 #ifndef ELF_FPREGSET_T 67 #define ELF_FPREGSET_T 68 typedef elf_greg_t elf_fpregset_t; 69 #endif 70 71 struct elf_siginfo 72 { 73 int si_signo; /* signal number */ 74 int si_code; /* extra code */ 75 int si_errno; /* errno */ 76 }; 77 78 79 /* 80 * Definitions to generate Intel SVR4-like core files. 81 * These mostly have the same names as the SVR4 types with "elf_" 82 * tacked on the front to prevent clashes with linux definitions, 83 * and the typedef forms have been avoided. This is mostly like 84 * the SVR4 structure, but more Linuxy, with things that Linux does 85 * not support and which gdb doesn't really use excluded. 86 * Fields present but not used are marked with "XXX". 87 */ 88 struct elf_prstatus 89 { 90 struct elf_siginfo pr_info; /* Info associated with signal */ 91 short pr_cursig; /* Current signal */ 92 unsigned long pr_sigpend; /* Set of pending signals */ 93 unsigned long pr_sighold; /* Set of held signals */ 94 __pid_t pr_pid; 95 __pid_t pr_ppid; 96 __pid_t pr_pgrp; 97 __pid_t pr_sid; 98 struct timeval pr_utime; /* User time */ 99 struct timeval pr_stime; /* System time */ 100 struct timeval pr_cutime; /* Cumulative user time */ 101 struct timeval pr_cstime; /* Cumulative system time */ 102 elf_gregset_t pr_reg; /* GP registers */ 103 int pr_fpvalid; /* True if math co-processor being used. */ 104 }; 105 106 #define ELF_PRARGSZ (80) /* Number of chars for args */ 107 108 struct elf_prpsinfo 109 { 110 char pr_state; /* numeric process state */ 111 char pr_sname; /* char for pr_state */ 112 char pr_zomb; /* zombie */ 113 char pr_nice; /* nice val */ 114 unsigned long pr_flag; /* flags */ 115 unsigned short int pr_uid; 116 unsigned short int pr_gid; 117 int pr_pid, pr_ppid, pr_pgrp, pr_sid; 118 /* Lots missing */ 119 char pr_fname[16]; /* filename of executable */ 120 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ 121 }; 122 123 124 /* The rest of this file provides the types for emulation of the 125 Solaris <proc_service.h> interfaces that should be implemented by 126 users of libthread_db. */ 127 128 /* Addresses. */ 129 typedef void *psaddr_t; 130 131 /* Register sets. Linux has different names. */ 132 typedef elf_gregset_t prgregset_t; 133 typedef elf_fpregset_t prfpregset_t; 134 135 /* We don't have any differences between processes and threads, 136 therefore have only one PID type. */ 137 typedef __pid_t lwpid_t; 138 139 /* Process status and info. In the end we do provide typedefs for them. */ 140 typedef struct elf_prstatus prstatus_t; 141 typedef struct elf_prpsinfo prpsinfo_t; 142 143 144 #endif /* sys/procfs.h */ 145