miscellaneous: silence a whole bunch of clang warnings
[ but most definitely not all of them by a long shot ] Reference(s): proc/diskstat.c:186:17: warning: unused variable 'is_disk' [-Wunused-variable] int retval, is_disk; ^ proc/namespace.c:110:1: warning: control may reach end of non-void function [-Wreturn-type] } ^ proc/readproc.c:1131:50: warning: address of array 'ent->d_name' will always evaluate to 'true' [-Wpointer-bo if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0; ~~~~~~^~~~~~ proc/readproc.c:1158:50: warning: address of array 'ent->d_name' will always evaluate to 'true' [-Wpointer-bo if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0; ~~~~~~^~~~~~ proc/sysinfo.c:45:12: warning: unused variable 'stat_fd' [-Wunused-variable] static int stat_fd = -1; ^ proc/sysinfo.c:49:12: warning: unused variable 'meminfo_fd' [-Wunused-variable] static int meminfo_fd = -1; ^ proc/sysinfo.c:51:12: warning: unused variable 'vminfo_fd' [-Wunused-variable] static int vminfo_fd = -1; ^ proc/sysinfo.c:53:12: warning: unused variable 'vm_min_free_fd' [-Wunused-variable] static int vm_min_free_fd = -1; ^ proc/uptime.c:157:12: warning: unused variable 'realseconds' [-Wunused-variable] time_t realseconds; ^ proc/uptime.c:158:16: warning: unused variable 'realtime' [-Wunused-variable] struct tm *realtime; ^ vmstat.c:574:20: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat] DSTAT(PROCPS_DISKSTAT_READ_TIME), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vmstat.c:578:20: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat] DSTAT(PROCPS_DISKSTAT_WRITE_TIME), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ watch.c:230:7: warning: variable 'endptr' is uninitialized when used here [-Wuninitialized] if (*endptr == '\0') set_ansi_attribute(0); /* [m treated as [0m */ ^~~~~~ Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
a6b50e59ef
commit
88daa89883
@ -183,7 +183,7 @@ PROCPS_EXPORT int procps_diskstat_new (
|
||||
PROCPS_EXPORT int procps_diskstat_read (
|
||||
struct procps_diskstat *info)
|
||||
{
|
||||
int retval, is_disk;
|
||||
int retval;
|
||||
char buf[DISKSTAT_LINE_LEN];
|
||||
char devname[DISKSTAT_NAME_LEN];
|
||||
struct procps_diskstat_dev *disk;
|
||||
|
@ -107,4 +107,5 @@ PROCPS_EXPORT int procps_ns_read_pid(
|
||||
else
|
||||
nsp->ns[i] = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1128,7 +1128,7 @@ static int simple_nextpid(PROCTAB *restrict const PT, proc_t *restrict const p)
|
||||
char *restrict const path = PT->path;
|
||||
for (;;) {
|
||||
ent = readdir(PT->procfs);
|
||||
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0;
|
||||
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name[0]))) return 0;
|
||||
if(likely(likely(*ent->d_name > '0') && likely(*ent->d_name <= '9'))) break;
|
||||
}
|
||||
p->tgid = strtoul(ent->d_name, NULL, 10);
|
||||
@ -1155,7 +1155,7 @@ static int simple_nexttid(PROCTAB *restrict const PT, const proc_t *restrict con
|
||||
}
|
||||
for (;;) {
|
||||
ent = readdir(PT->taskdir);
|
||||
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0;
|
||||
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name[0]))) return 0;
|
||||
if(likely(likely(*ent->d_name > '0') && likely(*ent->d_name <= '9'))) break;
|
||||
}
|
||||
t->tid = strtoul(ent->d_name, NULL, 10);
|
||||
|
@ -41,16 +41,8 @@
|
||||
" proc /proc proc defaults\n" \
|
||||
" In the meantime, run \"mount proc /proc -t proc\"\n"
|
||||
|
||||
#define STAT_FILE "/proc/stat"
|
||||
static int stat_fd = -1;
|
||||
#define LOADAVG_FILE "/proc/loadavg"
|
||||
static int loadavg_fd = -1;
|
||||
#define MEMINFO_FILE "/proc/meminfo"
|
||||
static int meminfo_fd = -1;
|
||||
#define VMINFO_FILE "/proc/vmstat"
|
||||
static int vminfo_fd = -1;
|
||||
#define VM_MIN_FREE_FILE "/proc/sys/vm/min_free_kbytes"
|
||||
static int vm_min_free_fd = -1;
|
||||
|
||||
// As of 2.6.24 /proc/meminfo seems to need 888 on 64-bit,
|
||||
// and would need 1258 if the obsolete fields were there.
|
||||
|
@ -154,8 +154,6 @@ PROCPS_EXPORT char *procps_uptime_sprint_short(void)
|
||||
int updecades, upyears, upweeks, updays, uphours, upminutes;
|
||||
int pos = 3;
|
||||
int comma = 0;
|
||||
time_t realseconds;
|
||||
struct tm *realtime;
|
||||
double uptime_secs, idle_secs;
|
||||
|
||||
shortbuf[0] = '\0';
|
||||
|
2
vmstat.c
2
vmstat.c
@ -542,7 +542,7 @@ static void diskformat(void)
|
||||
struct tm *tm_ptr;
|
||||
char timebuf[32];
|
||||
const char format[] = "%-5s %6lu %6lu %7lu %7lu %6lu %6lu %7lu %7lu %6lu %6lu";
|
||||
const char wide_format[] = "%-5s %9lu %9lu %lu %1u %9lu %9lu %lu %1u %7lu %7lu";
|
||||
const char wide_format[] = "%-5s %9lu %9lu %lu %lu %9lu %9lu %lu %lu %7lu %7lu";
|
||||
|
||||
if (procps_diskstat_new(&disk_stat) < 0)
|
||||
xerr(EXIT_FAILURE,
|
||||
|
Loading…
Reference in New Issue
Block a user