SIGCLD vs OpenWindows & X11R6

SIGCLD vs OpenWindows & X11R6

Post by John Hax » Wed, 26 Jul 1995 04:00:00



I have a problem, the attached program when compiled with the stuff in
/usr/openwin/lib on Solaris 2.4 works just fine.  All the children are
/reaped and ^C does just the right thing.

However, and this is something of a mystery, when compiled with X11R6,
the child processes are not reaped and the signal handler for SIGCLD is
never called.  Moreover, a ^C (after the children have died) produces
three <interrupted> messages -- it would appear that the threads that
X11R6 uses are causing some problems.

Can anyone shed light on this problem?
--

ISODE Consortium                                        +44 181 332 9091

These are my opinions and have nothing to do with my employer.

-------------------
#include <stdio.h>
#include <signal.h>
#include <sys/wait.h>

#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/Xaw/Box.h>
#include <X11/Xaw/Label.h>

int tick = 5;

void h () {
    int pid;

    printf ("SIGCHLD\n");
    while ((pid = waitpid (-1, NULL, WNOHANG|WUNTRACED)) > 0) {
        printf ("reaped %d\n", pid);
        tick--;
    }
    if (tick == 0) {
        puts("got all the SIGCHLDs");
    }

Quote:}

void intr () { printf ("<interrupted>\n"); }

Widget top, box, label;
XtAppContext appctx;

Arg labelArgs[] = {
    {XtNlabel, "hello"}

Quote:};

main (int argc, char *argv[])
{
    int i;
    struct sigaction act;
    int pid;

    act.sa_handler = h;
    sigemptyset (&act.sa_mask);
    sigaction(SIGCHLD, &act, 0);

    act.sa_handler = intr;
    sigaction (SIGINT, &act, 0);

    top = XtAppInitialize(&appctx,
        "Foo",
        NULL, 0,
        &argc, argv, NULL, 0, 0);

    box = XtCreateManagedWidget ("box", boxWidgetClass, top, NULL, 0);
    label = XtCreateManagedWidget ("label", labelWidgetClass, box, labelArgs, 1);
    XtRealizeWidget (top);

    for (i = 0; i < 5; i++) {
        switch (pid = fork()) {
        case 0:
            sleep(2+i/2);
            printf ("dying\n");
            exit(0);
            break;
        default:
            printf ("child %d\n", pid);
            break;
    }
  }
  XtAppMainLoop (appctx);

Quote:}

 
 
 

SIGCLD vs OpenWindows & X11R6

Post by Casper H.S. Dik - Network Security Engine » Wed, 26 Jul 1995 04:00:00



>I have a problem, the attached program when compiled with the stuff in
>/usr/openwin/lib on Solaris 2.4 works just fine.  All the children are
>/reaped and ^C does just the right thing.
>However, and this is something of a mystery, when compiled with X11R6,
>the child processes are not reaped and the signal handler for SIGCLD is
>never called.  Moreover, a ^C (after the children have died) produces
>three <interrupted> messages -- it would appear that the threads that
>X11R6 uses are causing some problems.

The solaris FAQ says:

6.6) X11R6 on Solaris 2.4 won't run.  Xinit dies with "User Signal 1".
    Xterms won't die. Dired doesn't work in emacs-19.

    Some changes in libc.so and libthread.so break the way libthread is
    linked with libX11.so.  The most noticible symptoms are failing
    signal handling in xinit, xterms that don't die after the inferior
    shell process exits and emacs-19* after starting dired.

    Apply the following patch and rebuild libX11.so.  Remember to
    change OSMinorVersion to 4 in xc/config/cf/sun.cf as well and use
    "make Everything" or "make World", not just "make".  Make sure you
    change the right OSMinorVersion in sun.cf, the first one is the x86
    minor version, the second one is SPARC one.  Change the one
    appropriate for your system or change both.

    The resulting R6 will not run on Solaris 2.3 or earlier.
    If you want to have the same set of binaries for Solaris 2.3
    and 2.4, you need to disable threaded X altogether by changing
    "#define ThreadedX YES" to "#define ThreadedX NO" in sun.cf.

    Note that you must reinstall the X libraries with "make install"
    before things start working.  There is no need to reinstall
    anything but libX11.so.  Xterm, emacs etc., should start working
    after the change to libX11 is installed.  Check your newly
    installed libX11 with dump -Lv libX11.so.6.  If it still shows
    libthread as "NEEDED", the rebuild didn't work correctly.  Double
    check your changes.

    For multi-threaded X to work it necessary to install patch 101925-02
    to fix problems in header files [2.4].  You need to reinstall gcc
    or re-run just-fixinc after installing that patch.

    *** xc/config/cf/sunLib.tmpl.org    Sat Apr  9 01:15:25 1994
    --- xc/config/cf/sunLib.tmpl        Wed Jan 11 10:59:03 1995
    ***************
    *** 37,44 ****
    --- 37,46 ----

      #else                             /* else it's Solaris */

    + #if OSMinorVersion < 4
      #if ThreadedX
      #define SharedX11Reqs -lthread
    + #endif
      #endif
      #define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB)
      #define FixupLibReferences() /**/

    --- end of excerpt from the FAQ

Questions marked with a * or + have been changed or added since
the FAQ was last posted

The most recently posted version of the FAQ is available from
ftp.fwi.uva.nl in directory /pub/solaris
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.

 
 
 

1. The future of OpenWindows (vs. CDE/X11R6)?

Dear All,

Am I correct in thinking that OpenWindows is giving way to CDE/X11R6?
If yes, what are the (technological) reasons?

I have read several FAQs; only one had something on this issue
(the Open Look general FAQ), but it's a little old, it seems,
and anyway I'd be happy to hear more details.

So, is OpenWindows going the way of SunView?
Or will it still be around for a long time?
(`long' here means a couple of years)

Best regards,
Vassil.

--
Vassil Nikolov, visitor at LRI:
  Laboratoire de Recherche en Informatique, Universite Paris-Sud


2. I give up -- usb camera failure

3. Multiple & vs. && and | vs. || bugs in 2.4 and 2.5

4. tcsh and ftp

5. Multiple & vs. && and | vs. || bugs in 2.5.63

6. bad sectors

7. Multiple & vs. && and | vs. || bugs in 2.4.20

8. powerd/ups monitor software

9. X11R6.3's Xsun and OpenWindows lib compiled clients

10. X11R6 Xsun under Openwindows?

11. Linux vs OS2 vs NT vs Win95 vs Multics vs PDP11 vs BSD geeks

12. Opinions Wanted: Solaris 2.4 vs. AIX vs. HP/UX vs AT&T Sys5v4

13. keyboard & cde & openwindows