8828 udapl: value computed is not used
[unleashed.git] / usr / src / lib / libproc / common / Pcore_linux.h
blobf23934f27ff0f111c80ae4b92f92f49b40db6d39
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright (c) 2014, Joyent, Inc.
16 #ifndef _PCORE_LINUX_H
17 #define _PCORE_LINUX_H
20 * Note that these structures can end up in both a 32-bit and 64-bit libproc.
21 * Therefore, one should generally avoid using types whose size change between
22 * ILP32 and LP64 and instead use the correct fixed width type. eg. long should
23 * be int32_t and int64_t as appropriate to whether it's a 32-bit or 64-bit
24 * structure.
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
31 /* Process Information */
32 typedef struct lx_prpsinfo32 {
33 uint8_t pr_state; /* Numeric process state */
34 int8_t pr_sname; /* Char for pr_state */
35 uint8_t pr_zomb; /* Zombie */
36 int8_t pr_nice; /* Nice value */
37 uint32_t pr_flag; /* Flags */
38 uint16_t pr_uid; /* User ID */
39 uint16_t pr_gid; /* Group ID */
40 int32_t pr_pid; /* Process ID */
41 int32_t pr_ppid; /* Parent's process ID */
42 int32_t pr_pgrp; /* Group ID */
43 int32_t pr_sid; /* Session ID */
44 char pr_fname[16]; /* Filename of executable */
45 char pr_psargs[80]; /* Initial part of arg list */
46 } lx_prpsinfo32_t;
48 typedef struct lx_prpsinfo64 {
49 uint8_t pr_state; /* Numeric process state */
50 int8_t pr_sname; /* Char for pr_state */
51 uint8_t pr_zomb; /* Zombie */
52 int8_t pr_nice; /* Nice value */
53 uint64_t pr_flag; /* Flags */
54 uint32_t pr_uid; /* User ID */
55 uint32_t pr_gid; /* Group ID */
56 int32_t pr_pid; /* Process ID */
57 int32_t pr_ppid; /* Parent's process ID */
58 int32_t pr_pgrp; /* Group ID */
59 int32_t pr_sid; /* Session ID */
60 char pr_fname[16]; /* Filename of executable */
61 char pr_psargs[80]; /* Initial part of arg list */
62 } lx_prpsinfo64_t;
64 typedef struct lx_amd64_regs {
65 uint64_t lxr_r15;
66 uint64_t lxr_r14;
67 uint64_t lxr_r13;
68 uint64_t lxr_r12;
69 uint64_t lxr_rbp;
70 uint64_t lxr_rbx;
71 uint64_t lxr_r11;
72 uint64_t lxr_r10;
73 uint64_t lxr_r9;
74 uint64_t lxr_r8;
75 uint64_t lxr_rax;
76 uint64_t lxr_rcx;
77 uint64_t lxr_rdx;
78 uint64_t lxr_rsi;
79 uint64_t lxr_rdi;
80 uint64_t lxr_orig_rax;
81 uint64_t lxr_rip;
82 uint64_t lxr_cs;
83 uint64_t lxr_eflags;
84 uint64_t lxr_rsp;
85 uint64_t lxr_ss;
86 uint64_t lxr_fs_base;
87 uint64_t lxr_gs_base;
88 uint64_t lxr_ds;
89 uint64_t lxr_es;
90 uint64_t lxr_fs;
91 uint64_t lxr_gs;
92 } lx_amd64_regs_t;
94 typedef struct lx_ia32_regs {
95 uint32_t lxr_bx;
96 uint32_t lxr_cx;
97 uint32_t lxr_dx;
98 uint32_t lxr_si;
99 uint32_t lxr_di;
100 uint32_t lxr_bp;
101 uint32_t lxr_ax;
102 uint32_t lxr_ds;
103 uint32_t lxr_es;
104 uint32_t lxr_fs;
105 uint32_t lxr_gs;
106 uint32_t lxr_orig_ax;
107 uint32_t lxr_ip;
108 uint32_t lxr_cs;
109 uint32_t lxr_flags;
110 uint32_t lxr_sp;
111 uint32_t lxr_ss;
112 } lx_ia32_regs_t;
114 typedef struct lx_elf_siginfo {
115 int32_t si_signo; /* Signal number */
116 int32_t si_code; /* Extra code */
117 int32_t si_errno; /* Errno */
118 } lx_elf_siginfo_t;
120 typedef struct lx_elf_timeval32 {
121 int32_t tv_sec; /* Seconds */
122 int32_t tv_usec; /* Microseconds */
123 } lx_elf_timeval32_t;
125 typedef struct lx_elf_timeval64 {
126 int64_t tv_sec; /* Seconds */
127 int64_t tv_usec; /* Microseconds */
128 } lx_elf_timeval64_t;
130 /* Thread Information */
131 typedef struct lx_prstatus32 {
132 lx_elf_siginfo_t pr_info; /* Singal Info */
133 uint16_t pr_cursig; /* Current signal */
134 uint32_t pr_sigpend; /* Set of pending signals */
135 uint32_t pr_sighold; /* Set of held signals */
136 int32_t pr_pid; /* Process ID */
137 int32_t pr_ppid; /* Parent's process ID */
138 int32_t pr_pgrp; /* Group ID */
139 int32_t pr_sid; /* Session ID */
140 lx_elf_timeval32_t pr_utime; /* User time */
141 lx_elf_timeval32_t pr_stime; /* System time */
142 lx_elf_timeval32_t pr_cutime; /* Cumulative user time */
143 lx_elf_timeval32_t pr_cstime; /* Cumulative system time */
144 lx_ia32_regs_t pr_reg; /* CPU registers */
145 uint32_t pr_fpvalid; /* True if we have fp state */
146 } lx_prstatus32_t;
148 typedef struct lx_prstatus64 {
149 lx_elf_siginfo_t pr_info; /* Singal Info */
150 uint16_t pr_cursig; /* Current signal */
151 uint64_t pr_sigpend; /* Set of pending signals */
152 uint64_t pr_sighold; /* Set of held signals */
153 int32_t pr_pid; /* Process ID */
154 int32_t pr_ppid; /* Parent's process ID */
155 int32_t pr_pgrp; /* Group ID */
156 int32_t pr_sid; /* Session ID */
157 lx_elf_timeval64_t pr_utime; /* User time */
158 lx_elf_timeval64_t pr_stime; /* System time */
159 lx_elf_timeval64_t pr_cutime; /* Cumulative user time */
160 lx_elf_timeval64_t pr_cstime; /* Cumulative system time */
161 lx_amd64_regs_t pr_reg; /* CPU registers */
162 uint32_t pr_fpvalid; /* True if we have fp state */
163 } lx_prstatus64_t;
165 #define LTIME_TO_TIMESPEC(dst, src) \
166 (dst).tv_sec = (src).tv_sec; \
167 (dst).tv_nsec = (src).tv_usec * 1000;
169 #ifdef __cplusplus
171 #endif
173 #endif /* _PCORE_LINUX_H */