#include "nls.h"
#include "buffer.h"
#include "idcache.h"
+#include "strutils.h"
#include "libsmartcols.h"
xasprintf(&str, "---");
break;
case COL_POS:
- xasprintf(&str, "%llu",
+ xasprintf(&str, "%" PRIu64,
(does_file_has_fdinfo_alike(file))? file->pos: 0);
break;
case COL_FLAGS: {
static int file_handle_fdinfo(struct file *file, const char *key, const char* value)
{
if (strcmp(key, "pos") == 0) {
- file->pos = strtoull(value, NULL, 10);
+ ul_strtou64(value, &file->pos, 10);
return 1;
} else if (strcmp(key, "flags") == 0) {
- file->sys_flags = (int)strtol(value, NULL, 8);
+ ul_strtou32(value, &file->sys_flags, 8);
+
return 1;
} else if (strcmp(key, "mnt_id") == 0) {
- file->mnt_id = (int)strtol(value, NULL, 10);
+ ul_strtou32(value, &file->mnt_id, 10);
return 1;
}
return 0;
static void read_fdinfo(struct file *file, FILE *fdinfo)
{
- const struct file_class *class;
char buf[1024];
- char *val;
while (fgets(buf, sizeof(buf), fdinfo)) {
- val = strchr(buf, ':');
+ const struct file_class *class;
+ char *val = strchr(buf, ':');
+
if (!val)
continue;
- *val++ = '\0';
- while (*val == '\t' || *val == ' ')
- val++;
+ *val++ = '\0'; /* terminate key */
+
+ val = (char *) skip_space(val);
+ rtrim_whitespace((unsigned char *) val);
class = file->class;
while (class) {
struct stat stat;
mode_t mode;
struct proc *proc;
- unsigned long long pos;
+ uint64_t pos;
unsigned long map_start;
unsigned long map_end;
- int sys_flags;
- int mnt_id;
+ unsigned int sys_flags;
+ unsigned int mnt_id;
};
#define is_association(_f, a) ((_f)->association < 0 && (_f)->association == -ASSOC_ ## a)