From 7418bfa0e65838e7f94bd82d1e02c5aac79b0555 Mon Sep 17 00:00:00 2001 From: Rodrigo Osorio Date: Tue, 15 Aug 2023 13:19:35 +0200 Subject: sysutils/screen: Add session creation time when list active sessions Reimplement Debian patches to display screen session creation time and sort the list of sessions by date. Output example for 'screen -ls' command --------------------------------------- There is a screen on: 14059.pts-7.1302amd64-head (08/15/23 10:02:52) (Attached) 1 Socket in /tmp/screens/S-root. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D41469 --- sysutils/screen/files/patch-misc.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sysutils/screen/files/patch-misc.c (limited to 'sysutils/screen/files/patch-misc.c') diff --git a/sysutils/screen/files/patch-misc.c b/sysutils/screen/files/patch-misc.c new file mode 100644 index 000000000000..1364b230d55a --- /dev/null +++ b/sysutils/screen/files/patch-misc.c @@ -0,0 +1,31 @@ +--- misc.c.orig 2022-01-28 14:06:02 UTC ++++ misc.c +@@ -28,8 +28,10 @@ + + #include + #include ++#include + #include /* mkdir() declaration */ + #include ++#include + + #include "config.h" + #include "screen.h" +@@ -796,3 +798,17 @@ + } + + #endif ++ ++time_t ++SessionCreationTime(fifo) ++const char *fifo; ++{ ++ int pid = atoi(fifo); ++ if (pid <= 0) return 0; ++ ++ struct kinfo_proc * kip = kinfo_getproc(pid); ++ if (kip == 0) return 0; ++ time_t start = kip->ki_start.tv_sec; ++ free (kip); ++ return start; ++} -- cgit v1.2.3