# cmd_attach_session

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L51
- **Page:** https://libtmux.org/en/tmux/3.7c/reference/c-function-cmd_attach_session/

```c
enum cmd_retval cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag, int xflag, int rflag, const char *cflag, int Eflag, const char *fflag)
```

## Parameters

- `item` (`struct cmdq_item *`)
- `tflag` (`const char *`)
- `dflag` (`int`)
- `xflag` (`int`)
- `rflag` (`int`)
- `cflag` (`const char *`)
- `Eflag` (`int`)
- `fflag` (`const char *`)

## Called by

- [`cmd_attach_session_exec`](/en/tmux/3.7c/reference/c-function-cmd-attach-session-c-cmd_attach_session_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L181)
- [`cmd_new_session_exec`](/en/tmux/3.7c/reference/c-function-cmd-new-session-c-cmd_new_session_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-new-session.c#L128)

## Calls

- [`cfg_show_causes`](/en/tmux/3.7c/reference/c-function-cfg_show_causes/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L171)
- [`cmd_find_from_winlink`](/en/tmux/3.7c/reference/c-function-cmd_find_from_winlink/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L100)
- [`cmd_find_from_winlink_pane`](/en/tmux/3.7c/reference/c-function-cmd_find_from_winlink_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L98)
- [`cmd_find_target`](/en/tmux/3.7c/reference/c-function-cmd_find_target/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L87)
- [`cmdq_error`](/en/tmux/3.7c/reference/c-function-cmdq_error/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L67)
- [`cmdq_get_client`](/en/tmux/3.7c/reference/c-function-cmdq_get_client/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L58)
- [`cmdq_get_current`](/en/tmux/3.7c/reference/c-function-cmdq_get_current/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L54)
- [`environ_update`](/en/tmux/3.7c/reference/c-function-environ_update/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L135)
- [`format_single`](/en/tmux/3.7c/reference/c-function-format_single/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L104)
- [`notify_client`](/en/tmux/3.7c/reference/c-function-notify_client/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L166)
- [`proc_get_peer_uid`](/en/tmux/3.7c/reference/c-function-proc_get_peer_uid/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L112)
- [`proc_send`](/en/tmux/3.7c/reference/c-function-proc_send/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L165)
- [`server_client_check_nested`](/en/tmux/3.7c/reference/c-function-server_client_check_nested/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L74)
- [`server_client_detach`](/en/tmux/3.7c/reference/c-function-server_client_detach/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L131)
- [`server_client_open`](/en/tmux/3.7c/reference/c-function-server_client_open/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L141)
- [`server_client_set_flags`](/en/tmux/3.7c/reference/c-function-server_client_set_flags/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L109)
- [`server_client_set_key_table`](/en/tmux/3.7c/reference/c-function-server_client_set_key_table/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L139)
- [`server_client_set_session`](/en/tmux/3.7c/reference/c-function-server_client_set_session/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L137)
- [`session_set_current`](/en/tmux/3.7c/reference/c-function-session_set_current/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L96)
- [`window_set_active_pane`](/en/tmux/3.7c/reference/c-function-window_set_active_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-attach-session.c#L95)

## Other function references

- [`cmdq_get_flags`](/en/tmux/3.7c/reference/c-function-cmdq_get_flags/) (function)

## Referenced declarations

- [`cfg_finished`](/en/tmux/3.7c/reference/c-variable-cfg_finished/) (attribute)
- [`CLIENT_ATTACHED`](/en/tmux/3.7c/reference/c-define-tmux-h-client_attached/) (constant)
- [`CLIENT_CONTROL`](/en/tmux/3.7c/reference/c-define-tmux-h-client_control/) (constant)
- [`CLIENT_IGNORESIZE`](/en/tmux/3.7c/reference/c-define-tmux-h-client_ignoresize/) (constant)
- [`CLIENT_READONLY`](/en/tmux/3.7c/reference/c-define-tmux-h-client_readonly/) (constant)
- [`CMD_FIND_PANE`](/en/tmux/3.7c/reference/c-enum-cmd_find_type-cmd_find_pane/) (constant)
- [`CMD_FIND_PREFER_UNATTACHED`](/en/tmux/3.7c/reference/c-define-tmux-h-cmd_find_prefer_unattached/) (constant)
- [`CMD_FIND_SESSION`](/en/tmux/3.7c/reference/c-enum-cmd_find_type-cmd_find_session/) (constant)
- [`CMD_RETURN_ERROR`](/en/tmux/3.7c/reference/c-enum-cmd_retval-cmd_return_error/) (constant)
- [`CMD_RETURN_NORMAL`](/en/tmux/3.7c/reference/c-enum-cmd_retval-cmd_return_normal/) (constant)
- [`cmd_retval`](/en/tmux/3.7c/reference/c-enum-cmd_retval/) (enum)
- [`cmdq_item`](/en/tmux/3.7c/reference/c-struct-cmdq_item/) (struct)
- [`CMDQ_STATE_REPEAT`](/en/tmux/3.7c/reference/c-define-tmux-h-cmdq_state_repeat/) (constant)
- [`cmd_find_state.current`](/en/tmux/3.7c/reference/c-struct-cmd_find_state-current/) (attribute)
- [`session.cwd`](/en/tmux/3.7c/reference/c-struct-session-cwd/) (attribute)
- [`window_pane.cwd`](/en/tmux/3.7c/reference/c-struct-window_pane-cwd/) (attribute)
- [`window_pane.entry`](/en/tmux/3.7c/reference/c-struct-window_pane-entry/) (attribute)
- [`client.environ`](/en/tmux/3.7c/reference/c-struct-client-environ/) (attribute)
- [`session.environ`](/en/tmux/3.7c/reference/c-struct-session-environ/) (attribute)
- [`client.flags`](/en/tmux/3.7c/reference/c-struct-client-flags/) (attribute)
- [`cmd_find_state.flags`](/en/tmux/3.7c/reference/c-struct-cmd_find_state-flags/) (attribute)
- [`window_pane.flags`](/en/tmux/3.7c/reference/c-struct-window_pane-flags/) (attribute)
- [`client.last_session`](/en/tmux/3.7c/reference/c-struct-client-last_session/) (attribute)
- [`MSG_DETACH`](/en/tmux/3.7c/reference/c-enum-msgtype-msg_detach/) (constant)
- [`MSG_DETACHKILL`](/en/tmux/3.7c/reference/c-enum-msgtype-msg_detachkill/) (constant)
- [`MSG_READY`](/en/tmux/3.7c/reference/c-enum-msgtype-msg_ready/) (constant)
- [`session.options`](/en/tmux/3.7c/reference/c-struct-session-options/) (attribute)
- [`client.peer`](/en/tmux/3.7c/reference/c-struct-client-peer/) (attribute)
- [`cmd_find_state.s`](/en/tmux/3.7c/reference/c-struct-cmd_find_state-s/) (attribute)
- [`client.session`](/en/tmux/3.7c/reference/c-struct-client-session/) (attribute)
- [`window_pane.window`](/en/tmux/3.7c/reference/c-struct-window_pane-window/) (attribute)
- [`cmd_find_state.wl`](/en/tmux/3.7c/reference/c-struct-cmd_find_state-wl/) (attribute)
- [`cmd_find_state.wp`](/en/tmux/3.7c/reference/c-struct-cmd_find_state-wp/) (attribute)
