diff --git a/plugins-root/pst3.c b/plugins-root/pst3.c
index b275a6bce22bbb078668c097bf9fbbb3d670cd83..8ca52814854fa37ac55815ea82ae5045cc11ce7a 100644 (file)
--- a/plugins-root/pst3.c
+++ b/plugins-root/pst3.c
* Description:
*
* This file contains the pst3 executable. This is a replacement ps command
-* for Solaris to get output which provides a long argument listing, which
+* for Solaris to get output which provides a long argument listing, which
* is not possible with the standard ps command (due to truncation). /usr/ucb/ps
* also has issues where some fields run into each other.
*
*
* Originally written by R.W.Ingraham
* Rewritten by Duncan Ferguson (Altinity Ltd, June 2008)
-* The rewrite was necessary as /dev/kmem is not available within
+* The rewrite was necessary as /dev/kmem is not available within
* non-global zones on Solaris 10
*
* Details for rewrite came from
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <procfs.h>
-#include <errno.h>
-#include <sys/types32.h>
+#include <sys/types32.h>
/*
* Constants
char *procname;
char *ptr;
int argslen;
- uintptr_t args_addr;;
- uintptr_t *args_vecs;;
+ uintptr_t args_addr;;
+ uintptr_t *args_vecs;;
int args_count;
if(proc->d_name[0] == '.')
close(ps_fd);
close(as_fd);
if(err == EAGAIN) goto try_again;
- if(err != ENOENT)
- fprintf(stderr, "%s: read() on %s: %s\n", szProg,
+ if(err != ENOENT)
+ fprintf(stderr, "%s: read() on %s: %s\n", szProg,
ps_name, strerror(err));
continue;
}
);
free(procname);
- /*
+ /*
* and now for the command line stuff
*/
if(psinfo.pr_dmodel == PR_MODEL_NATIVE) {
/* this process matches target process */
- pread(as_fd,args_vecs, args_count * sizeof(uintptr_t),
+ pread(as_fd,args_vecs, args_count * sizeof(uintptr_t),
args_addr);
- } else {
+ } else {
/* this process is 64bit, target process is 32 bit*/
caddr32_t *args_vecs32 = (caddr32_t *)args_vecs;
- pread(as_fd,args_vecs32,args_count * sizeof(caddr32_t),
+ pread(as_fd,args_vecs32,args_count * sizeof(caddr32_t),
args_addr);
for (i=args_count-1;i>=0;--i)
args_vecs[i]=args_vecs32[i];
}
- /*
+ /*
* now read in the args - if what we read in fills buffer
* resize buffer and reread that bit again
*/
printf("\n");
}
+ (void) closedir(procdir);
+
return (0);
}