version 1.120, 2015/04/22 15:05:03 |
version 1.121, 2015/04/22 15:30:11 |
|
|
logfile("server"); |
logfile("server"); |
log_debug("server started, pid %ld", (long) getpid()); |
log_debug("server started, pid %ld", (long) getpid()); |
|
|
ARRAY_INIT(&windows); |
RB_INIT(&windows); |
RB_INIT(&all_window_panes); |
RB_INIT(&all_window_panes); |
ARRAY_INIT(&clients); |
ARRAY_INIT(&clients); |
ARRAY_INIT(&dead_clients); |
ARRAY_INIT(&dead_clients); |
|
|
void |
void |
server_child_exited(pid_t pid, int status) |
server_child_exited(pid_t pid, int status) |
{ |
{ |
struct window *w; |
struct window *w, *w1; |
struct window_pane *wp; |
struct window_pane *wp; |
struct job *job; |
struct job *job; |
u_int i; |
|
|
|
for (i = 0; i < ARRAY_LENGTH(&windows); i++) { |
RB_FOREACH_SAFE(w, windows, &windows, w1) { |
if ((w = ARRAY_ITEM(&windows, i)) == NULL) |
|
continue; |
|
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if (wp->pid == pid) { |
if (wp->pid == pid) { |
wp->status = status; |
wp->status = status; |
|
|
{ |
{ |
struct window *w; |
struct window *w; |
struct window_pane *wp; |
struct window_pane *wp; |
u_int i; |
|
|
|
if (WSTOPSIG(status) == SIGTTIN || WSTOPSIG(status) == SIGTTOU) |
if (WSTOPSIG(status) == SIGTTIN || WSTOPSIG(status) == SIGTTOU) |
return; |
return; |
|
|
for (i = 0; i < ARRAY_LENGTH(&windows); i++) { |
RB_FOREACH(w, windows, &windows) { |
if ((w = ARRAY_ITEM(&windows, i)) == NULL) |
|
continue; |
|
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if (wp->pid == pid) { |
if (wp->pid == pid) { |
if (killpg(pid, SIGCONT) != 0) |
if (killpg(pid, SIGCONT) != 0) |
|
|
struct window *w; |
struct window *w; |
struct window_pane *wp; |
struct window_pane *wp; |
struct timeval tv; |
struct timeval tv; |
u_int i; |
|
|
|
if (options_get_number(&global_s_options, "lock-server")) |
if (options_get_number(&global_s_options, "lock-server")) |
server_lock_server(); |
server_lock_server(); |
else |
else |
server_lock_sessions(); |
server_lock_sessions(); |
|
|
for (i = 0; i < ARRAY_LENGTH(&windows); i++) { |
RB_FOREACH(w, windows, &windows) { |
w = ARRAY_ITEM(&windows, i); |
|
if (w == NULL) |
|
continue; |
|
|
|
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if (wp->mode != NULL && wp->mode->timer != NULL) |
if (wp->mode != NULL && wp->mode->timer != NULL) |
wp->mode->timer(wp); |
wp->mode->timer(wp); |