1 /* Copyright (C) 2011-2018 Free Software Foundation, Inc. 2 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 8 The GNU C Library is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 Lesser General Public License for more details. 12 13 You should have received a copy of the GNU Lesser General Public 14 License along with the GNU C Library. If not, see 15 <http://www.gnu.org/licenses/>. */ 16 17 #ifndef _SYS_PROCFS_H 18 #define _SYS_PROCFS_H 1 19 20 /* This is somewhat modelled after the file of the same name on SVR4 21 systems. It provides a definition of the core file format for ELF 22 used on Linux. It doesn't have anything to do with the /proc file 23 system, even though Linux has one. 24 25 Anyway, the whole purpose of this file is for GDB and GDB only. 26 Don't read too much into it. Don't use it for anything other than 27 GDB unless you know what you are doing. */ 28 29 #include <features.h> 30 #include <sys/time.h> 31 #include <sys/types.h> 32 33 #define __need_int_reg_t 34 #include <arch/abi.h> 35 36 __BEGIN_DECLS 37 38 /* Type for a general-purpose register. */ 39 typedef __uint_reg_t elf_greg_t; 40 41 /* And the whole bunch of them. We could have used `struct pt_regs' 42 from <asm/ptrace.h> directly in the typedef, but tradition says that 43 the register set is an array, which does have some peculiar 44 semantics, so leave it that way. */ 45 #define ELF_NGREG 64 46 #define ELF_NFPREG 0 47 typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 48 typedef elf_greg_t elf_fpregset_t[ELF_NFPREG]; 49 50 /* Signal info. */ 51 struct elf_siginfo 52 { 53 int si_signo; /* Signal number. */ 54 int si_code; /* Extra code. */ 55 int si_errno; /* Errno. */ 56 }; 57 58 59 /* Definitions to generate Intel SVR4-like core files. These mostly 60 have the same names as the SVR4 types with "elf_" tacked on the 61 front to prevent clashes with Linux definitions, and the typedef 62 forms have been avoided. This is mostly like the SVR4 structure, 63 but more Linuxy, with things that Linux does not support and which 64 GDB doesn't really use excluded. */ 65 66 struct elf_prstatus 67 { 68 struct elf_siginfo pr_info; /* Info associated with signal. */ 69 short int pr_cursig; /* Current signal. */ 70 unsigned long int pr_sigpend; /* Set of pending signals. */ 71 unsigned long int pr_sighold; /* Set of held signals. */ 72 __pid_t pr_pid; 73 __pid_t pr_ppid; 74 __pid_t pr_pgrp; 75 __pid_t pr_sid; 76 struct timeval pr_utime; /* User time. */ 77 struct timeval pr_stime; /* System time. */ 78 struct timeval pr_cutime; /* Cumulative user time. */ 79 struct timeval pr_cstime; /* Cumulative system time. */ 80 elf_gregset_t pr_reg; /* GP registers. */ 81 int pr_fpvalid; /* True if math copro being used. */ 82 }; 83 84 85 #define ELF_PRARGSZ (80) /* Number of chars for args. */ 86 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 unsigned int pr_uid; 95 unsigned int pr_gid; 96 int pr_pid, pr_ppid, pr_pgrp, pr_sid; 97 /* Lots missing */ 98 char pr_fname[16]; /* Filename of executable. */ 99 char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ 100 }; 101 102 103 /* The rest of this file provides the types for emulation of the 104 Solaris <proc_service.h> interfaces that should be implemented by 105 users of libthread_db. */ 106 107 /* Addresses. */ 108 typedef void *psaddr_t; 109 110 /* Register sets. Linux has different names. */ 111 typedef elf_gregset_t prgregset_t; 112 113 /* Provide dummy declaration here; we don't have FP registers. */ 114 typedef elf_fpregset_t prfpregset_t; 115 116 /* We don't have any differences between processes and threads, 117 therefore have only one PID type. */ 118 typedef __pid_t lwpid_t; 119 120 /* Process status and info. In the end we do provide typedefs for them. */ 121 typedef struct elf_prstatus prstatus_t; 122 typedef struct elf_prpsinfo prpsinfo_t; 123 124 __END_DECLS 125 126 #endif /* sys/procfs.h */ 127