bubblemon-list
[Top][All Lists]
Advanced

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

[Bubblemon-list] [PATCH] unix-mail.c when using a filesystem that is mo


From: Adam Sjøgren
Subject: [Bubblemon-list] [PATCH] unix-mail.c when using a filesystem that is mounted with noatime
Date: Tue, 18 Mar 2003 18:11:41 +0100
User-agent: Gnus/5.090014 (Oort Gnus v0.14) XEmacs/21.4 (Portable Code, i386-debian-linux)

  Hi.


I was wondering whether there is some way to detect whether the
filesystem that $MAIL resides on has been mounted with noatime?

I mount with noatime, and bubblemon always thinks I've got mail...

So I made a little change, included below, that bubblemon perhaps
could fall back to, if atime isn't updated?


  Best wishes,

    Adam

--- unix-mail.c.orig    2002-11-13 13:51:43.000000000 +0100
+++ unix-mail.c 2003-03-18 18:06:33.000000000 +0100
@@ -34,7 +34,8 @@
   static int countdown = 0;
   static char *mailFileName = NULL;
   static int cachedMailState = 0;
-
+  static int mailFileSize = 0;
+  
   struct stat mailStat;
 
   if (countdown > 0)
@@ -63,7 +64,15 @@
 
   // New mail has arrived if the mail file has been updated after it
   // was last read from
-  cachedMailState = mailStat.st_mtime > mailStat.st_atime;
+  // cachedMailState = mailStat.st_mtime > mailStat.st_atime;
+
+  // That is no good when the partition is mounted with noatime,
+  // to prevent needless disk-trashing with ext3.
+
+  // Let's just say: if the file grew, or stayed the same larger than 0:
+  cachedMailState=(mailStat.st_size >= mailFileSize) && (mailStat.st_size != 
0);
 
+  mailFileSize=mailStat.st_size;
+  
   return cachedMailState;
 }


-- 
 "I wear my unprofessionalism as a badge of honor.             Adam Sjøgren
  Professionalism has no place in art"                    address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]