From: Sean Estabrooks <seanlkml@rogers.com>
To: linux-kernel@vger.kernel.org
Subject: modification time not set correctly after mmap updates
Date: Sun, 26 Oct 2003 14:28:51 -0500 [thread overview]
Message-ID: <20031026142851.384b9857.seanlkml@rogers.com> (raw)
mtime is not being updated after changes to files via mmap, at least not
on 2.6.0-test7. Problem shows up on both ext3 and reiserfs.
Below is an ugly little program which updates a test file without
affecting its modification time.
I tried this on 2.4.23 and got the same behavior so perhaps i'm
misinterpreting this passage from the mmap man page:
The st_ctime and st_mtime field for a file mapped with PROT_WRITE
and MAP_SHARED will be updated after a write to the mapped region,
and before a subsequent msync() with the MS_SYNC or MS_ASYNC
flag, if one occurs.
Cheers,
Sean
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
/* You'll need a file "test.txt" with a few bytes in it */
/* After running this proggy: file is changed but its mtime isn't */
#define SIZE 20
int main()
{
int fd;
char *mbuf;
fd = open("test.txt", O_RDWR);
mbuf = mmap(0, SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
mbuf[1]='x';
msync(mbuf, SIZE, MS_SYNC);
munmap(mbuf, SIZE);
fsync(fd);
close(fd);
return 0;
}
reply other threads:[~2003-10-26 19:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031026142851.384b9857.seanlkml@rogers.com \
--to=seanlkml@rogers.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®