[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Fopen() and cache



On Wed, 2005-03-23 at 10:12 +0100, Olivier Landemarre wrote:
Frank Naumann wrote:

> Hello!
>
>> I have a small problem with Fopen() with Mint
>>
>> I try to do Fopen("U:\\PROC\theprog.id",2)

Why 2 slashes and then one?  I submitted a hack a long time ago that allowed the other slash to work for most file systems (not TOS/FAT, but definately U:) - not sure if that was pulled back out again.


> I don't understand what do you mean. Btw. what do you want todo?
>
Verify software is still in live.

If you launched the program as a child process, you'll get a SIGCHLD when the program dies.  That is much easier (and more efficient) than polling.

However, I would agree that there shouldn't be a cache on the /proc filesystem.   I remember all the hell I took over the filecookie cache stuff (could generate problems under strange conditions, so it was just disabled and eventually removed instead of being fixed - but it sped up some file operations by a factor of 2), and that wasn't even turned on for /proc, /pipe, /dev or TOS filesystems.  So, the bug should be squashed regardless.

The problem is that it may not be a bug.  If the program is dead and a zombie (meaning the parent has not yet "reaped its dead children", yeah, unix is morbid - I love it), then the process will show up in the process table for quite a long time.  In fact, I don't think it should time out at all according to posix standards, but I suppose if the process doesn't acknowledge the dead child, it doesn't hurt to eventually let the zombie children rest in peace!  To reap the children you just call Pwait() after you get the SIGCHLD, or use Pwait3() as sort of a quick poll for any dead children, and use Pwaitpid() to check a specific process (ideally after getting the SIGCHLD, but doesn't have to be).