On Jun 14, 2004, at 11:01, Jay A. Kreibich wrote: On Mon, Jun 14, 2004 at 09:35:24AM -0700, Justin Walker scratched on the wall: On Jun 14, 2004, at 8:11, Jay A. Kreibich wrote: [snip] The point of being in single-user mode is that nothing happens without your executing it directly. There should be no 'background' jobs running, including 'update'. But the way you get into single user mode is that init issues a kill(2) with a PID of -1. According to the kill(2) man page this causes "the signal is sent to all processes excluding system processes and the process sending the signal." In truth, it kills EVERYTHING except init (the process sending the signal). That includes somewhat useful processes like mach_init (PID=2), without which the OS is, shall we say, somewhat limited. man init The "single user mode" you get on boot, and the "single user mode" you get via a SIGTERM to init(1) are two different things. Not really. I also can't sync(1) manually after the system is in single user mode because init will kill my script, as well as everything else. Can you make your process sensitive to the shutdown protocol (catch SIGTERM) and do the close at that point? Yes. init(2) sends SIGHUPs, SIGTERMs, and finally SIGKILLs to each process before the transition, but it does not call sync(2) itself. I'm assuming the stuff running is written well enough to catch the HUP or TERM correctly and shut themselves down. Even if they aren't, the kernel should clean up after the processes and close(2) all the active file descriptors for each process. The kernel does exactly that. Reacting to the SIGHUP is likely to generate dirty buffer pages that need to be written to disk, however, only now update(8) isn't running. For example, if the software is smart enough to check-point, it is very likley to generate I/O, which will dirty pages that need to get written out before I remove power. Hence, the quesiton on if close(2) will take care of the dirty work. To repeat: 'close' makes sure that the pages are marked for update; update makes sure (via 'sync') that the dirty pages are written to disk. You can also call 'sync' yourself. The kernel is not the place where policy decisions are made; hence the separation between the kernel and 'sync'. The decision to keep writing dirty pages to the backing store is made in user mode. If you make transition to single-user mode correctly, all should work. Regards, Justin -- Justin C. Walker, Curmudgeon-At-Large * Institute for General Semantics | Men are from Earth. | Women are from Earth. | Deal with it. *--------------------------------------*-------------------------------* _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.