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