1 // Copyright 2012 Google LLC 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google LLC nor the names of its 14 // contributors may be used to endorse or promote products derived from 15 // this software without specific prior written permission. 16 // 17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29 #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_SYS_PROCFS_H 30 #define GOOGLE_BREAKPAD_COMMON_ANDROID_SYS_PROCFS_H 31 32 #ifdef __BIONIC_HAVE_SYS_PROCFS_H 33 34 #include_next <sys/procfs.h> 35 36 #else 37 38 #include <asm/ptrace.h> 39 #include <sys/cdefs.h> 40 #if defined (__mips__) 41 #include <sys/types.h> 42 #endif 43 #include <sys/user.h> 44 #include <unistd.h> 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif // __cplusplus 49 50 #if defined(__x86_64__) || defined(__aarch64__) 51 typedef unsigned long long elf_greg_t; 52 #else 53 typedef unsigned long elf_greg_t; 54 #endif 55 56 #ifdef __arm__ 57 #define ELF_NGREG (sizeof(struct user_regs) / sizeof(elf_greg_t)) 58 #elif defined(__aarch64__) 59 #define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t)) 60 #elif defined(__mips__) 61 #define ELF_NGREG 45 62 #else 63 #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t)) 64 #endif 65 66 typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 67 68 struct elf_siginfo { 69 int si_signo; 70 int si_code; 71 int si_errno; 72 }; 73 74 struct elf_prstatus { 75 struct elf_siginfo pr_info; 76 short pr_cursig; 77 unsigned long pr_sigpend; 78 unsigned long pr_sighold; 79 pid_t pr_pid; 80 pid_t pr_ppid; 81 pid_t pr_pgrp; 82 pid_t pd_sid; 83 struct timeval pr_utime; 84 struct timeval pr_stime; 85 struct timeval pr_cutime; 86 struct timeval pr_cstime; 87 elf_gregset_t pr_reg; 88 int pr_fpvalid; 89 }; 90 91 #define ELF_PRARGSZ 80 92 93 struct elf_prpsinfo { 94 char pr_state; 95 char pr_sname; 96 char pr_zomb; 97 char pr_nice; 98 unsigned long pr_flags; 99 #ifdef __x86_64__ 100 unsigned int pr_uid; 101 unsigned int pr_gid; 102 #elif defined(__mips__) 103 __kernel_uid_t pr_uid; 104 __kernel_gid_t pr_gid; 105 #else 106 unsigned short pr_uid; 107 unsigned short pr_gid; 108 #endif 109 int pr_pid; 110 int pr_ppid; 111 int pr_pgrp; 112 int pr_sid; 113 char pr_fname[16]; 114 char pr_psargs[ELF_PRARGSZ]; 115 }; 116 117 #ifdef __cplusplus 118 } // extern "C" 119 #endif // __cplusplus 120 121 #endif // __BIONIC_HAVE_SYS_PROCFS_H 122 123 #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_SYS_PROCFS_H 124