On Fri, 29 Apr 2005, Alexander Gottwald wrote: >> uhh, don't you mean System(), Popen() and Pclose() ? > > No. I mean Fopen. This is the only place where /bin/cat is mentioned.
oh yes, ok, I see now. thanks. >> They're contained within an entire "#if !defined(WIN32)" stanza and I'm not >> sure what that means with respect to Cygwin. > > WIN32 is only for mingw and native compiler like msvc. ok. first time looking through XWin source, so I am completely unfamiliar with its cpp vars. > I've compiled XWin with HAS_SAVED_IDS_AND_SETEUID in os/utils.c > http://www.freedesktop.org/~ago/XWin.exe.bz2 > > Feel free to try. thanks! I did try, and it behaved like this: 1. with "-kb" (kb ext disabled) it starts up just fine. 2. without "-kb" it 'hangs' with sh consuming >90% CPU right after the 'Rules' line. Ending the sh process causes XWin to wake back up and finish starting up then runs just fine. An interesting code pattern I see (and am not sure if it's significant) in os/utils.c: [paraphrasing] Popen() { . . switch (pid = fork()) { . . execl("/bin/sh", "sh", "-c", command, (char *)NULL); _exit(127); } /* Avoid EINTR during stdio calls */ OsBlockSignals (); . . } Pclose(){ . . do { pid = waitpid(cur->pid, &pstat, 0); } while (pid == -1 && errno == EINTR); . . /* allow EINTR again */ OsReleaseSignals (); . . } // with SIGCHLD set to SIG_IGN/SIG_BLOCK, then waitpid() should never be interrupted // by a signal and will never exit with EINTR. It may exit with ECHILD, though. // Does Cygwin behave the same way? [more paraphrasing -- this next bit is more interesting to me] Fopen(){ . . #ifndef HAS_SAVED_IDS_AND_SETEUID switch (pid = fork()) { . . execl("/bin/cat", "cat", file, (char *)NULL); _exit(127); } /* Avoid EINTR during stdio calls */ OsBlockSignals (); . . #else . . } Fclose(){ #ifdef HAS_SAVED_IDS_AND_SETEUID return fclose(iop); #else return Pclose(iop); #endif } // any chance at all what I'm seeing has something to do with the EINTR || ECHILD possibility above?