Thanks, Boris!  I object to referring to Terminology as an "upgrade"
to Eterm since they're completely different products (and Eterm is
way, way more stable and more performant, at least for the time
being), but I'll happily accept bug fixes.  :-)

Michael

--
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <m...@eterm.org>
Linux Server/Cluster Admin, LBL.gov       Author, Eterm (www.eterm.org)


On Tue, Jul 29, 2014 at 11:38 AM, Boris Faure <bo...@fau.re> wrote:
> On 14-07-29 17:52, Boris Faure wrote:
>> On 14-07-29 16:23, sebastien.ponc...@m4x.org wrote:
>> > Hi all,
>> >
>> >   I've recently been enabled to use Eterm after an upgrade, because it
>> > freezes on start.
>>
>> You should upgrade to Terminology :)
>>
>> >  Using strace reveals that Eterm spends 100% CPU
>> > closing all file descriptors from 0 to 65535 in a tight loop (it
>> > restarts from 0 when reaching 65535).
>> >   Attaching in gdb gave me the culprit in the code : command.c lines
>> > 1562 to 1679, reproduced here :
>> >
>> >     /*
>> >      * Close all file descriptors.  If only stdin/out/err are closed,
>> >      * child processes remain alive upon deletion of the window.
>> >      */
>> >     {
>> >         unsigned short i;
>> >         unsigned long max_fds;
>> >
>> >         /* get number of available file descriptors */
>> > #ifdef _POSIX_VERSION
>> >         max_fds = sysconf(_SC_OPEN_MAX);
>> > #else
>> >         max_fds = getdtablesize();
>> > #endif
>> >
>> >         D_TTY(("Closing file descriptors 0-%d.\n", max_fds));
>> >         for (i = 0; i < max_fds; i++) {
>> >             if (i != fd)
>> >                 close(i);
>> >         }
>> >         D_TTY(("...closed.\n"));
>> >     }
>> >
>> > Guess what happens if sysconf(_SC_OPEN_MAX) returns 65536....
>> > A simple fix is to change the declaration of i to unsigned int. Although
>> > I'm not sure this loop is very efficient.
>>
>> It should be turned into unsigned long, just like max_fds. I'll make the
>> patch tonight if nobody did it before.
>
> It's done, as a "long" since sysconf() returns a long and
> getdtablesize() returns an int.
>
> --
> Boris Faure
> Pointer Arithmetician
>
> ------------------------------------------------------------------------------
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to