From 204d8f31d7fc003e41622e21a9303dc017ad14fa Mon Sep 17 00:00:00 2001 From: tb Date: Mon, 8 May 2023 10:03:39 +0000 Subject: [PATCH 1/2] Reorder struct grid_cell_entry On aarch64 with llvm 15, the new -Wunaligned-access emits noise on every one of tmux's source files. This avoids this warning by moving a u_char to the end of the struct. This does not change the size of the struct on any architecture. ok nicm --- grid.c | 2 +- tmux.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grid.c b/grid.c index 58de03a3..3afbfb6a 100644 --- a/grid.c +++ b/grid.c @@ -53,7 +53,7 @@ static const struct grid_cell grid_cleared_cell = { { { ' ' }, 0, 1, 1 }, 0, GRID_FLAG_CLEARED, 8, 8, 0, 0 }; static const struct grid_cell_entry grid_cleared_entry = { - GRID_FLAG_CLEARED, { .data = { 0, 8, 8, ' ' } } + { .data = { 0, 8, 8, ' ' } }, GRID_FLAG_CLEARED }; /* Store cell in entry. */ diff --git a/tmux.h b/tmux.h index 11d8b26c..b43a2af0 100644 --- a/tmux.h +++ b/tmux.h @@ -723,7 +723,6 @@ struct grid_extd_entry { /* Grid cell entry. */ struct grid_cell_entry { - u_char flags; union { u_int offset; struct { @@ -733,6 +732,7 @@ struct grid_cell_entry { u_char data; } data; }; + u_char flags; } __packed; /* Grid line. */ From 1d98394b411d8f6c9a3be862a541b34fbd6c97f5 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 19 May 2023 07:46:34 +0000 Subject: [PATCH 2/2] Add format for server_sessions, from Magnus Gross. --- format.c | 15 +++++++++++++++ tmux.1 | 1 + 2 files changed, 16 insertions(+) diff --git a/format.c b/format.c index dec4022a..8cbf0a64 100644 --- a/format.c +++ b/format.c @@ -2077,6 +2077,18 @@ format_cb_scroll_region_upper(struct format_tree *ft) return (NULL); } +/* Callback for server_sessions. */ +static void * +format_cb_server_sessions(__unused struct format_tree *ft) +{ + struct session *s; + u_int n = 0; + + RB_FOREACH(s, sessions, &sessions) + n++; + return (format_printf("%u", n)); +} + /* Callback for session_attached. */ static void * format_cb_session_attached(struct format_tree *ft) @@ -2980,6 +2992,9 @@ static const struct format_table_entry format_table[] = { { "scroll_region_upper", FORMAT_TABLE_STRING, format_cb_scroll_region_upper }, + { "server_sessions", FORMAT_TABLE_STRING, + format_cb_server_sessions + }, { "session_activity", FORMAT_TABLE_TIME, format_cb_session_activity }, diff --git a/tmux.1 b/tmux.1 index 4cbb8954..4881b820 100644 --- a/tmux.1 +++ b/tmux.1 @@ -5275,6 +5275,7 @@ The following variables are available, where appropriate: .It Li "selection_present" Ta "" Ta "1 if selection started in copy mode" .It Li "selection_start_x" Ta "" Ta "X position of the start of the selection" .It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection" +.It Li "server_sessions" Ta "" Ta "Number of sessions" .It Li "session_activity" Ta "" Ta "Time of session last activity" .It Li "session_alerts" Ta "" Ta "List of window indexes with alerts" .It Li "session_attached" Ta "" Ta "Number of clients session is attached to"