Commit 91df31b9 authored by Arnaud Blanchard's avatar Arnaud Blanchard

change PATH_MAX with BLC_LINE_MAX to fix compilation with gcc9

parent f8d7504d
......@@ -9,8 +9,10 @@
#ifndef BLC_PROCESS_H
#define BLC_PROCESS_H
#include <blc_tools.h>
#include <unistd.h> //pid_t
#include <limits.h> //NAME_MAX LINE_MAX
#include <limits.h> //NAME_MAX
#include <stdint.h> //uint64_t
......@@ -36,7 +38,7 @@ typedef struct blc_file
uint64_t inode;
char device[32];
char path[PATH_MAX];
char path[BLC_LINE_MAX];
char type[8];
blc_file_opening **openings_pt;
int openings_nb;
......@@ -52,7 +54,7 @@ typedef struct blc_process
void update_children();
#endif
char command[NAME_MAX+1];
char full_command_line[LINE_MAX];
char full_command_line[BLC_LINE_MAX];
float cpu_percent, mem_percent;
int mem;
pid_t pid, parent_pid;
......
......@@ -99,7 +99,7 @@ blc_process *blc_find_process(pid_t pid)
void blc_processes_refresh_files(blc_process *processes, int processes_nb)
{
blc_mem mem;
char buf[LINE_MAX];
char buf[BLC_LINE_MAX];
char *path, *str;
int stdout_pipe[2];
pid_t pid;
......@@ -272,7 +272,7 @@ void blc_processes_refresh(blc_process *processes, int processes_nb){
{
line=mem.chars+pos;
// fprintf(stderr, "%s\n", line);
while((ret=sscanf(line, " %d %d %f %d %f %s %"STRINGIFY_CONTENT(LINE_MAX)"[^\n]\n%n", &tmp_process.parent_pid, &tmp_process.pid, &tmp_process.cpu_percent, &tmp_process.mem, &tmp_process.mem_percent, tmp_process.command, tmp_process.full_command_line, &length))==7){
while((ret=sscanf(line, " %d %d %f %d %f %s %" STRINGIFY_CONTENT(LINE_MAX)"[^\n]\n%n", &tmp_process.parent_pid, &tmp_process.pid, &tmp_process.cpu_percent, &tmp_process.mem, &tmp_process.mem_percent, tmp_process.command, tmp_process.full_command_line, &length))==7){
FOR_EACH_INV(process, processes, processes_nb) if (process->pid == tmp_process.pid) *process=tmp_process; //not very efficient
line+=length;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment