Magic filesystems are too clever
Posted Oct 29, 2009 23:09 UTC (Thu) by quotemstr
Parent article: /proc and directory permissions
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
Made in classic ha-ha only serious fashion, the statement is as true as ever. Magic filesystems like procfs and sysfs are too clever, and create many problems, ranging from security (in the procfs case) to fundamental correctness, in the sysfs case. And for what? Being able to read a process' FD table with ls, or to change a system's current sleep state with cat?
Nobody does that. People really use tools like
ps to manipulate entries in the magic filesystem, and these tools could be better implemented using
sysctl(2) and new system calls.
Magic filesystem introduce needless complexity and obscure correctness and security problems while at the same time providing nothing over other approaches. Magic filesystems are a bad idea, and ought to be slowly deprecated in favor of sysctl (for generic key-value manipulation) and special system calls (for everything else).
to post comments)