| 1 |
/* <sys/procfs.h> -- data structures describing ELF core file formats |
| 2 |
Copyright (C) 2002, 2015, 2016 Free Software Foundation, Inc. |
| 3 |
This file is part of the GNU C Library. |
| 4 |
|
| 5 |
The GNU C Library is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU Lesser General Public |
| 7 |
License as published by the Free Software Foundation; either |
| 8 |
version 2.1 of the License, or (at your option) any later version. |
| 9 |
|
| 10 |
The GNU C Library is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
Lesser General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU Lesser General Public |
| 16 |
License along with the GNU C Library; if not, write to the Free |
| 17 |
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 18 |
02111-1307 USA. */ |
| 19 |
|
| 20 |
#ifndef _SYS_PROCFS_H |
| 21 |
#define _SYS_PROCFS_H 1 |
| 22 |
|
| 23 |
/* This poorly-named file describes the format of the note segments in ELF |
| 24 |
core files. It doesn't have anything to do with a `/proc' file system. |
| 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 <inttypes.h> |
| 32 |
#include <mach/std_types.h> |
| 33 |
#include <sys/types.h> |
| 34 |
#include <sys/time.h> |
| 35 |
#include <ucontext.h> |
| 36 |
|
| 37 |
__BEGIN_DECLS |
| 38 |
|
| 39 |
/* This structure gives some general information about the process, things |
| 40 |
that `ps' would tell you (hence the name). We have chosen the names and |
| 41 |
the layout of the structure to coincide with the Solaris 8 definition. |
| 42 |
The `file' program happens to know to look at 84 bytes into this |
| 43 |
structure for the 16-byte `pr_fname' member, so we don't disappoint it. */ |
| 44 |
#define ELF_PRARGSZ (80) /* Number of chars of argument list saved. */ |
| 45 |
struct elf_psinfo |
| 46 |
{ |
| 47 |
int pr_flag; /* Meaningless flag bits. */ |
| 48 |
int pr_nlwp; /* Number of threads in this process. */ |
| 49 |
pid_t pr_pid; /* Process ID. */ |
| 50 |
pid_t pr_ppid; /* Parent's process ID. */ |
| 51 |
pid_t pr_pgid; /* Process group ID. */ |
| 52 |
pid_t pr_sid; /* Session ID. */ |
| 53 |
uid_t pr_uid, pr_euid; /* Real and effective UID (first one). */ |
| 54 |
gid_t pr_gid, pr_egid; /* Real and effective GID (first one). */ |
| 55 |
size_t pr_size; /* Virtual memory size of process (KB). */ |
| 56 |
size_t pr_rssize; /* Resident set size of process (KB). */ |
| 57 |
uint16_t pr_pctcpu; /* % of CPU used by all threads. */ |
| 58 |
uint16_t pr_pctmem; /* % of virtual memory used by process. */ |
| 59 |
struct timespec pr_start; /* Date & time of task creation. */ |
| 60 |
struct timespec pr_time; /* CPU time used by this process. */ |
| 61 |
struct timespec pr_ctime; /* CPU time used by dead children. */ |
| 62 |
uint32_t pr_reserved1[2]; /* Padding to place pr_psargs at offset 84. */ |
| 63 |
char pr_fname[16]; /* Initial part of executable file name. */ |
| 64 |
char pr_psargs[ELF_PRARGSZ]; /* Initial part of argument list. */ |
| 65 |
int pr_wstat; /* Zombie exit status (not really used). */ |
| 66 |
int pr_argc; /* The argument count at startup. */ |
| 67 |
vm_address_t pr_argv; /* Original argument vector address. */ |
| 68 |
vm_address_t pr_envp; /* Original environment vector address. */ |
| 69 |
}; |
| 70 |
typedef struct elf_psinfo psinfo_t; |
| 71 |
|
| 72 |
/* This structure also gives general information about the process. |
| 73 |
The Solaris version gives the status of "the representative thread", |
| 74 |
but GDB does not actually use this structure for anything but the PID. */ |
| 75 |
struct elf_pstatus |
| 76 |
{ |
| 77 |
int pr_flags; /* Meaningless flags bits. */ |
| 78 |
int pr_nlwp; /* Number of threads in this process. */ |
| 79 |
pid_t pr_pid; /* Process ID. */ |
| 80 |
pid_t pr_ppid; /* Parent's process ID. */ |
| 81 |
pid_t pr_pgid; /* Process group ID. */ |
| 82 |
pid_t pr_sid; /* Session ID. */ |
| 83 |
struct timespec pr_utime; /* User CPU time used by this process. */ |
| 84 |
struct timespec pr_stime; /* System CPU time used by this process. */ |
| 85 |
struct timespec pr_cutime; /* User CPU time used by dead children. */ |
| 86 |
struct timespec pr_cstime; /* System CPU time used by dead children. */ |
| 87 |
}; |
| 88 |
typedef struct elf_pstatus pstatus_t; |
| 89 |
|
| 90 |
/* Information about a signal, the signal that killed the process. */ |
| 91 |
struct elf_siginfo |
| 92 |
{ |
| 93 |
int si_signo; /* Signal number. */ |
| 94 |
int si_code; /* Extra code. */ |
| 95 |
int si_errno; /* Errno. */ |
| 96 |
}; |
| 97 |
|
| 98 |
typedef gregset_t prgregset_t; |
| 99 |
typedef fpregset_t prfpregset_t; |
| 100 |
|
| 101 |
/* This structure describes the state of one thread. GDB examines |
| 102 |
pr_cursig to see what killed the process, so those are set in the |
| 103 |
record for every thread. The `pr_lwpid' member contains a value |
| 104 |
that is unique among the threads in this code file, but otherwise |
| 105 |
meaningless. GDB examines that and the `pr_reg' and `pr_fpreg' |
| 106 |
members for the register state of the thread. */ |
| 107 |
struct elf_lwpstatus |
| 108 |
{ |
| 109 |
int pr_flags; /* Meaningless flags bits. */ |
| 110 |
int pr_lwpid; /* Identifies this thread from others. */ |
| 111 |
int pr_cursig; /* Signal that killed the thread. */ |
| 112 |
struct elf_siginfo pr_info; /* Details about the signal. */ |
| 113 |
prgregset_t pr_reg; /* State of thread's general registers. */ |
| 114 |
prfpregset_t pr_fpreg; /* State of its floating-point registers. */ |
| 115 |
}; |
| 116 |
typedef struct elf_lwpstatus lwpstatus_t; |
| 117 |
|
| 118 |
|
| 119 |
__END_DECLS |
| 120 |
|
| 121 |
#endif /* sys/procfs.h */ |