How do you understand the file access pattern Write only in the file descriptor table?

  linux, question

File descriptors in the operating system have a file descriptor table maintained by the kernel at the system level, which contains three types of state information including file access modes

  1. read only

  2. write only

  3. read&write

What kind of situation is this write only? what I can imagine is to write with “> >” character in terminal mode, but I don’t know how to implement this write only without viewing the contents of the file under gui interface, such as various text editors.

Don’t be fooled by gui. Take editor as an example. It is only after reading it to the user that the user can write it.

However, most of the time, it is also possible to write without reading the contents of the file. For example, the log is to continuously add contents to the last part of the file without reading the previous contents.

However, I don’t know how to implement this write only without viewing the contents of files under gui interface, such as various text editors.

How? Of course, it is the operating system (the file system of) that makes this permission restriction. Application layer programs only apply for these permissions. For example, the editor must have read permission and cannot edit without write permission, at least he must be able to read.