summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2017-02-15 22:49:13 -0200
committerHisham <hisham@gobolinux.org>2017-02-15 22:49:13 -0200
commitfa30938247d30e1b87b4c846ef221ca18854a445 (patch)
treea09234e0aa87e7ce19777f0a75d4d075d432c8de
parentbb8dec15829bb90ef2e637312e45e90b8ab4c64b (diff)
parentaa813c756144fa4cf6b57439e9f02859fbf0d81d (diff)
Merge branch 'master' of https://github.com/hishamhm/htop
-rw-r--r--CPUMeter.c24
-rw-r--r--LoadAverageMeter.c8
-rw-r--r--Process.c2
-rw-r--r--TasksMeter.c8
-rw-r--r--TraceScreen.c2
-rw-r--r--UptimeMeter.c6
-rw-r--r--darwin/Platform.c4
-rw-r--r--freebsd/FreeBSDProcess.c4
-rw-r--r--htop.1.in2
-rw-r--r--linux/LinuxProcess.c4
-rw-r--r--unsupported/Platform.c2
11 files changed, 33 insertions, 33 deletions
diff --git a/CPUMeter.c b/CPUMeter.c
index 32bad049..6b9b83db 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -48,7 +48,7 @@ static void CPUMeter_init(Meter* this) {
int cpu = this->param;
if (this->pl->cpuCount > 1) {
char caption[10];
- sprintf(caption, "%-3d", Settings_cpuId(this->pl->settings, cpu - 1));
+ snprintf(caption, sizeof(caption), "%-3d", Settings_cpuId(this->pl->settings, cpu - 1));
Meter_setCaption(this, caption);
}
if (this->param == 0)
@@ -74,44 +74,44 @@ static void CPUMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[METER_TEXT], "absent");
return;
}
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_NORMAL]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NORMAL]);
RichString_append(out, CRT_colors[METER_TEXT], ":");
RichString_append(out, CRT_colors[CPU_NORMAL], buffer);
if (this->pl->settings->detailedCPUTime) {
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_KERNEL]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_KERNEL]);
RichString_append(out, CRT_colors[METER_TEXT], "sy:");
RichString_append(out, CRT_colors[CPU_KERNEL], buffer);
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_NICE]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NICE]);
RichString_append(out, CRT_colors[METER_TEXT], "ni:");
RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer);
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_IRQ]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IRQ]);
RichString_append(out, CRT_colors[METER_TEXT], "hi:");
RichString_append(out, CRT_colors[CPU_IRQ], buffer);
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_SOFTIRQ]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_SOFTIRQ]);
RichString_append(out, CRT_colors[METER_TEXT], "si:");
RichString_append(out, CRT_colors[CPU_SOFTIRQ], buffer);
if (this->values[CPU_METER_STEAL]) {
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_STEAL]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_STEAL]);
RichString_append(out, CRT_colors[METER_TEXT], "st:");
RichString_append(out, CRT_colors[CPU_STEAL], buffer);
}
if (this->values[CPU_METER_GUEST]) {
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_GUEST]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_GUEST]);
RichString_append(out, CRT_colors[METER_TEXT], "gu:");
RichString_append(out, CRT_colors[CPU_GUEST], buffer);
}
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_IOWAIT]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IOWAIT]);
RichString_append(out, CRT_colors[METER_TEXT], "wa:");
RichString_append(out, CRT_colors[CPU_IOWAIT], buffer);
} else {
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_KERNEL]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_KERNEL]);
RichString_append(out, CRT_colors[METER_TEXT], "sys:");
RichString_append(out, CRT_colors[CPU_KERNEL], buffer);
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_NICE]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NICE]);
RichString_append(out, CRT_colors[METER_TEXT], "low:");
RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer);
if (this->values[CPU_METER_IRQ]) {
- sprintf(buffer, "%5.1f%% ", this->values[CPU_METER_IRQ]);
+ snprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IRQ]);
RichString_append(out, CRT_colors[METER_TEXT], "vir:");
RichString_append(out, CRT_colors[CPU_GUEST], buffer);
}
diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c
index 54e517a8..517031dd 100644
--- a/LoadAverageMeter.c
+++ b/LoadAverageMeter.c
@@ -28,11 +28,11 @@ static void LoadAverageMeter_updateValues(Meter* this, char* buffer, int size) {
static void LoadAverageMeter_display(Object* cast, RichString* out) {
Meter* this = (Meter*)cast;
char buffer[20];
- sprintf(buffer, "%.2f ", this->values[0]);
+ snprintf(buffer, sizeof(buffer), "%.2f ", this->values[0]);
RichString_write(out, CRT_colors[LOAD_AVERAGE_ONE], buffer);
- sprintf(buffer, "%.2f ", this->values[1]);
+ snprintf(buffer, sizeof(buffer), "%.2f ", this->values[1]);
RichString_append(out, CRT_colors[LOAD_AVERAGE_FIVE], buffer);
- sprintf(buffer, "%.2f ", this->values[2]);
+ snprintf(buffer, sizeof(buffer), "%.2f ", this->values[2]);
RichString_append(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer);
}
@@ -48,7 +48,7 @@ static void LoadMeter_updateValues(Meter* this, char* buffer, int size) {
static void LoadMeter_display(Object* cast, RichString* out) {
Meter* this = (Meter*)cast;
char buffer[20];
- sprintf(buffer, "%.2f ", ((Meter*)this)->values[0]);
+ snprintf(buffer, sizeof(buffer), "%.2f ", ((Meter*)this)->values[0]);
RichString_write(out, CRT_colors[LOAD], buffer);
}
diff --git a/Process.c b/Process.c
index a1ffcf0e..fea5533c 100644
--- a/Process.c
+++ b/Process.c
@@ -198,7 +198,7 @@ void Process_setupColumnWidths() {
snprintf(Process_titleBuffer[i], 20, "%*s ", digits, Process_pidColumns[i].label);
Process_fields[Process_pidColumns[i].id].title = Process_titleBuffer[i];
}
- sprintf(Process_pidFormat, "%%%dd ", digits);
+ snprintf(Process_pidFormat, sizeof(Process_pidFormat), "%%%dd ", digits);
}
void Process_humanNumber(RichString* str, unsigned long number, bool coloring) {
diff --git a/TasksMeter.c b/TasksMeter.c
index 78a14683..3e695319 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -40,7 +40,7 @@ static void TasksMeter_display(Object* cast, RichString* out) {
int processes = (int) this->values[2];
- sprintf(buffer, "%d", processes);
+ snprintf(buffer, sizeof(buffer), "%d", processes);
RichString_write(out, CRT_colors[METER_VALUE], buffer);
int threadValueColor = CRT_colors[METER_VALUE];
int threadCaptionColor = CRT_colors[METER_TEXT];
@@ -50,18 +50,18 @@ static void TasksMeter_display(Object* cast, RichString* out) {
}
if (!settings->hideUserlandThreads) {
RichString_append(out, CRT_colors[METER_TEXT], ", ");
- sprintf(buffer, "%d", (int)this->values[1]);
+ snprintf(buffer, sizeof(buffer), "%d", (int)this->values[1]);
RichString_append(out, threadValueColor, buffer);
RichString_append(out, threadCaptionColor, " thr");
}
if (!settings->hideKernelThreads) {
RichString_append(out, CRT_colors[METER_TEXT], ", ");
- sprintf(buffer, "%d", (int)this->values[0]);
+ snprintf(buffer, sizeof(buffer), "%d", (int)this->values[0]);
RichString_append(out, threadValueColor, buffer);
RichString_append(out, threadCaptionColor, " kthr");
}
RichString_append(out, CRT_colors[METER_TEXT], "; ");
- sprintf(buffer, "%d", (int)this->values[3]);
+ snprintf(buffer, sizeof(buffer), "%d", (int)this->values[3]);
RichString_append(out, CRT_colors[TASKS_RUNNING], buffer);
RichString_append(out, CRT_colors[METER_TEXT], " running");
}
diff --git a/TraceScreen.c b/TraceScreen.c
index 2d6eb336..bd771182 100644
--- a/TraceScreen.c
+++ b/TraceScreen.c
@@ -99,7 +99,7 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
dup2(this->fdpair[1], STDERR_FILENO);
int ok = fcntl(this->fdpair[1], F_SETFL, O_NONBLOCK);
if (ok != -1) {
- sprintf(buffer, "%d", this->super.process->pid);
+ snprintf(buffer, sizeof(buffer), "%d", this->super.process->pid);
execlp("strace", "strace", "-p", buffer, NULL);
}
const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH.";
diff --git a/UptimeMeter.c b/UptimeMeter.c
index d20c4797..2fe603ae 100644
--- a/UptimeMeter.c
+++ b/UptimeMeter.c
@@ -33,11 +33,11 @@ static void UptimeMeter_updateValues(Meter* this, char* buffer, int len) {
}
char daysbuf[15];
if (days > 100) {
- sprintf(daysbuf, "%d days(!), ", days);
+ snprintf(daysbuf, sizeof(daysbuf), "%d days(!), ", days);
} else if (days > 1) {
- sprintf(daysbuf, "%d days, ", days);
+ snprintf(daysbuf, sizeof(daysbuf), "%d days, ", days);
} else if (days == 1) {
- sprintf(daysbuf, "1 day, ");
+ snprintf(daysbuf, sizeof(daysbuf), "1 day, ");
} else {
daysbuf[0] = '\0';
}
diff --git a/darwin/Platform.c b/darwin/Platform.c
index 29934899..1dce8b67 100644
--- a/darwin/Platform.c
+++ b/darwin/Platform.c
@@ -78,7 +78,7 @@ ProcessFieldData Process_fields[] = {
[STATE] = { .name = "STATE", .title = "S ", .description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)", .flags = 0, },
[PPID] = { .name = "PPID", .title = " PPID ", .description = "Parent process ID", .flags = 0, },
[PGRP] = { .name = "PGRP", .title = " PGRP ", .description = "Process group ID", .flags = 0, },
- [SESSION] = { .name = "SESSION", .title = " SESN ", .description = "Process's session ID", .flags = 0, },
+ [SESSION] = { .name = "SESSION", .title = " SID ", .description = "Process's session ID", .flags = 0, },
[TTY_NR] = { .name = "TTY_NR", .title = " TTY ", .description = "Controlling terminal", .flags = 0, },
[TPGID] = { .name = "TPGID", .title = " TPGID ", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, },
[MINFLT] = { .name = "MINFLT", .title = " MINFLT ", .description = "Number of minor faults which have not required loading a memory page from disk", .flags = 0, },
@@ -166,7 +166,7 @@ ProcessPidColumn Process_pidColumns[] = {
{ .id = TPGID, .label = "TPGID" },
{ .id = TGID, .label = "TGID" },
{ .id = PGRP, .label = "PGRP" },
- { .id = SESSION, .label = "SESN" },
+ { .id = SESSION, .label = "SID" },
{ .id = 0, .label = NULL },
};
diff --git a/freebsd/FreeBSDProcess.c b/freebsd/FreeBSDProcess.c
index 22e00043..851a0ef4 100644
--- a/freebsd/FreeBSDProcess.c
+++ b/freebsd/FreeBSDProcess.c
@@ -61,7 +61,7 @@ ProcessFieldData Process_fields[] = {
[STATE] = { .name = "STATE", .title = "S ", .description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)", .flags = 0, },
[PPID] = { .name = "PPID", .title = " PPID ", .description = "Parent process ID", .flags = 0, },
[PGRP] = { .name = "PGRP", .title = " PGRP ", .description = "Process group ID", .flags = 0, },
- [SESSION] = { .name = "SESSION", .title = " SESN ", .description = "Process's session ID", .flags = 0, },
+ [SESSION] = { .name = "SESSION", .title = " SID ", .description = "Process's session ID", .flags = 0, },
[TTY_NR] = { .name = "TTY_NR", .title = " TTY ", .description = "Controlling terminal", .flags = 0, },
[TPGID] = { .name = "TPGID", .title = " TPGID ", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, },
[MINFLT] = { .name = "MINFLT", .title = " MINFLT ", .description = "Number of minor faults which have not required loading a memory page from disk", .flags = 0, },
@@ -92,7 +92,7 @@ ProcessPidColumn Process_pidColumns[] = {
{ .id = TPGID, .label = "TPGID" },
{ .id = TGID, .label = "TGID" },
{ .id = PGRP, .label = "PGRP" },
- { .id = SESSION, .label = "SESN" },
+ { .id = SESSION, .label = "SID" },
{ .id = 0, .label = NULL },
};
diff --git a/htop.1.in b/htop.1.in
index 3bdb2984..4388be12 100644
--- a/htop.1.in
+++ b/htop.1.in
@@ -217,7 +217,7 @@ The parent process ID.
.B PGRP
The process's group ID.
.TP
-.B SESSION (SESN)
+.B SESSION (SID)
The process's session ID.
.TP
.B TTY_NR (TTY)
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index d0e9acd2..690e91bf 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -144,7 +144,7 @@ ProcessFieldData Process_fields[] = {
[STATE] = { .name = "STATE", .title = "S ", .description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)", .flags = 0, },
[PPID] = { .name = "PPID", .title = " PPID ", .description = "Parent process ID", .flags = 0, },
[PGRP] = { .name = "PGRP", .title = " PGRP ", .description = "Process group ID", .flags = 0, },
- [SESSION] = { .name = "SESSION", .title = " SESN ", .description = "Process's session ID", .flags = 0, },
+ [SESSION] = { .name = "SESSION", .title = " SID ", .description = "Process's session ID", .flags = 0, },
[TTY_NR] = { .name = "TTY_NR", .title = "TTY ", .description = "Controlling terminal", .flags = 0, },
[TPGID] = { .name = "TPGID", .title = " TPGID ", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, },
[FLAGS] = { .name = "FLAGS", .title = NULL, .description = NULL, .flags = 0, },
@@ -227,7 +227,7 @@ ProcessPidColumn Process_pidColumns[] = {
{ .id = TPGID, .label = "TPGID" },
{ .id = TGID, .label = "TGID" },
{ .id = PGRP, .label = "PGRP" },
- { .id = SESSION, .label = "SESN" },
+ { .id = SESSION, .label = "SID" },
{ .id = OOM, .label = "OOM" },
{ .id = 0, .label = NULL },
};
diff --git a/unsupported/Platform.c b/unsupported/Platform.c
index 0df3ef9f..ba844191 100644
--- a/unsupported/Platform.c
+++ b/unsupported/Platform.c
@@ -38,7 +38,7 @@ ProcessFieldData Process_fields[] = {
[STATE] = { .name = "STATE", .title = "S ", .description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)", .flags = 0, },
[PPID] = { .name = "PPID", .title = " PPID ", .description = "Parent process ID", .flags = 0, },
[PGRP] = { .name = "PGRP", .title = " PGRP ", .description = "Process group ID", .flags = 0, },
- [SESSION] = { .name = "SESSION", .title = " SESN ", .description = "Process's session ID", .flags = 0, },
+ [SESSION] = { .name = "SESSION", .title = " SID ", .description = "Process's session ID", .flags = 0, },
[TTY_NR] = { .name = "TTY_NR", .title = " TTY ", .description = "Controlling terminal", .flags = 0, },
[TPGID] = { .name = "TPGID", .title = " TPGID ", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, },
[MINFLT] = { .name = "MINFLT", .title = " MINFLT ", .description = "Number of minor faults which have not required loading a memory page from disk", .flags = 0, },

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