diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-07-30 14:37:19 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-07-30 14:37:19 +0200 |
commit | 20e2a6a9b199a1a54bd53f62f29003eb4f5bec6b (patch) | |
tree | 96896fc768e9a2bbc9200823b879d73e0f1bf4ea /sysctl.c | |
parent | fa772d69bce431ea208f30c9966355d00eede6cd (diff) |
sysctl: Export procfs base path in sysctl.h
Rename SYS_PATH to SYSCTL_PROC_PATH and make it available in sysctl.h
such that it can be used e.g. in error messages.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'sysctl.c')
-rw-r--r-- | sysctl.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -11,8 +11,7 @@ #include <limits.h> #include "built_in.h" - -#define SYS_PATH "/proc/sys/" +#include "sysctl.h" int sysctl_set_int(const char *file, int value) { @@ -21,8 +20,8 @@ int sysctl_set_int(const char *file, int value) ssize_t ret; int fd; - strncpy(path, SYS_PATH, PATH_MAX); - strncat(path, file, PATH_MAX - sizeof(SYS_PATH) - 1); + strncpy(path, SYSCTL_PROC_PATH, PATH_MAX); + strncat(path, file, PATH_MAX - sizeof(SYSCTL_PROC_PATH) - 1); fd = open(path, O_WRONLY); if (unlikely(fd < 0)) @@ -47,8 +46,8 @@ int sysctl_get_int(const char *file, int *value) ssize_t ret; int fd; - strncpy(path, SYS_PATH, PATH_MAX); - strncat(path, file, PATH_MAX - sizeof(SYS_PATH) - 1); + strncpy(path, SYSCTL_PROC_PATH, PATH_MAX); + strncat(path, file, PATH_MAX - sizeof(SYSCTL_PROC_PATH) - 1); fd = open(path, O_RDONLY); if (fd < 0) |