tmux
3.2a
About: tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal.
![]() ![]() |
#include <sys/types.h>
#include <sys/time.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include "tmux.h"
Go to the source code of this file.
Functions | |
static void | session_free (int, short, void *) |
static void | session_lock_timer (int, short, void *) |
static struct winlink * | session_next_alert (struct winlink *) |
static struct winlink * | session_previous_alert (struct winlink *) |
static void | session_group_remove (struct session *) |
static void | session_group_synchronize1 (struct session *, struct session *) |
int | session_cmp (struct session *s1, struct session *s2) |
RB_GENERATE (sessions, session, entry, session_cmp) | |
static int | session_group_cmp (struct session_group *s1, struct session_group *s2) |
RB_GENERATE_STATIC (session_groups, session_group, entry, session_group_cmp) | |
int | session_alive (struct session *s) |
struct session * | session_find (const char *name) |
struct session * | session_find_by_id_str (const char *s) |
struct session * | session_find_by_id (u_int id) |
struct session * | session_create (const char *prefix, const char *name, const char *cwd, struct environ *env, struct options *oo, struct termios *tio) |
void | session_add_ref (struct session *s, const char *from) |
void | session_remove_ref (struct session *s, const char *from) |
void | session_destroy (struct session *s, int notify, const char *from) |
char * | session_check_name (const char *name) |
void | session_update_activity (struct session *s, struct timeval *from) |
struct session * | session_next_session (struct session *s) |
struct session * | session_previous_session (struct session *s) |
struct winlink * | session_attach (struct session *s, struct window *w, int idx, char **cause) |
int | session_detach (struct session *s, struct winlink *wl) |
int | session_has (struct session *s, struct window *w) |
int | session_is_linked (struct session *s, struct window *w) |
int | session_next (struct session *s, int alert) |
int | session_previous (struct session *s, int alert) |
int | session_select (struct session *s, int idx) |
int | session_last (struct session *s) |
int | session_set_current (struct session *s, struct winlink *wl) |
struct session_group * | session_group_contains (struct session *target) |
struct session_group * | session_group_find (const char *name) |
struct session_group * | session_group_new (const char *name) |
void | session_group_add (struct session_group *sg, struct session *s) |
u_int | session_group_count (struct session_group *sg) |
u_int | session_group_attached_count (struct session_group *sg) |
void | session_group_synchronize_to (struct session *s) |
void | session_group_synchronize_from (struct session *target) |
void | session_renumber_windows (struct session *s) |
Variables | |
struct sessions | sessions |
static u_int | next_session_id |
struct session_groups | session_groups = RB_INITIALIZER(&session_groups) |
RB_GENERATE | ( | sessions | , |
session | , | ||
entry | , | ||
session_cmp | |||
) |
RB_GENERATE_STATIC | ( | session_groups | , |
session_group | , | ||
entry | , | ||
session_group_cmp | |||
) |
void session_add_ref | ( | struct session * | s, |
const char * | from | ||
) |
Definition at line 165 of file session.c.
References log_debug(), session::name, and session::references.
Referenced by notify_add().
int session_alive | ( | struct session * | s | ) |
Definition at line 62 of file session.c.
References sessions.
Referenced by cmd_find_valid_state(), format_cb_client_last_session(), notify_session(), session_next_session(), and session_previous_session().
Definition at line 331 of file session.c.
References winlink::idx, notify_session_window(), winlink::session, session_group_synchronize_from(), session::windows, winlink_add(), winlink_set_window(), and xasprintf().
Referenced by server_link_window().
char* session_check_name | ( | const char * | name | ) |
Definition at line 234 of file session.c.
References name, utf8_stravis(), and xstrdup().
Definition at line 44 of file session.c.
References session::name.
struct session* session_create | ( | const char * | prefix, |
const char * | name, | ||
const char * | cwd, | ||
struct environ * | env, | ||
struct options * | oo, | ||
struct termios * | tio | ||
) |
Definition at line 114 of file session.c.
References session::creation_time, session::cwd, session::environ, fatal(), session::flags, session::id, session::lastw, log_debug(), name, session::name, next_session_id, session::options, session::references, session_update_activity(), sessions, status_update_cache(), session::tio, session::windows, xasprintf(), xcalloc(), xmalloc(), and xstrdup().
void session_destroy | ( | struct session * | s, |
int | notify, | ||
const char * | from | ||
) |
Definition at line 201 of file session.c.
References session::curw, session::cwd, session::lastw, session::lock_timer, log_debug(), session::name, notify_session(), notify_session_window(), session_group_remove(), session_remove_ref(), sessions, session::tio, winlink::window, session::windows, winlink_remove(), and winlink_stack_remove().
Referenced by server_check_unattached(), server_destroy_session_group(), server_send_exit(), session_detach(), and window_tree_kill_each().
Definition at line 349 of file session.c.
References session::curw, winlink::flags, session::lastw, notify_session_window(), session_destroy(), session_group_synchronize_from(), session_last(), session_next(), session_previous(), winlink::window, session::windows, winlink_remove(), and winlink_stack_remove().
Referenced by server_kill_window(), and server_unlink_window().
struct session* session_find | ( | const char * | name | ) |
Definition at line 75 of file session.c.
References name, session::name, and sessions.
Referenced by cmd_find_get_session(), and status_prompt_complete().
struct session* session_find_by_id | ( | u_int | id | ) |
Definition at line 101 of file session.c.
References session::id, and sessions.
Referenced by cmd_mouse_window(), session_find_by_id_str(), and window_tree_pull_item().
struct session* session_find_by_id_str | ( | const char * | s | ) |
Definition at line 85 of file session.c.
References session::id, session_find_by_id(), and strtonum().
Referenced by cmd_find_get_session().
|
static |
Definition at line 184 of file session.c.
References session::environ, environ_free(), log_debug(), session::name, session::options, options_free(), and session::references.
Referenced by session_remove_ref().
void session_group_add | ( | struct session_group * | sg, |
struct session * | s | ||
) |
Definition at line 548 of file session.c.
References session_group_contains().
u_int session_group_attached_count | ( | struct session_group * | sg | ) |
Definition at line 585 of file session.c.
References session::attached.
Referenced by format_cb_session_group_attached(), and format_cb_session_group_many_attached().
|
static |
Definition at line 51 of file session.c.
References session_group::name.
struct session_group* session_group_contains | ( | struct session * | target | ) |
Definition at line 505 of file session.c.
References session_groups.
Referenced by format_cb_session_group(), format_cb_session_group_attached(), format_cb_session_group_attached_list(), format_cb_session_group_list(), format_cb_session_group_many_attached(), format_cb_session_group_size(), format_cb_session_grouped(), server_destroy_session_group(), server_link_window(), server_redraw_session_group(), server_renumber_session(), server_status_session_group(), session_group_add(), session_group_remove(), session_group_synchronize_from(), session_group_synchronize_to(), session_is_linked(), and window_tree_build().
u_int session_group_count | ( | struct session_group * | sg | ) |
Definition at line 572 of file session.c.
Referenced by format_cb_session_group_size(), and session_is_linked().
struct session_group* session_group_find | ( | const char * | name | ) |
Definition at line 521 of file session.c.
References name, session_group::name, and session_groups.
Referenced by session_group_new().
struct session_group* session_group_new | ( | const char * | name | ) |
Definition at line 531 of file session.c.
References name, session_group::name, session_group_find(), session_groups, xcalloc(), and xstrdup().
|
static |
Definition at line 556 of file session.c.
References session_group::name, session_group_contains(), and session_groups.
Referenced by session_destroy().
Definition at line 637 of file session.c.
References session::curw, winlink::flags, window::id, winlink::idx, session::lastw, notify_session_window(), winlink::session, session_last(), session_next(), session_previous(), winlink::window, session::windows, winlink_add(), WINLINK_ALERTFLAGS, winlink_find_by_index(), winlink_find_by_window_id(), winlink_remove(), and winlink_set_window().
Referenced by session_group_synchronize_from(), and session_group_synchronize_to().
void session_group_synchronize_from | ( | struct session * | target | ) |
Definition at line 617 of file session.c.
References session_group_contains(), and session_group_synchronize1().
Referenced by session_attach(), session_detach(), and spawn_window().
void session_group_synchronize_to | ( | struct session * | s | ) |
Definition at line 598 of file session.c.
References session_group_contains(), and session_group_synchronize1().
Definition at line 372 of file session.c.
References winlink::session.
Referenced by clients_with_window(), cmd_find_best_session_with_window(), cmd_find_get_window_with_session(), cmd_select_pane_exec(), default_window_size_skip_client(), recalculate_size_skip_client(), server_kill_window(), and server_status_window().
Definition at line 388 of file session.c.
References window::references, session_group_contains(), and session_group_count().
Referenced by format_cb_window_linked().
int session_last | ( | struct session * | s | ) |
Definition at line 471 of file session.c.
References session::curw, session::lastw, and session_set_current().
Referenced by session_detach(), and session_group_synchronize1().
|
static |
Definition at line 250 of file session.c.
References session::activity_time, session::attached, log_debug(), session::name, recalculate_sizes(), and server_lock_session().
Referenced by session_update_activity().
int session_next | ( | struct session * | s, |
int | alert | ||
) |
Definition at line 410 of file session.c.
References session::curw, session_next_alert(), session_set_current(), session::windows, and winlink_next().
Referenced by session_detach(), and session_group_synchronize1().
Definition at line 398 of file session.c.
References winlink::flags, WINLINK_ALERTFLAGS, and winlink_next().
Referenced by session_next().
Definition at line 297 of file session.c.
References session_alive(), and sessions.
int session_previous | ( | struct session * | s, |
int | alert | ||
) |
Definition at line 441 of file session.c.
References session::curw, session_previous_alert(), session_set_current(), session::windows, and winlink_previous().
Referenced by session_detach(), and session_group_synchronize1().
Definition at line 429 of file session.c.
References winlink::flags, WINLINK_ALERTFLAGS, and winlink_previous().
Referenced by session_previous().
Definition at line 314 of file session.c.
References session_alive(), and sessions.
void session_remove_ref | ( | struct session * | s, |
const char * | from | ||
) |
Definition at line 173 of file session.c.
References log_debug(), session::name, session::references, and session_free().
Referenced by cmd_run_shell_free(), and session_destroy().
void session_renumber_windows | ( | struct session * | s | ) |
Definition at line 694 of file session.c.
References session::curw, winlink::flags, winlink::idx, session::lastw, session::options, options_get_number(), winlink::session, winlink::window, session::windows, winlink_add(), WINLINK_ALERTFLAGS, winlink_find_by_index(), winlink_find_by_window(), winlink_remove(), and winlink_set_window().
Referenced by server_renumber_session().
int session_select | ( | struct session * | s, |
int | idx | ||
) |
Definition at line 461 of file session.c.
References winlink::idx, session_set_current(), session::windows, and winlink_find_by_index().
Referenced by server_link_window(), and spawn_window().
Definition at line 486 of file session.c.
References session::curw, session::lastw, notify_session(), tty_update_window_offset(), winlink::window, window_update_activity(), winlink_clear_flags(), winlink_stack_push(), and winlink_stack_remove().
Referenced by session_last(), session_next(), session_previous(), and session_select().
void session_update_activity | ( | struct session * | s, |
struct timeval * | from | ||
) |
Definition at line 266 of file session.c.
References session::activity_time, session::attached, session::id, session::last_activity_time, session::lock_timer, log_debug(), session::name, session::options, options_get_number(), and session_lock_timer().
Referenced by server_client_check_pane_focus(), server_client_command_done(), server_destroy_session(), and session_create().
|
static |
Definition at line 30 of file session.c.
Referenced by session_create().
struct session_groups session_groups = RB_INITIALIZER(&session_groups) |
Definition at line 30 of file session.c.
Referenced by session_group_contains(), session_group_find(), session_group_new(), and session_group_remove().
struct sessions sessions |
Definition at line 1 of file session.c.
Referenced by cmd_find_best_session(), cmd_find_best_session_with_window(), cmd_find_get_session(), cmd_list_panes_server(), cmd_list_windows_server(), format_loop_sessions(), format_session_name(), options_push_changes(), recalculate_sizes_now(), server_check_unattached(), server_kill_window(), server_loop(), server_next_detached_session(), server_next_session(), server_renumber_all(), server_send_exit(), server_start(), server_status_window(), server_update_socket(), session_alive(), session_create(), session_destroy(), session_find(), session_find_by_id(), session_next_session(), session_previous_session(), status_prompt_complete_session(), and window_tree_build().