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
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
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 */
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 */
64 typedef struct lx_amd64_regs
{
80 uint64_t lxr_orig_rax
;
94 typedef struct lx_ia32_regs
{
106 uint32_t lxr_orig_ax
;
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 */
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 */
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 */
165 #define LTIME_TO_TIMESPEC(dst, src) \
166 (dst).tv_sec = (src).tv_sec; \
167 (dst).tv_nsec = (src).tv_usec * 1000;
173 #endif /* _PCORE_LINUX_H */