diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-08-14 21:04:04 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-08-14 21:04:04 +0000 |
commit | a9b6bfdddd570753e52dca73169f70864502c38c (patch) | |
tree | bc259ba79ba2ddddd5579857ccaad69eef5d55d4 /tmux.h | |
parent | a604dfbb979c994ee7fb068416e0b60c95ce2198 (diff) | |
download | rtmux-a9b6bfdddd570753e52dca73169f70864502c38c.tar.gz rtmux-a9b6bfdddd570753e52dca73169f70864502c38c.tar.bz2 rtmux-a9b6bfdddd570753e52dca73169f70864502c38c.zip |
Sync OpenBSD patchset 243:
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 | 26 |
1 files changed, 8 insertions, 18 deletions
@@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.409 2009-08-11 14:42:59 nicm Exp $ */ +/* $Id: tmux.h,v 1.410 2009-08-14 21:04:04 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -21,10 +21,11 @@ #include "config.h" -#define PROTOCOL_VERSION -15 +#define PROTOCOL_VERSION 1 #include <sys/param.h> #include <sys/time.h> +#include <sys/uio.h> #include <limits.h> #include <signal.h> @@ -34,6 +35,7 @@ #include <termios.h> #include "array.h" +#include "imsg.h" #include "compat.h" @@ -302,23 +304,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]; }; @@ -333,7 +328,6 @@ struct msg_command_data { struct msg_identify_data { char tty[TTY_NAME_MAX]; - int version; char cwd[MAXPATHLEN]; @@ -907,9 +901,7 @@ struct tty_ctx { /* Client connection. */ struct client { - int fd; - struct buffer *in; - struct buffer *out; + struct imsgbuf ibuf; struct environ environ; @@ -957,9 +949,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, |