summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcessList.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-01-05 23:42:55 +0100
committerBenBE <BenBE@geshi.org>2021-01-11 20:12:34 +0100
commitd72b0a682ecad0a8d5793022733447e855a61798 (patch)
treed9bc511bb716030fd73675bd3474e5a043636d73 /linux/LinuxProcessList.c
parent1b2d48bc9aa93254c48d10bb34acde9596b526b9 (diff)
Mark several non-modified pointer variables const
Diffstat (limited to 'linux/LinuxProcessList.c')
-rw-r--r--linux/LinuxProcessList.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index d181aaf2..a8514e28 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -107,7 +107,7 @@ static void LinuxProcessList_initTtyDrivers(LinuxProcessList* this) {
while (*at != '\0') {
at = strchr(at, ' '); // skip first token
while (*at == ' ') at++; // skip spaces
- char* token = at; // mark beginning of path
+ const char* token = at; // mark beginning of path
at = strchr(at, ' '); // find end of path
*at = '\0'; at++; // clear and skip
ttyDrivers[numDrivers].path = xStrdup(token); // save
@@ -394,7 +394,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, openat_arg_t proc
unsigned long long last_read = process->io_read_bytes;
unsigned long long last_write = process->io_write_bytes;
char* buf = buffer;
- char* line = NULL;
+ const char* line;
while ((line = strsep(&buf, "\n")) != NULL) {
switch (line[0]) {
case 'r':
@@ -486,7 +486,7 @@ static void LinuxProcessList_calcLibSize_helper(ATTR_UNUSED ht_key_t key, void*
if (!value)
return;
- LibraryData* v = (LibraryData *)value;
+ const LibraryData* v = (const LibraryData *)value;
uint64_t* d = (uint64_t *)data;
if (!v->exec)
return;
@@ -755,7 +755,7 @@ static void LinuxProcessList_readCGroupFile(LinuxProcess* process, openat_arg_t
int left = PROC_LINE_LENGTH;
while (!feof(file) && left > 0) {
char buffer[PROC_LINE_LENGTH + 1];
- char* ok = fgets(buffer, PROC_LINE_LENGTH, file);
+ const char* ok = fgets(buffer, PROC_LINE_LENGTH, file);
if (!ok)
break;
@@ -859,7 +859,7 @@ static void LinuxProcessList_readSecattrData(LinuxProcess* process, openat_arg_t
}
char buffer[PROC_LINE_LENGTH + 1];
- char* res = fgets(buffer, sizeof(buffer), file);
+ const char* res = fgets(buffer, sizeof(buffer), file);
fclose(file);
if (!res) {
free(process->secattr);
@@ -906,7 +906,7 @@ static void LinuxProcessList_readCwd(LinuxProcess* process, openat_arg_t procFd)
static int handleNetlinkMsg(struct nl_msg* nlmsg, void* linuxProcess) {
struct nlmsghdr* nlhdr;
struct nlattr* nlattrs[TASKSTATS_TYPE_MAX + 1];
- struct nlattr* nlattr;
+ const struct nlattr* nlattr;
struct taskstats stats;
int rem;
LinuxProcess* lp = (LinuxProcess*) linuxProcess;
@@ -1663,7 +1663,7 @@ static inline double LinuxProcessList_scanCPUTime(LinuxProcessList* this) {
// Depending on your kernel version,
// 5, 7, 8 or 9 of these fields will be set.
// The rest will remain at zero.
- char* ok = fgets(buffer, PROC_LINE_LENGTH, file);
+ const char* ok = fgets(buffer, PROC_LINE_LENGTH, file);
if (!ok) {
buffer[0] = '\0';
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy