gcc 3.0 warnings
This commit is contained in:
@ -175,7 +175,7 @@ static int guess_name(char * const buf, int maj, int min){
|
||||
* Useful names could be in /proc/PID/fd/2 (stderr, seldom redirected)
|
||||
* and in /proc/PID/fd/255 (used by bash to remember the tty).
|
||||
*/
|
||||
static int link_name(char * const buf, int maj, int min, int pid, char *name){
|
||||
static int link_name(char * const buf, int maj, int min, int pid, const char *name){
|
||||
struct stat sbuf;
|
||||
char path[32];
|
||||
int count;
|
||||
|
@ -112,7 +112,7 @@ static const char dash[] = "-";
|
||||
|
||||
/* These mostly rely on POSIX to make them zero. */
|
||||
|
||||
static const symb hashtable[256];
|
||||
static symb hashtable[256];
|
||||
|
||||
static char *sysmap_data;
|
||||
static unsigned sysmap_room;
|
||||
@ -123,7 +123,7 @@ static char *ksyms_data;
|
||||
static unsigned ksyms_room = 4096;
|
||||
static symb *ksyms_index;
|
||||
static unsigned ksyms_count;
|
||||
static int idx_room;
|
||||
static unsigned idx_room;
|
||||
|
||||
/*********************************/
|
||||
|
||||
|
@ -29,8 +29,8 @@ unsigned print_str(FILE* file, char *s, unsigned max) {
|
||||
to octal as we go, separating items of the list by 'sep' and stopping after
|
||||
processing max chars of output (accounting for expansion due to octal rep).
|
||||
*/
|
||||
unsigned print_strlist(FILE* file, char **strs, char* sep, unsigned max) {
|
||||
int i, n, seplen = strlen(sep);
|
||||
unsigned print_strlist(FILE* file, char **strs, unsigned max) {
|
||||
int i, n;
|
||||
for (n=0; *strs && n < max; strs++) {
|
||||
for (i=0; strs[0][i] && n+i < max; i++)
|
||||
if (isprint(strs[0][i]) || strs[0][i] == ' ')
|
||||
@ -43,9 +43,9 @@ unsigned print_strlist(FILE* file, char **strs, char* sep, unsigned max) {
|
||||
return max - n;
|
||||
}
|
||||
n += i;
|
||||
if (n + seplen < max) {
|
||||
fputs(sep, file);
|
||||
n += seplen;
|
||||
if (n + 1 < max) {
|
||||
fputc(' ', file);
|
||||
n++;
|
||||
} else
|
||||
return max - n;
|
||||
}
|
||||
|
@ -23,4 +23,4 @@ extern int open_psdb(const char *override);
|
||||
extern int open_psdb_message(const char *override, void (*message)(const char *, ...));
|
||||
|
||||
extern unsigned print_str (FILE* file, char *s, unsigned max);
|
||||
extern unsigned print_strlist(FILE* file, char **strs, char* sep, unsigned max);
|
||||
extern unsigned print_strlist(FILE* file, char **strs, unsigned max);
|
||||
|
@ -211,7 +211,7 @@ static void statm2proc(char* s, proc_t* P) {
|
||||
/* fprintf(stderr, "statm2proc converted %d fields.\n",num); */
|
||||
}
|
||||
|
||||
static int file2str(char *directory, char *what, char *ret, int cap) {
|
||||
static int file2str(const char *directory, const char *what, char *ret, int cap) {
|
||||
static char filename[80];
|
||||
int fd, num_read;
|
||||
|
||||
@ -223,7 +223,7 @@ static int file2str(char *directory, char *what, char *ret, int cap) {
|
||||
return num_read;
|
||||
}
|
||||
|
||||
static char** file2strvec(char* directory, char* what) {
|
||||
static char** file2strvec(const char* directory, const char* what) {
|
||||
char buf[2048]; /* read buf bytes at a time */
|
||||
char *p, *rbuf = 0, *endbuf, **q, **ret;
|
||||
int fd, tot = 0, n, c, end_of_file = 0;
|
||||
|
@ -51,12 +51,12 @@
|
||||
#endif
|
||||
|
||||
typedef struct mapstruct {
|
||||
char *name;
|
||||
const char *name;
|
||||
int num;
|
||||
} mapstruct;
|
||||
|
||||
|
||||
static mapstruct sigtable[] = {
|
||||
static const mapstruct sigtable[] = {
|
||||
{"ABRT", SIGABRT}, /* IOT */
|
||||
{"ALRM", SIGALRM},
|
||||
{"BUS", SIGBUS},
|
||||
@ -98,7 +98,7 @@ static mapstruct sigtable[] = {
|
||||
static const int number_of_signals = sizeof(sigtable)/sizeof(mapstruct);
|
||||
|
||||
static int compare_signal_names(const void *a, const void *b){
|
||||
return strcasecmp( ((mapstruct*)a)->name, ((mapstruct*)b)->name );
|
||||
return strcasecmp( ((const mapstruct*)a)->name, ((const mapstruct*)b)->name );
|
||||
}
|
||||
|
||||
/* return -1 on failure */
|
||||
|
@ -281,11 +281,11 @@ void loadavg(double *av1, double *av5, double *av15) {
|
||||
|
||||
typedef struct mem_table_struct {
|
||||
const char *name; /* memory type name */
|
||||
const unsigned *slot; /* slot in return struct */
|
||||
unsigned *slot; /* slot in return struct */
|
||||
} mem_table_struct;
|
||||
|
||||
static int compare_mem_table_structs(const void *a, const void *b){
|
||||
return strcmp(((mem_table_struct*)a)->name,((mem_table_struct*)b)->name);
|
||||
return strcmp(((const mem_table_struct*)a)->name,((const mem_table_struct*)b)->name);
|
||||
}
|
||||
|
||||
/* example data, following junk, with comments added:
|
||||
@ -342,7 +342,6 @@ unsigned kb_main_used;
|
||||
unsigned kb_writeback;
|
||||
unsigned kb_slab;
|
||||
unsigned nr_reversemaps;
|
||||
unsigned kb_active;
|
||||
unsigned kb_committed_as;
|
||||
unsigned kb_dirty;
|
||||
unsigned kb_inactive;
|
||||
@ -385,7 +384,7 @@ void meminfo(void){
|
||||
|
||||
FILE_TO_BUF(MEMINFO_FILE,meminfo_fd);
|
||||
|
||||
kb_inactive = -1;
|
||||
kb_inactive = ~0U;
|
||||
|
||||
head = buf;
|
||||
for(;;){
|
||||
@ -412,7 +411,7 @@ nextline:
|
||||
kb_low_total = kb_main_total;
|
||||
kb_low_free = kb_main_free;
|
||||
}
|
||||
if(kb_inactive==-1){
|
||||
if(kb_inactive==~0U){
|
||||
kb_inactive = kb_inact_dirty + kb_inact_clean;
|
||||
}
|
||||
kb_swap_used = kb_swap_total - kb_swap_free;
|
||||
@ -425,11 +424,11 @@ nextline:
|
||||
|
||||
typedef struct vm_table_struct {
|
||||
const char *name; /* VM statistic name */
|
||||
const unsigned *slot; /* slot in return struct */
|
||||
unsigned *slot; /* slot in return struct */
|
||||
} vm_table_struct;
|
||||
|
||||
static int compare_vm_table_structs(const void *a, const void *b){
|
||||
return strcmp(((vm_table_struct*)a)->name,((vm_table_struct*)b)->name);
|
||||
return strcmp(((const vm_table_struct*)a)->name,((const vm_table_struct*)b)->name);
|
||||
}
|
||||
|
||||
unsigned vm_nr_dirty;
|
||||
|
Reference in New Issue
Block a user