For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > October 2005 > mmap and I/O error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mmap and I/O error
Sakagami Hiroki

2005-10-30, 7:56 am

Hi,

When I open() a file on the disk and perform read() / write()
operations on the descriptor, I can detect a physical disk
I/O error by checking the return code and errno.

But when I mmap() a file on the disk and perform memcpy() on
the mapped area, how do I know whether a disk error occurs?

Regards,

--
Sakagami Hiroki

Maxim Yegorushkin

2005-10-30, 7:00 pm

Sakagami Hiroki wrote:
> Hi,
>
> When I open() a file on the disk and perform read() / write()
> operations on the descriptor, I can detect a physical disk
> I/O error by checking the return code and errno.


If O_SYNC has not been specified while opening the file, the return
code does not tell you if a physical error has occured.

> But when I mmap() a file on the disk and perform memcpy() on
> the mapped area, how do I know whether a disk error occurs?


You'll get a signal. Not sure which, probably SIGSEGV or SIGBUS.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com