|
From: | Steven Tamm |
Subject: | Re: Mac OS X: Rebuild Require after Security Update 2002-11-21 |
Date: | Tue, 26 Nov 2002 08:31:13 -0800 |
The apple version of emacs includes this code around ever call to vfork. #ifndef PUMA_VFORK_ISSUES_CLEARED_UP pid = fork (); #else pid = vfork (); #endifApparently, puma vfork issues are not cleared up, so it appears the answer is to use fork. I started to do some debugging of this issue, but the fact that after every run the computer hangs makes things quite annoying. I narrowed down the problem (I think).
This code works: #include <sys/types.h> #include <unistd.h> int main(int argc, char **argv) { pid_t parent = getpid(); pid_t child; printf("Parent pid %x\n", parent); child = vfork(); if (child < 0) { perror("vfork"); _exit(2); } if (!child) { printf("Child pid %x\n", getpid()); printf("Bad exec return %d\n", execv("/nofile/noplace", argv)); _exit(1); } return 0; }If you remove the _exit(1), it causes a nasty seg fault (it seems to blow away the entire state of the process). If you remove the _exit(1) and switch to fork() it works. So I think the problem may be with vfork not correctly cleaning up after itself if the process goes kablooy. Andrew, did you report a radar issue associated with this?
A couple other people tried to switch bash to use vfork, because in later darwin releases the performance of fork seems to have gotten worse. They found similar issues with the system hanging. http://lists.apple.com/archives/darwin-kernel/2002/Oct/02/ forkexecperformance.txt
-Steven
/* The following solves the problem that Emacs hangs when evaluating (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile does not exist. */ #undef HAVE_WORKING_VFORK #define vfork fork #define DONT_REOPEN_PTYI just tried removing these three lines and Emacs (in fact OS X!) stillhangs when evaluating that expression.Does it really freeze the kernel or just the UI or just Emacs ? If it freezes the kernel, post it to bugtraq as a DoS issue and it should get fixed within a few days. Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |