Success! After much debugging, I found and patched two bugs in the v0.6
code. I've got it working on AIX now, but I'm not fully satisfied with
the forkpty-aix.c code so I won't post that piece yet unless others need
it now.
The first bug fix is to madtty.c. It wasn't causing the coredump, but
was significantly slowing down the creation of new shell windows because
the for() statement would always loop maxfd times (2^16 on AIX!). The
second bug fix is a more subtle timing issue that might not cause a
problem on all systems, but it was enough to coredump on AIX. It has to
do with the re-registration of the SIGCHLD handler within
sigchld_handler() itself. It was being re-registered before the original
signal was actually handled, throwing the handler into an infinite loop.
I moved the re-registration to after the call to waitpid() and life is good.
Cheers! -Ross
--- madtty-000.c 2010-10-08 12:06:05.000000000 -0400
+++ madtty.c 2010-11-21 21:48:21.000000000 -0500
@@ -1224,7 +1224,7 @@
maxfd = sysconf(_SC_OPEN_MAX);
for (fd = 3; fd < maxfd; fd++)
- if (close(fd) == EBADF)
+ if (close(fd) == -1 && errno == EBADF)
break;
while (envp && envp[0]) {
--- dvtm-000.c 2010-10-08 12:06:05.000000000 -0400
+++ dvtm.c 2010-11-21 21:44:47.000000000 -0500
@@ -760,8 +760,6 @@
pid_t pid;
Client *c;
- signal(SIGCHLD, sigchld_handler);
-
while ((pid = waitpid(-1, &status, WNOHANG)) != 0) {
if (pid == -1) {
if (errno == ECHILD) {
@@ -776,6 +774,8 @@
c->died = true;
}
+ signal(SIGCHLD, sigchld_handler);
+
errno = errsv;
}
On 11/20/2010 04:43 AM, Marc Andre Tanner wrote:
> Hi Ross
>
> On Mon, Nov 15, 2010 at 05:06:34PM -0500, Ross Mohn wrote:
>> I've come to rely on dvtm, but I have to use AIX in my new job (ugh).
>> I'm pretty far with getting it to run on AIX but could use a little help
>> now, if possible.
>>
>> I'm working with dvtm-0.6, ncurses-5.7, gcc-4.2, AIX 6.1. With some
>> minor code tweaks and a copy of forkpty-aix.c source from the tmux-1.3
>> project I've got dvtm compiled and mostly running. I can create new
>> windows, move them around and do most everything, but as soon as I
>> destroy a window I get a segfault coredump. I'm starting to put debug
>> statements in the code, but if someone can point me in the right
>> direction it could save me a lot of time.
> Unfortunately I currently only have internet access during the weekends
> which means I can't really help.
>
> Client destruction is handled in the sigchld_handler function. Try to
> get some kind of stack strace.
>
> Please post a patch once you get it working.
>
> Thanks,
> Marc
>
Received on Mon Nov 22 2010 - 04:11:46 CET
This archive was generated by hypermail 2.2.0 : Mon Nov 22 2010 - 04:24:01 CET