User: Password:
|
|
Subscribe / Log in / New account

IMA memory hog

IMA memory hog

Posted Oct 21, 2010 21:01 UTC (Thu) by jzbiciak (subscriber, #5246)
Parent article: IMA memory hog

 	if (mode & FMODE_WRITE)
-		iint->writecount++;
+		inode->i_writers++;

Gee, I wonder what happens when I open a file 4 billion times... will IMA notice it later? (On a 32-bit system, at least.)


(Log in to post comments)

IMA memory hog

Posted Oct 21, 2010 21:03 UTC (Thu) by corbet (editor, #1) [Link]

If you have a system where you can have 4 billion simultaneously open file descriptors, there might indeed be a problem.

IMA memory hog

Posted Oct 21, 2010 21:09 UTC (Thu) by jzbiciak (subscriber, #5246) [Link]

Yeah, see my mea culpa followup. I had misinterpreted as "total writers ever" as opposed to "total concurrent writers". I'm curious why they chose "long" for the count though. Seems like even a fairly beefy 64-bit box might find (231-1) active file descriptors a bit challenging, let alone (263-1) on machines where sizeof(long)==8. :-)

IMA memory hog

Posted Oct 22, 2010 12:38 UTC (Fri) by mpr22 (subscriber, #60784) [Link]

"Learned C on an I16 arch" and "were taught C by someone who learned it on an I16 arch" are the obvious possibilities.

IMA memory hog

Posted Oct 22, 2010 13:57 UTC (Fri) by jzbiciak (subscriber, #5246) [Link]

Hmmm.... wouldn't that be an awful lot of us?

I learned C on an I16 arch (and remember Borland's small, medium, large and huge models, the near/far keywords, and all that fun), and I'm only 35, so not a greybeard just yet.

IMA memory hog

Posted Oct 22, 2010 16:35 UTC (Fri) by nix (subscriber, #2304) [Link]

As a greybeard of 34, I first met C on a BBC B with a ROM chip that gave us a sort of halfhearted C (this was probably in 1988, or something, so pre-standardization in any case). 'short' was 8 bit, 'int' 16, 'long' 32. Borland's Turbo C gave me so much more memory that it felt like being let out of jail (until I used it all up, that is).

IMA memory hog

Posted Oct 21, 2010 21:04 UTC (Thu) by jzbiciak (subscriber, #5246) [Link]

Never mind... I see the decrement later. Durrh. I had misinterpreted the count as "number of times this file has ever been opened for writing", which doesn't actually seem like a useful thing to have.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds