Unix Programming - I/O error

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2005 > 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 I/O error
mobenoua

2005-10-31, 5:58 pm

What are all the things or possibilities that would cause the low level
write function to fail with I/O error whilst writing to a binary file?

Pascal Bourguignon

2005-10-31, 5:58 pm

"mobenoua" <mobenoua@hotmail.com> writes:

> What are all the things or possibilities that would cause the low level
> write function to fail with I/O error whilst writing to a binary file?


A bad disk sector.
A bad powersupply (a brown-out at the right time).
A cosmic particule.


--
__Pascal Bourguignon__ http://www.informatimago.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink.
Jordan Abel

2005-10-31, 8:50 pm

On 2005-10-31, Ertugrul Soeylemez <never@drwxr-xr-x.org> wrote:
>
> "mobenoua" <mobenoua@hotmail.com> (31 Oct 2005 07:05:47 -0800):
>
>
> There are a few possibilities:
>
>
> - - A bug in the program.
>
> - - Maximum file size exceeded. Should not happen with current
> filesystems, but older filesystems still use 32 bit filesizes, where
> you can't have files larger than 2 GB or 4 GB
> (implementation-specific).


Also, what if an OS has 32-bit off_t, regardless of filesystem limits?
also, the error would be E2BIG

> - - Program received a signal while writing. Normally the program should
> handle his properly, but some programs do not handle signals at all.


That would be EINTR.

> - - You have reached some kind of resource limit.


E2BIG again, or EDQUOT on some systems (the name is reserved, but
not given any meaning, on the posix standard - what it's intended to
mean should be obvious)

> - - Program tried to write to a read-only file. This may happen if some
> other program set wrong permissions.


Not sure you'd get as far as the write() in this case

> - - Program opened a file for writing, but specifically said that it
> should fail if the file already exists.
>
> - - A chain of symbolic links is too long.
>
> - - A path name was too long.
>
> - - There is a system-wide limit for open file descriptors.
>
> - - A symbolic link pointing nowhere or to a file that doesn't exist
> anymore.


or any of these

> - - The filesystem gets remounted read-only in progress, for whatever
> reason.
>
> - - A program file that is currently executed is denied write access to.
>
> Isn't there any error message?


Possibly by "I/O error" he meant EIO. That's a plausible strerror
result for that one - my system has "Input/output error".

If that's the case, the cause could very well be hardware failure
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com