1/* Copyright (C) 2001-2014 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#include <sys/user.h>
34
35__BEGIN_DECLS
36
37/* Type for a general-purpose register. */
38#ifdef __x86_64__
39__extension__ typedef unsigned long long elf_greg_t;
40#else
41typedef unsigned long elf_greg_t;
42#endif
43
44/* And the whole bunch of them. We could have used `struct
45 user_regs_struct' directly in the typedef, but tradition says that
46 the register set is an array, which does have some peculiar
47 semantics, so leave it that way. */
48#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
49typedef elf_greg_t elf_gregset_t[ELF_NGREG];
50
51#ifndef __x86_64__
52/* Register set for the floating-point registers. */
53typedef struct user_fpregs_struct elf_fpregset_t;
54
55/* Register set for the extended floating-point registers. Includes
56 the Pentium III SSE registers in addition to the classic
57 floating-point stuff. */
58typedef struct user_fpxregs_struct elf_fpxregset_t;
59#else
60/* Register set for the extended floating-point registers. Includes
61 the Pentium III SSE registers in addition to the classic
62 floating-point stuff. */
63typedef struct user_fpregs_struct elf_fpregset_t;
64#endif
65
66/* Signal info. */
67struct elf_siginfo
68 {
69 int si_signo; /* Signal number. */
70 int si_code; /* Extra code. */
71 int si_errno; /* Errno. */
72 };
73
74
75/* Definitions to generate Intel SVR4-like core files. These mostly
76 have the same names as the SVR4 types with "elf_" tacked on the
77 front to prevent clashes with Linux definitions, and the typedef
78 forms have been avoided. This is mostly like the SVR4 structure,
79 but more Linuxy, with things that Linux does not support and which
80 GDB doesn't really use excluded. */
81
82struct elf_prstatus
83 {
84 struct elf_siginfo pr_info; /* Info associated with signal. */
85 short int pr_cursig; /* Current signal. */
86 unsigned long int pr_sigpend; /* Set of pending signals. */
87 unsigned long int pr_sighold; /* Set of held signals. */
88 __pid_t pr_pid;
89 __pid_t pr_ppid;
90 __pid_t pr_pgrp;
91 __pid_t pr_sid;
92 struct timeval pr_utime; /* User time. */
93 struct timeval pr_stime; /* System time. */
94 struct timeval pr_cutime; /* Cumulative user time. */
95 struct timeval pr_cstime; /* Cumulative system time. */
96 elf_gregset_t pr_reg; /* GP registers. */
97 int pr_fpvalid; /* True if math copro being used. */
98 };
99
100
101#define ELF_PRARGSZ (80) /* Number of chars for args. */
102
103struct elf_prpsinfo
104 {
105 char pr_state; /* Numeric process state. */
106 char pr_sname; /* Char for pr_state. */
107 char pr_zomb; /* Zombie. */
108 char pr_nice; /* Nice val. */
109 unsigned long int pr_flag; /* Flags. */
110#if __WORDSIZE == 32
111 unsigned short int pr_uid;
112 unsigned short int pr_gid;
113#else
114 unsigned int pr_uid;
115 unsigned int pr_gid;
116#endif
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. */
129typedef void *psaddr_t;
130
131/* Register sets. Linux has different names. */
132typedef elf_gregset_t prgregset_t;
133typedef elf_fpregset_t prfpregset_t;
134
135/* We don't have any differences between processes and threads,
136 therefore have only one PID type. */
137typedef __pid_t lwpid_t;
138
139/* Process status and info. In the end we do provide typedefs for them. */
140typedef struct elf_prstatus prstatus_t;
141typedef struct elf_prpsinfo prpsinfo_t;
142
143__END_DECLS
144
145#endif /* sys/procfs.h */
146