tmux  3.2a
About: tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal.
  Fossies Dox: tmux-3.2a.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

session.c File Reference
#include <sys/types.h>
#include <sys/time.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include "tmux.h"
Include dependency graph for session.c:

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 winlinksession_next_alert (struct winlink *)
 
static struct winlinksession_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 sessionsession_find (const char *name)
 
struct sessionsession_find_by_id_str (const char *s)
 
struct sessionsession_find_by_id (u_int id)
 
struct sessionsession_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 sessionsession_next_session (struct session *s)
 
struct sessionsession_previous_session (struct session *s)
 
struct winlinksession_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_groupsession_group_contains (struct session *target)
 
struct session_groupsession_group_find (const char *name)
 
struct session_groupsession_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)
 

Function Documentation

◆ RB_GENERATE()

RB_GENERATE ( sessions  ,
session  ,
entry  ,
session_cmp   
)

◆ RB_GENERATE_STATIC()

RB_GENERATE_STATIC ( session_groups  ,
session_group  ,
entry  ,
session_group_cmp   
)

◆ session_add_ref()

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().

◆ session_alive()

int session_alive ( struct session s)

◆ session_attach()

struct winlink* session_attach ( struct session s,
struct window w,
int  idx,
char **  cause 
)

◆ session_check_name()

char* session_check_name ( const char *  name)

Definition at line 234 of file session.c.

References name, utf8_stravis(), and xstrdup().

◆ session_cmp()

int session_cmp ( struct session s1,
struct session s2 
)

Definition at line 44 of file session.c.

References session::name.

◆ session_create()

struct session* session_create ( const char *  prefix,
const char *  name,
const char *  cwd,
struct environ env,
struct options oo,
struct termios *  tio 
)

◆ session_destroy()

◆ session_detach()

◆ session_find()

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().

◆ session_find_by_id()

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().

◆ session_find_by_id_str()

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().

◆ session_free()

static void session_free ( int  fd,
short  events,
void *  arg 
)
static

◆ session_group_add()

void session_group_add ( struct session_group sg,
struct session s 
)

Definition at line 548 of file session.c.

References session_group_contains().

◆ session_group_attached_count()

u_int session_group_attached_count ( struct session_group sg)

◆ session_group_cmp()

static int session_group_cmp ( struct session_group s1,
struct session_group s2 
)
static

Definition at line 51 of file session.c.

References session_group::name.

◆ session_group_contains()

◆ session_group_count()

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().

◆ session_group_find()

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().

◆ 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().

◆ session_group_remove()

static void session_group_remove ( struct session s)
static

Definition at line 556 of file session.c.

References session_group::name, session_group_contains(), and session_groups.

Referenced by session_destroy().

◆ session_group_synchronize1()

◆ session_group_synchronize_from()

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().

◆ session_group_synchronize_to()

void session_group_synchronize_to ( struct session s)

Definition at line 598 of file session.c.

References session_group_contains(), and session_group_synchronize1().

◆ session_has()

◆ session_is_linked()

int session_is_linked ( struct session s,
struct window w 
)

Definition at line 388 of file session.c.

References window::references, session_group_contains(), and session_group_count().

Referenced by format_cb_window_linked().

◆ session_last()

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().

◆ session_lock_timer()

static void session_lock_timer ( int  fd,
short  events,
void *  arg 
)
static

◆ session_next()

int session_next ( struct session s,
int  alert 
)

◆ session_next_alert()

static struct winlink * session_next_alert ( struct winlink wl)
static

Definition at line 398 of file session.c.

References winlink::flags, WINLINK_ALERTFLAGS, and winlink_next().

Referenced by session_next().

◆ session_next_session()

struct session* session_next_session ( struct session s)

Definition at line 297 of file session.c.

References session_alive(), and sessions.

◆ session_previous()

int session_previous ( struct session s,
int  alert 
)

◆ session_previous_alert()

static struct winlink * session_previous_alert ( struct winlink wl)
static

Definition at line 429 of file session.c.

References winlink::flags, WINLINK_ALERTFLAGS, and winlink_previous().

Referenced by session_previous().

◆ session_previous_session()

struct session* session_previous_session ( struct session s)

Definition at line 314 of file session.c.

References session_alive(), and sessions.

◆ session_remove_ref()

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().

◆ session_renumber_windows()

◆ session_select()

int session_select ( struct session s,
int  idx 
)

◆ session_set_current()

◆ session_update_activity()

Variable Documentation

◆ next_session_id

u_int next_session_id
static

Definition at line 30 of file session.c.

Referenced by session_create().

◆ session_groups

struct session_groups session_groups = RB_INITIALIZER(&session_groups)

◆ sessions