Author neologix
Recipients Vladimir.Ushakov, christian.heimes, neologix
Date 2012-10-12.16:30:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1350059443.96.0.681059893632.issue16212@psf.upfronthosting.co.za>
In-reply-to
Content
That's normal.
You're truncating the file after having it mapped, so touching the pages corresponding to the truncated part of the file will result in a segfault.
See mmap's man page:
"""
       Use of a mapped region can result in these signals:

       SIGBUS Attempted access to a portion of the buffer that does not correspond to
              the file (for example, beyond the end of the file, including the case
              where another process has truncated the file).
"""

The only way to guard against it would be to call fstat() in every buffer-protocol method in case of file-backed mapping to check against the current file size, but that would be awfully slow in case of sequential access (just imagine performing an md5sum of an mmap-ed file).
History
Date User Action Args
2012-10-12 16:30:44neologixsetrecipients: + neologix, christian.heimes, Vladimir.Ushakov
2012-10-12 16:30:43neologixsetmessageid: <1350059443.96.0.681059893632.issue16212@psf.upfronthosting.co.za>
2012-10-12 16:30:43neologixlinkissue16212 messages
2012-10-12 16:30:43neologixcreate