On Mon, Jun 14, 2004 at 11:31:43AM -0700, Justin Walker scratched on the wall:
On Jun 14, 2004, at 11:01, 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
What about it? I've read both that and most of the source code to init. If you're looking for a philosophical definition of "single user mode" it isn't there. The init source code shows a kill with PID=-1. The kill man page implies this shouldn't really kill everything except init. It does. Booting to single user mode starts more processes than just init and a shell.
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 think most people would call mach_init a pretty core part of how OS X is /supposed/ to work. The fact that it is running in one "single user mode" and not the other implies heavily that one of these "isn't right." I don't care which one you call wrong, but they aren't the same.
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;
What do you mean by "marked for update"? That they are queued for writing? That's been the whole question all along, which you've been saying isn't true. Or are you just saying that the dirty pages are marked as dirty (well, duh...) for something else to later come along and queue them for writing?
update makes sure (via 'sync') that the dirty pages are written to disk.
Actually, all it does is queue them. It does not "make sure" of anything. If you call sync(2) and then cut the power as soon as the call returns, you can still loose data. This is the traditional reason for the old-school practice of running sync(8) three times. It provides (usually) enough time for the page system to process the queue.
You can also call 'sync' yourself.
To repeat a third time: UPDATE(8) WON'T BE RUNNING. I CANNOT CALL SYNC(8).
If you make transition to single-user mode correctly, all should work.
Define "should work." From the looks of the init(8) source code, I'll end up in single-user mode with a whole lot of dirty pages in memory. If update(8) were running (which it isn't) or if I call sync(1) (which I can't) then clearly everything would shortly end up on disk, and the minimal activity in single user mode would make additional dirty pages unlikely. But since those are not options, the question remains: does close(2) call fsync(2) (or something similar) on the file it is closing so that by the time all the processes are shut down and init decides it is in single user mode, there are no dirty pages left in memory? -j -- Jay A. Kreibich | Integration & Software Eng. jak@uiuc.edu | Campus IT & Edu. Svcs. <http://www.uiuc.edu/~jak> | University of Illinois at U/C _______________________________________________ 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.