Unix Programming - mmap and I/O error

This is Interesting: Free IT 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:48 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, 5:51 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






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com