Hi,

did you have trouble with rrdtool update not updating the timestamp
of the rrd file?

  please test this little bit of c-code

does it compain on your platform.

cheers
tobi

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [EMAIL PROTECTED] ++41 62 775 9902 / sb: -9900
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <utime.h>

int main (int argc,char *argv[]){
        int fd;
        struct stat stbuf;
        char *addr;
        int res;
        char temp[] = "mmaptestXXXXXX";
        struct utimbuf newtime;

        time_t create_ts;
        fd = mkstemp(temp);
        if (fd == -1){
                perror(temp);
                return 1;
        }
        write(fd,"12345\n", 6);        
        stat(temp, &stbuf);
        create_ts = stbuf.st_mtime;
        newtime.actime = 0;
        newtime.modtime = 0;
        utime(temp,&newtime);
        addr = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
        if (addr == MAP_FAILED) {
              perror("mmap");
              return 1;
        }
        addr[0]='x';
        res = msync(addr, 4, MS_ASYNC);
        if (res == -1) {
           perror("msync");
           return 1;
        }
        res = close(fd);        
        if (res == -1) {
           perror("close");
           return 1;
        }
        stat(temp, &stbuf);
        if (create_ts > stbuf.st_mtime){
           printf("msync(x,y,MS_ASYNC) does NOT update mtime\n");
           return 2;
        }
        printf("msync(x,y,MS_ASYNC) does update mtime\n");              
                
        return 0;

}
_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to