Commit Graph

117 Commits (54ca7b230d08aae0b2028f3f82a259963017c167)

Author SHA1 Message Date
nicm b496b1fe11 Move cfg_causes local into cfg.c and remove struct causelist. 2014-10-27 22:23:47 +00:00
nicm 733cea8847 Wake up any clients waiting with the wait-for command when the server
exits.
2014-09-01 21:58:41 +00:00
nicm 8e4ae12b4d lockf is entirely useless and it was a mistake to change to it, go back
to using flock which actually works sensibly. Also always retry the lock
to fix a potential race, and add some extra logging.
2014-07-21 10:52:48 +00:00
nicm 53cbae544f Now that cmdlists are reference counted, there is no need for two-step
deletion via the dead_key_bindings tree. From Keith Amling.
2014-05-14 06:21:19 +00:00
nicm bec6c807cd There is no longer a need for a paste_stack struct or for global_buffers
to be global. Move to paste.c.
2014-04-24 09:14:43 +00:00
nicm a5d4b7f3d9 Some more long lines. 2014-04-17 14:45:49 +00:00
nicm bf35441608 Do not run any command line command from the client which starts the
server until after the configuration file completes. This prevents it
racing against run-shell or if-shell in .tmux.conf that run in the
background.
2013-10-20 17:28:43 +00:00
Nicholas Marriott e323101ede Rename global configuration define. 2013-04-24 10:01:32 +00:00
Nicholas Marriott 20636d956d Add a command queue to standardize and simplify commands that call other
commands and allow a command to block execution of subsequent
commands. This allows run-shell and if-shell to be synchronous which has
been much requested.

Each client has a default command queue and commands are consumed one at
a time from it. A command may suspend execution from the queue by
returning CMD_RETURN_WAIT and then resume it by calling cmd_continue() -
for example run-shell does this from the callback that is fired after
the job is freed.

When the command queue becomes empty, command clients are automatically
exited (unless attaching). A callback is also fired - this is used for
nested commands in, for example, if-shell which can block execution of
the client's cmdq until a new cmdq becomes empty.

Also merge all the old error/info/print functions together and lose the
old curclient/cmdclient distinction - a cmdq is bound to one client (or
none if in the configuration file), this is a command client if
c->session is NULL otherwise an attached client.
2013-03-24 09:54:10 +00:00
Nicholas Marriott 8d59b189cc No more lint means no more ARGSUSED. 2013-03-22 10:31:22 +00:00
Nicholas Marriott 8378be03d1 Fix argument order in a log statement. 2012-12-06 12:49:13 +00:00
Nicholas Marriott 827b311c81 Use a utility function for common code to show errors in config file,
from Thomas Adam.
2012-11-19 10:38:06 +00:00
Nicholas Marriott df912e3540 xfree is not particularly helpful, remove it. From Thomas Adam. 2012-07-10 11:53:01 +00:00
Nicholas Marriott 6703ca8d26 Stop accepting new clients for 1 second on EMFILE/ENFILE. Based on
ongoing fixes to other daemons by Theo.
2012-04-11 06:16:14 +00:00
Nicholas Marriott ac9ebc29a2 Use a lock file and flock() to serialize server start, avoids problems
when running a bunch of tmux from cron at the same time. Based on a diff
from Tim Ruehsen.
2012-03-09 09:57:40 +00:00
Nicholas Marriott 808502ac3d Give each pane created in a tmux server a unique id (starting from 0),
put it in the TMUX_PANE environment variable and accept it as a
target. Suggested by and with testing and tweaks from Ben Boeckel.
2011-03-27 20:27:26 +00:00
Nicholas Marriott 4dfb29fa38 Use LIST_* not SLIST_*. 2011-01-26 00:11:47 +00:00
Nicholas Marriott 69cb1f830e Move all calls to fcntl(...O_NONBLOCK) into a function and clear the
flag on the stdio file descriptors before closing them (fixes things
like "tmux ls && cat").
2011-01-08 01:52:36 +00:00
Nicholas Marriott 04b32fa734 Don't reset the activity timer for unattached sessions every second,
this screws up the choice of most-recently-used. Instead, break the time
update into a little function and do it when the session is attached.

Pointed out by joshe@.
2011-01-01 01:12:09 +00:00
Nicholas Marriott cc42614fa9 Change from a per-session stack of buffers to one global stack which is
much more convenient and also simplifies lot of code. This renders
copy-buffer useless and makes buffer-limit now a server option.

By Tiago Cunha.
2010-12-30 23:16:18 +00:00
Nicholas Marriott acf13ce978 Store sessions in an RB tree by name rather than a list, this is tidier
and allows them to easily be shown sorted in various lists
(list-sessions/choose-sessions).

Keep a session index which is used in a couple of places internally but
make it an ever-increasing number rather than filling in gaps with new
sessions.
2010-12-21 22:37:59 +00:00
Nicholas Marriott 248fb14f08 Merge the before and after attach client code into one in client.c
(instead of two in tmux.c and client.c).
2010-10-18 20:00:02 +00:00
Nicholas Marriott f56b4ec2ff Trying to set FD_CLOEXEC on every fd is a lost cause, just use
closefrom() before exec.
2010-10-16 08:31:55 +00:00
Nicholas Marriott 9a7cde0c9b Two new options:
- server option "exit-unattached" makes the server exit when no clients
  are attached, even if sessions are present;

- session option "destroy-unattached" destroys a session once no clients
  are attached to it.

These are useful for preventing tmux remaining in the background where
it is undesirable and when using tmux as a login shell to keep a limit
on new sessions.
2010-09-26 20:43:30 +00:00
Nicholas Marriott 66152010a7 Modify the permissions on the socket when adding or removing +x to show
attached sessions, rather than replacing them.
2010-09-26 18:51:48 +00:00
Nicholas Marriott e3be9b1951 Do not call event_del() for signals after fork(), just use sigaction()
directly instead - calling libevent functions after fork() w/o
event_reinit() is a bad idea, even if in this case it was harmless.
2010-08-19 18:29:01 +00:00
Theo Deraadt 4274a7ec89 switch back to kqueue for now, since (a) kqueue has been fixed to deal
with strange devices and (b) since there appears to be a bull in the
poll code in libevent as well...
requested by nicm who is away
2010-08-04 19:46:13 +00:00
Nicholas Marriott bf09b00fe9 kqueue(2) is currently broken when used with /dev/null and a few other
devices.

An upcoming fix for some problems with the client stdout/stderr handling
relies on it working, so make tmux force libevent to use poll(2) via
EVENT_NOKQUEUE, until we have fixed kqueue.
2010-07-24 19:25:31 +00:00
Nicholas Marriott ad466a69aa Give tmux sockets (but not the containing folder) group
permissions. This allows hardlinks to the sockets to be used more
easily.
2010-06-21 00:18:57 +00:00
Nicholas Marriott c4a2fdf15b Put this back in with the initialisation in the right order. 2010-05-04 17:28:16 +00:00
Nicholas Marriott af5e0bd15a Revert last change, it appears to be broken somehow. 2010-05-04 08:48:06 +00:00
Nicholas Marriott ec1d37b1b2 Make signal handler setup/teardown two common functions instead of six,
and reset SIGCHLD after fork to fix problems with some shells. From
Romain Francois.
2010-05-03 16:06:32 +00:00
Nicholas Marriott ac9daf92d7 Merge copy mode and output mode, dropping the latter. Idea and code from
Micah Cowan.
2010-04-06 21:35:44 +00:00
Nicholas Marriott 509ce7f766 Nuke unused variable. 2010-03-22 19:11:54 +00:00
Nicholas Marriott 4651180503 Use the array.h code for the causes list. 2010-02-06 23:22:27 +00:00
Nicholas Marriott 8aba77b7be Instead of bailing out on the first configuration file error, carry on,
collecting all the errors, then start with the active window in more mode
displaying them.
2010-02-06 17:15:33 +00:00
Nicholas Marriott 65c9004550 Ignore SIGHUP as well. 2010-01-30 19:05:18 +00:00
Nicholas Marriott 15a64b805e Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...
2009-12-03 22:50:09 +00:00
Nicholas Marriott 459e9de81a Close the pane if the process died due to a signal, not just if it exited
normally.
2009-12-02 15:06:14 +00:00
Nicholas Marriott 4ca857e0e9 Remove a couple of unused arguments where possible, and add /* ARGSUSED */ to
the rest to reduce lint output.
2009-11-26 21:37:13 +00:00
Nicholas Marriott 8e47966225 Destroy panes immediately rather than checking them all every loop. 2009-11-13 17:33:07 +00:00
Nicholas Marriott 08a8ccf46b Free the pane bufferevent when the fd is closed (the signal could come before
the error callback).
2009-11-11 13:24:42 +00:00
Nicholas Marriott 2756437f4b Only need to chmod +x or -x the socket when a client is created, lost or
attached, rather than every event loop.
2009-11-11 08:00:42 +00:00
Nicholas Marriott 25c604fb1c EVLOOP_ONCE takes care of the wakeup, so no need to call event_loopexit(NULL). 2009-11-05 08:50:32 +00:00
Nicholas Marriott 38e13942ac Now all timers are events, there is no longer any need to wake up every 50 ms -
only wake up when an event happens.
2009-11-05 08:48:15 +00:00
Nicholas Marriott 946ed97273 Move status timer check into the global once-per-second timer, this could maybe
be done better but one every second is better than once every 50 ms.
2009-11-04 23:42:51 +00:00
Nicholas Marriott b3c4956efe Don't reenlist the client imsg event every loop, instead have a small function
to it and call it after the event triggers or after a imsg is added.
2009-11-04 23:12:43 +00:00
Nicholas Marriott fde36fccc3 Tell the client to exit on configuration file error. 2009-11-04 22:47:34 +00:00
Nicholas Marriott a02c7e804c Convert the window pane (pty master side) fd over to use a bufferevent.
The evbuffer API is very similar to the existing tmux buffer API so this was
remarkably painless. Not many possible ways to do it, I suppose.
2009-11-04 22:43:11 +00:00
Nicholas Marriott 06ffed3216 Call event_init() before loading the config file, since potentially it could
set up events.
2009-11-04 22:40:36 +00:00