Subject: Re: new sysctl(KERN_PROC, ...) interface (was: sysinfo(2))
To: None <email@example.com>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 04/15/2000 22:11:56
> What about the make snapshot, return snapshot split.
> sysctl(KINFO_PROC2) with a total length of zero would take a snapshot
> of the processes at that point, save it until the next call with a
> non-zero total length, and return the number of entries needed. Then
> the program doing the sysctl could allocate exactly as much memory as
> needed and do another call with a non-zero length to get the saved
> data back.
The biggest problem with this, it seems to me, is, where do you store
the snapshot? It has to be somehow associated with the calling
process, or you can easily have two processes racing against one
another. But even if you hang it off the process (somehow), you still
have reentrancy problems - the strtok() problem, to put it loosely.
Unless you can somehow invent a handle that the snapshot call can pass
back to the process, which would then be handed back to the
read-snapshot call...at which point it seems to me you might as well
call that handle a file descriptor and go with kernfs and/or procfs,
since sysctl is already hopeless on kernel corpses.
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B