diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-08-11 17:18:35 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-08-11 17:18:35 +0000 |
commit | f0635717b3e840a72a962a2014b18d84fac4c83a (patch) | |
tree | 579ab8805cc7d6784fb6c567dad3322a7b2a976e /tmux.h | |
parent | 60db6e3df471142e4ee7773b9b4e9b0135d61dfc (diff) | |
download | rtmux-f0635717b3e840a72a962a2014b18d84fac4c83a.tar.gz rtmux-f0635717b3e840a72a962a2014b18d84fac4c83a.tar.bz2 rtmux-f0635717b3e840a72a962a2014b18d84fac4c83a.zip |
Switch tmux to use imsg. This is the last major change to make the
client-server protocol more resilient and make the protocol versioning work
properly. In future, the only things requiring a protocol version bump will be
changes in the message structs, and (when both client and server have this
change) mixing different versions should nicely report an error message.
As a side effect this also makes the code tidier, fixes a problem with the way
errors reported during server startup were handled, and supports fd passing
(which will be used in future).
Looked over by eric@, thanks.
Please note that mixing a client with this change with an older server or vice
versa may cause tmux to crash or hang - tmux should be completely exited before
upgrading.
Diffstat (limited to 'tmux.h')
-rw-r--r-- | tmux.h | 24 |
1 files changed, 7 insertions, 17 deletions
@@ -19,12 +19,13 @@ #ifndef TMUX_H #define TMUX_H -#define PROTOCOL_VERSION -15 +#define PROTOCOL_VERSION 1 #include <sys/param.h> #include <sys/time.h> #include <sys/queue.h> #include <sys/tree.h> +#include <sys/uio.h> #include <bitstring.h> #include <getopt.h> @@ -37,6 +38,7 @@ #include <termios.h> #include "array.h" +#include "imsg.h" extern char *__progname; extern char **environ; @@ -303,23 +305,16 @@ enum msgtype { MSG_SHUTDOWN, MSG_SUSPEND, MSG_UNLOCK, + MSG_VERSION, MSG_WAKEUP, MSG_ENVIRON }; /* - * Message header and data. + * Message data. * * Don't forget to bump PROTOCOL_VERSION if any of these change! - * - * Changing sizeof (struct hdr) or sizeof (struct msg_identify_data) will make - * the tmux client hang even if the protocol version is bumped. */ -struct hdr { - enum msgtype type; - size_t size; -}; - struct msg_print_data { char msg[PRINT_LENGTH]; }; @@ -334,7 +329,6 @@ struct msg_command_data { struct msg_identify_data { char tty[TTY_NAME_MAX]; - int version; char cwd[MAXPATHLEN]; @@ -908,9 +902,7 @@ struct tty_ctx { /* Client connection. */ struct client { - int fd; - struct buffer *in; - struct buffer *out; + struct imsgbuf ibuf; struct environ environ; @@ -958,9 +950,7 @@ ARRAY_DECL(clients, struct client *); /* Client context. */ struct client_ctx { - int srv_fd; - struct buffer *srv_in; - struct buffer *srv_out; + struct imsgbuf ibuf; enum { CCTX_DETACH, |