Ah, I see.

Anyways attached is my patch.  It's a bit of a quick hack, and will no
doubt need some cleanup if incorporated. It perhaps has two things
going for it:
a) Support for libevent earlier than 1.4.14.  (Probably a small point
-- my work-provided system is very old, and I have trouble upgrading.)
b) After the patch, there's a call to set_signals(main_signal)
immediately followed by a call to clear_signals(0).  I don't know much
about either call, but it smells like an opportunity for optimization.

Drew


On Mon, Sep 20, 2010 at 1:16 PM, Nicholas Marriott
<nicholas.marri...@gmail.com> wrote:
> there were bugs with event_reinit() in early 1.4, they were fixed by
> 1.4.14
>
>
> On Mon, Sep 20, 2010 at 12:56:19PM -0700, Drew Folta wrote:
>> I had a similar problem with libevent-1.4.3.  The event_reinit() call
>> was failing.  I was able to fix it by hacking up the tmux code to call
>> event_init() -after- the fork.  (Had to move where set_signals() was
>> called too.)
>>
>> Drew
>>
>>
>> On Mon, Sep 20, 2010 at 12:46 PM, Kris Malfettone <montu...@gmail.com> wrote:
>> > tmux-1.3
>> > libevent-1.4.14b-stable
>> >
>> > On Sep 20, 2010 3:43 PM, "Nicholas Marriott" <nicholas.marri...@gmail.com>
>> > wrote:
>> >> what versions?
>> >>
>> >>
>> >> On Mon, Sep 20, 2010 at 01:25:01PM -0400, Kris Malfettone wrote:
>> >>> Hi all,
>> >>> I have compiled both libevent and tmux from source on a 64 bit suse 10
>> >>> machine.* Bot complete but when I run tmux I see a blank screen with the
>> >>> status bar at the bottom, but no prompt.* When I hit any key the message
>> >>> [lost server] appears and both processes have exitted.* After further
>> >>> inspection the server process is seg faulting on line 442 of tty-keys.c
>> >>> because "tty->event->input" is null.
>> >>>
>> >>> I have tried searching online and the mailing list but to no avail.* Does
>> >>> anyone have any guidance to what I need to do to fix this problem?
>> >>
>> >>>
>> >>> ------------------------------------------------------------------------------
>> >>> Start uncovering the many advantages of virtual appliances
>> >>> and start using them to simplify application deployment and
>> >>> accelerate your shift to cloud computing.
>> >>> http://p.sf.net/sfu/novell-sfdev2dev
>> >>
>> >>> _______________________________________________
>> >>> tmux-users mailing list
>> >>> tmux-users@lists.sourceforge.net
>> >>> https://lists.sourceforge.net/lists/listinfo/tmux-users
>> >>
>> >
>> > ------------------------------------------------------------------------------
>> > Start uncovering the many advantages of virtual appliances
>> > and start using them to simplify application deployment and
>> > accelerate your shift to cloud computing.
>> > http://p.sf.net/sfu/novell-sfdev2dev
>> > _______________________________________________
>> > tmux-users mailing list
>> > tmux-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/tmux-users
>> >
>> >
>
Index: client.c
===================================================================
RCS file: /cvsroot/tmux/tmux/client.c,v
retrieving revision 1.97
diff -u -p -r1.97 client.c
--- client.c	29 Aug 2010 14:44:55 -0000	1.97
+++ client.c	20 Sep 2010 20:03:44 -0000
@@ -90,6 +90,9 @@ client_init(char *path, int cmdflags, in
 	}
 
 server_started:
+    tmux_event_init();
+    set_signals(main_signal);
+
 	if ((mode = fcntl(fd, F_GETFL)) == -1)
 		fatal("fcntl failed");
 	if (fcntl(fd, F_SETFL, mode|O_NONBLOCK) == -1)
Index: server.c
===================================================================
RCS file: /cvsroot/tmux/tmux/server.c,v
retrieving revision 1.243
diff -u -p -r1.243 server.c
--- server.c	29 Aug 2010 14:42:11 -0000	1.243
+++ server.c	20 Sep 2010 20:03:44 -0000
@@ -140,9 +140,8 @@ server_start(char *path)
 	if (daemon(1, 0) != 0)
 		fatal("daemon failed");
 
-	/* event_init() was called in our parent, need to reinit. */
-	if (event_reinit(ev_base) != 0)
-		fatal("event_reinit failed");
+	tmux_event_init();
+	set_signals(main_signal);
 	clear_signals(0);
 
 	logfile("server");
Index: tmux.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.c,v
retrieving revision 1.215
diff -u -p -r1.215 tmux.c
--- tmux.c	29 Aug 2010 14:42:11 -0000	1.215
+++ tmux.c	20 Sep 2010 20:03:44 -0000
@@ -229,6 +229,26 @@ shell_exec(const char *shell, const char
 	fatal("execl failed");
 }
 
+void
+tmux_event_init(void)
+{
+#ifdef HAVE_BROKEN_KQUEUE
+	if (setenv("EVENT_NOKQUEUE", "1", 1) != 0)
+		fatal("setenv failed");
+#endif
+#ifdef HAVE_BROKEN_POLL
+	if (setenv("EVENT_NOPOLL", "1", 1) != 0)
+		fatal("setenv failed");
+#endif
+	ev_base = event_init();
+#ifdef HAVE_BROKEN_KQUEUE
+	unsetenv("EVENT_NOKQUEUE");
+#endif
+#ifdef HAVE_BROKEN_POLL
+	unsetenv("EVENT_NOPOLL");
+#endif
+}
+
 int
 main(int argc, char **argv)
 {
@@ -535,23 +555,6 @@ main(int argc, char **argv)
 		exit(1);
 	}
 
-#ifdef HAVE_BROKEN_KQUEUE
-	if (setenv("EVENT_NOKQUEUE", "1", 1) != 0)
-		fatal("setenv failed");
-#endif
-#ifdef HAVE_BROKEN_POLL
-	if (setenv("EVENT_NOPOLL", "1", 1) != 0)
-		fatal("setenv failed");
-#endif
-	ev_base = event_init();
-#ifdef HAVE_BROKEN_KQUEUE
-	unsetenv("EVENT_NOKQUEUE");
-#endif
-#ifdef HAVE_BROKEN_POLL
-	unsetenv("EVENT_NOPOLL");
-#endif
-	set_signals(main_signal);
-
 	/* Initialise the client socket/start the server. */
 	if ((main_ibuf = client_init(path, cmdflags, flags)) == NULL)
 		exit(1);
Index: tmux.h
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.h,v
retrieving revision 1.577
diff -u -p -r1.577 tmux.h
--- tmux.h	18 Sep 2010 15:43:53 -0000	1.577
+++ tmux.h	20 Sep 2010 20:03:44 -0000
@@ -1298,6 +1298,8 @@ void		 logfile(const char *);
 const char	*getshell(void);
 int		 checkshell(const char *);
 int		 areshell(const char *);
+void        tmux_event_init(void);
+void        main_signal(int sig, unused short events, unused void *data);
 
 /* cfg.c */
 extern int       cfg_finished;
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to