What Does Write Error Mean?
A write error is generated when the write operation to a disk or storage medium does not complete successfully owing to several factors such as the storage medium being write-protected, not enough space or the sectors being written to being corrupt or damaged. The type of write error message returned during a failed write operation depends on the cause of the error, which makes it easier to diagnose and fix the problem.
Techopedia Explains Write Error
Write errors occur owing to various reasons, and the error message returned corresponds to the cause of this error. In rudimentary operating systems, when a write operation is called, there is no primary checking done on the parameters passed and the process is just done immediately, so these types of error messages are important to let the user know what error has prevented the operation from completing.
In modern operating systems meant to be user friendly, every process and every prompt must be intuitive so as not to confuse the user, as error codes are a good way to confuse and scare casual users, so the operating system itself must ensure that all requirements are met before executing the write process. For example, a modern operating system checks the storage space and write capability of the medium before executing the write process so it can tell the user in advance that there is not enough space or that there is no permission to write instead of proceeding and then encountering an error.
Each operating system reports errors in its own convention and that goes the same for write errors. The following is a list of write errors that GNU C reports:
- 4 (EINTR) — System call was interrupted
- 5 (EIO) — Low hardware-level read/write operations errors
- 9 (EBADF) — Invalid descriptor or file is “read-only”
- 13 (EACCES) — User does not have permission to write
- 14 (EFAULT) — Address specified in function is invalid
- 22 (EINVAL) — Argument passed by the function is invalid
- 27 (EFBIG) — File size in nbytes is greater than what the system allows
- 28 (ENOSPC) — Not enough space available in storage medium
- 32 (EPIPE) — Pipe is broken or the file at the end of the pipe is not open for I/O operations