mirror of
https://git.freebsd.org/ports.git
synced 2025-07-01 01:20:31 -04:00
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
31 lines
572 B
C
31 lines
572 B
C
--- misc.c.orig 2022-01-28 14:06:02 UTC
|
|
+++ misc.c
|
|
@@ -28,8 +28,10 @@
|
|
|
|
#include <poll.h>
|
|
#include <sys/types.h>
|
|
+#include <sys/user.h>
|
|
#include <sys/stat.h> /* mkdir() declaration */
|
|
#include <signal.h>
|
|
+#include <libutil.h>
|
|
|
|
#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;
|
|
+}
|