summaryrefslogtreecommitdiffstats
path: root/plugins-root/pst3.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-root/pst3.c')
-rw-r--r--plugins-root/pst3.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/plugins-root/pst3.c b/plugins-root/pst3.c
index b275a6b..8513656 100644
--- a/plugins-root/pst3.c
+++ b/plugins-root/pst3.c
@@ -8,7 +8,7 @@
8* Description: 8* Description:
9* 9*
10* This file contains the pst3 executable. This is a replacement ps command 10* This file contains the pst3 executable. This is a replacement ps command
11* for Solaris to get output which provides a long argument listing, which 11* for Solaris to get output which provides a long argument listing, which
12* is not possible with the standard ps command (due to truncation). /usr/ucb/ps 12* is not possible with the standard ps command (due to truncation). /usr/ucb/ps
13* also has issues where some fields run into each other. 13* also has issues where some fields run into each other.
14* 14*
@@ -17,7 +17,7 @@
17* 17*
18* Originally written by R.W.Ingraham 18* Originally written by R.W.Ingraham
19* Rewritten by Duncan Ferguson (Altinity Ltd, June 2008) 19* Rewritten by Duncan Ferguson (Altinity Ltd, June 2008)
20* The rewrite was necessary as /dev/kmem is not available within 20* The rewrite was necessary as /dev/kmem is not available within
21* non-global zones on Solaris 10 21* non-global zones on Solaris 10
22* 22*
23* Details for rewrite came from 23* Details for rewrite came from
@@ -48,7 +48,7 @@
48#include <fcntl.h> 48#include <fcntl.h>
49#include <procfs.h> 49#include <procfs.h>
50#include <errno.h> 50#include <errno.h>
51#include <sys/types32.h> 51#include <sys/types32.h>
52 52
53/* 53/*
54 * Constants 54 * Constants
@@ -125,8 +125,8 @@ int main (int argc, char **argv)
125 char *procname; 125 char *procname;
126 char *ptr; 126 char *ptr;
127 int argslen; 127 int argslen;
128 uintptr_t args_addr;; 128 uintptr_t args_addr;;
129 uintptr_t *args_vecs;; 129 uintptr_t *args_vecs;;
130 int args_count; 130 int args_count;
131 131
132 if(proc->d_name[0] == '.') 132 if(proc->d_name[0] == '.')
@@ -146,8 +146,8 @@ try_again:
146 close(ps_fd); 146 close(ps_fd);
147 close(as_fd); 147 close(as_fd);
148 if(err == EAGAIN) goto try_again; 148 if(err == EAGAIN) goto try_again;
149 if(err != ENOENT) 149 if(err != ENOENT)
150 fprintf(stderr, "%s: read() on %s: %s\n", szProg, 150 fprintf(stderr, "%s: read() on %s: %s\n", szProg,
151 ps_name, strerror(err)); 151 ps_name, strerror(err));
152 continue; 152 continue;
153 } 153 }
@@ -185,7 +185,7 @@ try_again:
185 ); 185 );
186 free(procname); 186 free(procname);
187 187
188 /* 188 /*
189 * and now for the command line stuff 189 * and now for the command line stuff
190 */ 190 */
191 191
@@ -195,18 +195,18 @@ try_again:
195 195
196 if(psinfo.pr_dmodel == PR_MODEL_NATIVE) { 196 if(psinfo.pr_dmodel == PR_MODEL_NATIVE) {
197 /* this process matches target process */ 197 /* this process matches target process */
198 pread(as_fd,args_vecs, args_count * sizeof(uintptr_t), 198 pread(as_fd,args_vecs, args_count * sizeof(uintptr_t),
199 args_addr); 199 args_addr);
200 } else { 200 } else {
201 /* this process is 64bit, target process is 32 bit*/ 201 /* this process is 64bit, target process is 32 bit*/
202 caddr32_t *args_vecs32 = (caddr32_t *)args_vecs; 202 caddr32_t *args_vecs32 = (caddr32_t *)args_vecs;
203 pread(as_fd,args_vecs32,args_count * sizeof(caddr32_t), 203 pread(as_fd,args_vecs32,args_count * sizeof(caddr32_t),
204 args_addr); 204 args_addr);
205 for (i=args_count-1;i>=0;--i) 205 for (i=args_count-1;i>=0;--i)
206 args_vecs[i]=args_vecs32[i]; 206 args_vecs[i]=args_vecs32[i];
207 } 207 }
208 208
209 /* 209 /*
210 * now read in the args - if what we read in fills buffer 210 * now read in the args - if what we read in fills buffer
211 * resize buffer and reread that bit again 211 * resize buffer and reread that bit again
212 */ 212 */