summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2022-11-26 00:58:14 +0100
committerBenBE <BenBE@geshi.org>2023-01-08 18:22:10 +0100
commit8def4d63cd9c216d89b785f858c866257f9a6768 (patch)
tree4dcab67b1909e6283bcab7a5dceb15bb4d0e921a
parent67bc7fe640bed8b8fa8006c9152442023928b756 (diff)
Replace meaningless ID column with FD column in lock screen
Doubly meaningless since the IDs are now per-FD
-rw-r--r--ProcessLocksScreen.c10
-rw-r--r--ProcessLocksScreen.h2
-rw-r--r--linux/Platform.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/ProcessLocksScreen.c b/ProcessLocksScreen.c
index b842d2b9..5f876e5d 100644
--- a/ProcessLocksScreen.c
+++ b/ProcessLocksScreen.c
@@ -27,7 +27,7 @@ ProcessLocksScreen* ProcessLocksScreen_new(const Process* process) {
this->pid = process->tgid;
else
this->pid = process->pid;
- return (ProcessLocksScreen*) InfoScreen_init(&this->super, process, NULL, LINES - 2, " ID TYPE EXCLUSION READ/WRITE DEVICE:INODE START END FILENAME");
+ return (ProcessLocksScreen*) InfoScreen_init(&this->super, process, NULL, LINES - 2, " FD TYPE EXCLUSION READ/WRITE DEVICE:INODE START END FILENAME");
}
void ProcessLocksScreen_delete(Object* this) {
@@ -64,16 +64,16 @@ static void ProcessLocksScreen_scan(InfoScreen* this) {
char entry[512];
if (ULLONG_MAX == data->end) {
- xSnprintf(entry, sizeof(entry), "%10d %-10s %-10s %-10s %02x:%02x:%020"PRIu64" %20"PRIu64" %20s %s",
- data->id,
+ xSnprintf(entry, sizeof(entry), "%5d %-10s %-10s %-10s %02x:%02x:%020"PRIu64" %20"PRIu64" %20s %s",
+ data->fd,
data->locktype, data->exclusive, data->readwrite,
data->dev[0], data->dev[1], data->inode,
data->start, "<END OF FILE>",
data->filename ? data->filename : "<N/A>"
);
} else {
- xSnprintf(entry, sizeof(entry), "%10d %-10s %-10s %-10s %02x:%02x:%020"PRIu64" %20"PRIu64" %20"PRIu64" %s",
- data->id,
+ xSnprintf(entry, sizeof(entry), "%5d %-10s %-10s %-10s %02x:%02x:%020"PRIu64" %20"PRIu64" %20"PRIu64" %s",
+ data->fd,
data->locktype, data->exclusive, data->readwrite,
data->dev[0], data->dev[1], data->inode,
data->start, data->end,
diff --git a/ProcessLocksScreen.h b/ProcessLocksScreen.h
index cf34de4f..560f3a88 100644
--- a/ProcessLocksScreen.h
+++ b/ProcessLocksScreen.h
@@ -26,7 +26,7 @@ typedef struct FileLocks_Data_ {
char* exclusive;
char* readwrite;
char* filename;
- int id;
+ int fd;
unsigned int dev[2];
uint64_t inode;
uint64_t start;
diff --git a/linux/Platform.c b/linux/Platform.c
index d4972d41..4382c1ee 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -456,7 +456,7 @@ FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
errno = 0;
char *end = de->d_name;
- strtoull(de->d_name, &end, 10);
+ int file = strtoull(de->d_name, &end, 10);
if (errno || *end)
continue;
@@ -476,11 +476,11 @@ FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
if (strncmp(buffer, "lock:\t", strlen("lock:\t")))
continue;
- FileLocks_Data data = {0};
+ FileLocks_Data data = {.fd = file};
int _;
char lock_end[25], locktype[32], exclusive[32], readwrite[32];
if (10 != sscanf(buffer + strlen("lock:\t"), "%d: %31s %31s %31s %d %x:%x:%"PRIu64" %"PRIu64" %24s",
- &data.id, locktype, exclusive, readwrite, &_,
+ &_, locktype, exclusive, readwrite, &_,
&data.dev[0], &data.dev[1], &data.inode,
&data.start, lock_end))
continue;

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