Browse Source

lsfd: don't use 'long int' for file data

Let's always assume positions, offsets, etc.. as 64-bit numbers.

Signed-off-by: Karel Zak <kzak@redhat.com>
pull/1487/head
Karel Zak 11 months ago
parent
commit
174ab64af2
  1. 4
      misc-utils/lsfd-file.c
  2. 2
      misc-utils/lsfd-sock.c
  3. 4
      misc-utils/lsfd.c
  4. 7
      misc-utils/lsfd.h

4
misc-utils/lsfd-file.c

@ -175,9 +175,9 @@ static void file_fill_flags_buf(struct ul_buffer *buf, int flags)
|| (file)->association == -ASSOC_SHM \
|| (file)->association == -ASSOC_MEM)
static unsigned long get_map_length(struct file *file)
static uint64_t get_map_length(struct file *file)
{
unsigned long res = 0;
uint64_t res = 0;
if (is_association(file, SHM) || is_association(file, MEM)) {
static size_t pagesize = 0;

2
misc-utils/lsfd-sock.c

@ -95,7 +95,7 @@ static void init_sock_content(struct file *file)
if (fd >= 0)
sprintf(path, "/proc/%d/fd/%d", file->proc->pid, fd);
else
sprintf(path, "/proc/%d/map_files/%lx-%lx",
sprintf(path, "/proc/%d/map_files/%"PRIx64 "-%" PRIx64,
file->proc->pid,
file->map_start,
file->map_end);

4
misc-utils/lsfd.c

@ -398,7 +398,7 @@ static struct file *collect_mem_file(struct proc *proc, int dd, struct dirent *d
ssize_t len;
char sym[PATH_MAX];
struct file *f;
unsigned long start, end;
uint64_t start, end;
struct map *map;
enum association assoc;
mode_t mode = 0;
@ -412,7 +412,7 @@ static struct file *collect_mem_file(struct proc *proc, int dd, struct dirent *d
map = NULL;
if (sscanf(dp->d_name, "%lx-%lx", &start, &end) == 2)
if (sscanf(dp->d_name, "%" SCNx64 "-%" SCNx64, &start, &end) == 2)
map = find_map(maps, start);
assoc = (map && map->shared)? ASSOC_SHM: ASSOC_MEM;

7
misc-utils/lsfd.h

@ -27,6 +27,7 @@
#include <stdbool.h>
#include <sys/stat.h>
#include <dirent.h>
#include <inttypes.h>
#include "list.h"
@ -111,10 +112,10 @@ struct file {
struct stat stat;
mode_t mode;
struct proc *proc;
uint64_t pos;
unsigned long map_start;
unsigned long map_end;
uint64_t pos;
uint64_t map_start;
uint64_t map_end;
unsigned int sys_flags;
unsigned int mnt_id;

Loading…
Cancel
Save