1 | /* Definitions for core files and libthread_db. Generic Linux version. |
2 | Copyright (C) 1996-2022 Free Software Foundation, Inc. |
3 | |
4 | This file is part of the GNU C Library. |
5 | |
6 | The GNU C Library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2.1 of the License, or (at your option) any later version. |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Lesser General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Lesser General Public |
17 | License along with the GNU C Library; if not, see |
18 | <https://www.gnu.org/licenses/>. */ |
19 | |
20 | #ifndef _SYS_PROCFS_H |
21 | #define _SYS_PROCFS_H 1 |
22 | |
23 | /* This is somewhat modelled after the file of the same name on SVR4 |
24 | systems. It provides a definition of the core file format for ELF |
25 | used on Linux. It doesn't have anything to do with the /proc file |
26 | system, even though Linux has one. |
27 | |
28 | Anyway, the whole purpose of this file is for GDB and GDB only. |
29 | Don't read too much into it. Don't use it for anything other than |
30 | GDB unless you know what you are doing. */ |
31 | |
32 | #include <features.h> |
33 | #include <sys/time.h> |
34 | #include <sys/types.h> |
35 | #include <sys/user.h> |
36 | |
37 | /* bits/procfs.h, provided by each architecture, must define |
38 | elf_gregset_t, elf_fpregset_t and any other architecture-specific |
39 | types needed. */ |
40 | #include <bits/procfs.h> |
41 | |
42 | /* bits/procfs-id.h must define __pr_uid_t and __pr_gid_t, the types |
43 | of pr_uid and pr_gid. */ |
44 | #include <bits/procfs-id.h> |
45 | |
46 | __BEGIN_DECLS |
47 | |
48 | /* Signal info. */ |
49 | struct elf_siginfo |
50 | { |
51 | int si_signo; /* Signal number. */ |
52 | int si_code; /* Extra code. */ |
53 | int si_errno; /* Errno. */ |
54 | }; |
55 | |
56 | /* Definitions to generate Intel SVR4-like core files. These mostly |
57 | have the same names as the SVR4 types with "elf_" tacked on the |
58 | front to prevent clashes with Linux definitions, and the typedef |
59 | forms have been avoided. This is mostly like the SVR4 structure, |
60 | but more Linuxy, with things that Linux does not support and which |
61 | GDB doesn't really use excluded. */ |
62 | |
63 | struct elf_prstatus |
64 | { |
65 | struct elf_siginfo pr_info; /* Info associated with signal. */ |
66 | short int pr_cursig; /* Current signal. */ |
67 | unsigned long int pr_sigpend; /* Set of pending signals. */ |
68 | unsigned long int pr_sighold; /* Set of held signals. */ |
69 | __pid_t pr_pid; |
70 | __pid_t pr_ppid; |
71 | __pid_t pr_pgrp; |
72 | __pid_t pr_sid; |
73 | struct timeval pr_utime; /* User time. */ |
74 | struct timeval pr_stime; /* System time. */ |
75 | struct timeval pr_cutime; /* Cumulative user time. */ |
76 | struct timeval pr_cstime; /* Cumulative system time. */ |
77 | elf_gregset_t pr_reg; /* GP registers. */ |
78 | int pr_fpvalid; /* True if math copro being used. */ |
79 | }; |
80 | |
81 | |
82 | #define ELF_PRARGSZ (80) /* Number of chars for args. */ |
83 | |
84 | struct elf_prpsinfo |
85 | { |
86 | char pr_state; /* Numeric process state. */ |
87 | char pr_sname; /* Char for pr_state. */ |
88 | char pr_zomb; /* Zombie. */ |
89 | char pr_nice; /* Nice val. */ |
90 | unsigned long int pr_flag; /* Flags. */ |
91 | __pr_uid_t pr_uid; |
92 | __pr_gid_t pr_gid; |
93 | int pr_pid, pr_ppid, pr_pgrp, pr_sid; |
94 | /* Lots missing */ |
95 | char pr_fname[16]; /* Filename of executable. */ |
96 | char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ |
97 | }; |
98 | |
99 | /* The rest of this file provides the types for emulation of the |
100 | Solaris <proc_service.h> interfaces that should be implemented by |
101 | users of libthread_db. */ |
102 | |
103 | /* Addresses. */ |
104 | typedef void *psaddr_t; |
105 | |
106 | #include <bits/procfs-prregset.h> |
107 | |
108 | /* Register sets. Linux has different names. */ |
109 | typedef __prgregset_t prgregset_t; |
110 | typedef __prfpregset_t prfpregset_t; |
111 | |
112 | /* We don't have any differences between processes and threads, |
113 | therefore have only one PID type. */ |
114 | typedef __pid_t lwpid_t; |
115 | |
116 | /* Process status and info. In the end we do provide typedefs for them. */ |
117 | typedef struct elf_prstatus prstatus_t; |
118 | typedef struct elf_prpsinfo prpsinfo_t; |
119 | |
120 | __END_DECLS |
121 | |
122 | /* On some architectures, provide other-ABI variants of the above |
123 | types. */ |
124 | #include <bits/procfs-extra.h> |
125 | |
126 | #endif /* sys/procfs.h. */ |
127 | |