Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the file named "register" in "/proc/sys/fs/binfmt_misc" directory is "write-only"?

Tags:

linux

chmod

During learning about Linux file execution mechanism, I found a file in the following directory which is "write-only" (even for root user!):

ebra@him:/proc/sys/fs/binfmt_misc$ ll register 
--w------- 1 root root 0 Aug 19 19:15 register

My question is: What is the usage of this [kind] of file[s]? What is the use of a file that can not be read at all?

like image 299
Ebrahim Ghasemi Avatar asked Oct 21 '25 13:10

Ebrahim Ghasemi


1 Answers

See the documentation. This is not a normal file; it's an interface to the kernel's mechanism for setting up binary formats. You add a new format by writing a string to this "file" in a specific format. The kernel uses that string to set up the new binary format, but there'd be no point in saving the string itself. So you wouldn't be able to read back the string you wrote, and it's not clear what else you might expect to read from that file.

If you want to see what formats have been registered, you look at the other files in that directory.

like image 61
Nate Eldredge Avatar answered Oct 23 '25 02:10

Nate Eldredge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!