WARNS fixes: mainly constness and avoid comparing signed with
unsigned by making array indicies unsigned. Also note one or two unused parameters.
This commit is contained in:
parent
90972e91da
commit
889b35d148
@ -81,12 +81,12 @@ kinfo_proc_compare(const void *a, const void *b)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = ((struct kinfo_proc *)a)->ki_pid -
|
i = ((const struct kinfo_proc *)a)->ki_pid -
|
||||||
((struct kinfo_proc *)b)->ki_pid;
|
((const struct kinfo_proc *)b)->ki_pid;
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
return (i);
|
return (i);
|
||||||
i = ((struct kinfo_proc *)a)->ki_tid -
|
i = ((const struct kinfo_proc *)a)->ki_tid -
|
||||||
((struct kinfo_proc *)b)->ki_tid;
|
((const struct kinfo_proc *)b)->ki_tid;
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,8 @@ kinfo_proc_sort(struct kinfo_proc *kipp, int count)
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ch, i, interval, name[4], tmp;
|
int ch, interval, name[4], tmp;
|
||||||
|
unsigned int i;
|
||||||
struct kinfo_proc *kipp;
|
struct kinfo_proc *kipp;
|
||||||
size_t len;
|
size_t len;
|
||||||
long l;
|
long l;
|
||||||
@ -208,7 +209,7 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
free(kipp);
|
free(kipp);
|
||||||
}
|
}
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < (unsigned int)argc; i++) {
|
||||||
l = strtol(argv[i], &dummy, 10);
|
l = strtol(argv[i], &dummy, 10);
|
||||||
if (*dummy != '\0')
|
if (*dummy != '\0')
|
||||||
usage();
|
usage();
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "procstat.h"
|
#include "procstat.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
procstat_basic(pid_t pid, struct kinfo_proc *kipp)
|
procstat_basic(pid_t pid __unused, struct kinfo_proc *kipp)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!hflag)
|
if (!hflag)
|
||||||
|
@ -134,7 +134,8 @@ void
|
|||||||
procstat_files(pid_t pid, struct kinfo_proc *kipp)
|
procstat_files(pid_t pid, struct kinfo_proc *kipp)
|
||||||
{
|
{
|
||||||
struct kinfo_file *freep, *kif;
|
struct kinfo_file *freep, *kif;
|
||||||
int error, i, name[4];
|
int error, name[4];
|
||||||
|
unsigned int i;
|
||||||
const char *str;
|
const char *str;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ static int
|
|||||||
kinfo_kstack_compare(const void *a, const void *b)
|
kinfo_kstack_compare(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((struct kinfo_kstack *)a)->kkst_tid -
|
return ((const struct kinfo_kstack *)a)->kkst_tid -
|
||||||
((struct kinfo_kstack *)b)->kkst_tid;
|
((const struct kinfo_kstack *)b)->kkst_tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -129,7 +129,8 @@ procstat_kstack(pid_t pid, struct kinfo_proc *kipp, int kflag)
|
|||||||
struct kinfo_kstack *kkstp, *kkstp_free;
|
struct kinfo_kstack *kkstp, *kkstp_free;
|
||||||
struct kinfo_proc *kip, *kip_free;
|
struct kinfo_proc *kip, *kip_free;
|
||||||
char trace[KKST_MAXLEN];
|
char trace[KKST_MAXLEN];
|
||||||
int error, i, j, name[4];
|
int error, name[4];
|
||||||
|
unsigned int i, j;
|
||||||
size_t kip_len, kstk_len;
|
size_t kip_len, kstk_len;
|
||||||
|
|
||||||
if (!hflag)
|
if (!hflag)
|
||||||
|
@ -42,7 +42,8 @@ void
|
|||||||
procstat_threads(pid_t pid, struct kinfo_proc *kipp)
|
procstat_threads(pid_t pid, struct kinfo_proc *kipp)
|
||||||
{
|
{
|
||||||
struct kinfo_proc *kip;
|
struct kinfo_proc *kip;
|
||||||
int error, i, name[4];
|
int error, name[4];
|
||||||
|
unsigned int i;
|
||||||
const char *str;
|
const char *str;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
@ -38,10 +38,11 @@
|
|||||||
#include "procstat.h"
|
#include "procstat.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
procstat_vm(pid_t pid, struct kinfo_proc *kipp)
|
procstat_vm(pid_t pid, struct kinfo_proc *kipp __unused)
|
||||||
{
|
{
|
||||||
struct kinfo_vmentry *freep, *kve;
|
struct kinfo_vmentry *freep, *kve;
|
||||||
int error, i, name[4], ptrwidth;
|
int error, name[4], ptrwidth;
|
||||||
|
unsigned int i;
|
||||||
const char *str;
|
const char *str;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user