mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 18:07:20 +00:00
made more paths be macros
This commit is contained in:
parent
339b8f43a9
commit
611bfb0580
5 changed files with 40 additions and 26 deletions
|
@ -3,6 +3,8 @@
|
|||
#include <unistd.h>
|
||||
#include "common.h"
|
||||
|
||||
#define FS_INODE_NR "/proc/sys/fs/inode-nr"
|
||||
|
||||
int open_inodes(int argc, char **argv) {
|
||||
FILE *f;
|
||||
int nr, freen;
|
||||
|
@ -21,19 +23,19 @@ int open_inodes(int argc, char **argv) {
|
|||
return 0;
|
||||
}
|
||||
if(!strcmp(argv[1], "autoconf")) {
|
||||
if(0 == access("/proc/sys/fs/inode-nr", R_OK))
|
||||
if(0 == access(FS_INODE_NR, R_OK))
|
||||
return writeyes();
|
||||
else
|
||||
return writeno("/proc/sys/fs/inode-nr not readable");
|
||||
return writeno(FS_INODE_NR " not readable");
|
||||
}
|
||||
}
|
||||
if(!(f=fopen("/proc/sys/fs/inode-nr", "r"))) {
|
||||
fputs("cannot open /proc/sys/fs/inode-nr\n", stderr);
|
||||
if(!(f=fopen(FS_INODE_NR, "r"))) {
|
||||
fputs("cannot open " FS_INODE_NR "\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
if(2 != fscanf(f, "%d %d", &nr, &freen)) {
|
||||
fclose(f);
|
||||
fputs("cannot read from /proc/sys/fs/inode-nr\n", stderr);
|
||||
fputs("cannot read from " FS_INODE_NR "\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
fclose(f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue