Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
9
rated 0 times [  9] [ 0]  / answers: 1 / hits: 12864  / 2 Years ago, mon, june 13, 2022, 11:14:01

Generally I have noticed that plugging in a new device in a Linux system causes a new entry to be listed in /dev (assuming you have the correct drivers).



For example:




  1. When you plug in a new hard drive you get /dev/sdb.

  2. When you plug in a serial device you get /dev/ttyS0.



When I plug in an Ethernet device, why don't I get something like /dev/eth0?



Is there a device listing for Ethernet ports?



I know you can see port names using ifconfig, I am just wondering if something shows up in /dev too.


More From » networking

 Answers
0

It's a good question. The reason is essentially historical; different groups with different goals and priorities added pieces of Unix over time, and the differences among various APIs are a reflection of this history. I think the original device file concept goes back to Bell Labs, whereas network sockets were added later at UC Berkeley. Bell was trying to create a nice clean maintainable paradigm for AT&T's operations, whereas Berkeley needed to add internet features that didn't fit easily into that paradigm. Technically it would be possible to go back and create a /dev/eth0 file today (see below), but it would involve rewriting a prohibitive amount of legacy code.



Slight OT: If the subject interests you, consider taking a look at Plan 9, which took "everything is a file" to greater extremes (just don't expect it to have very many modern, usable applications):



http://www.faqs.org/docs/artu/plan9.html




many facilities that under Unix are accessed through various ad-hoc interfaces like BSD sockets, fcntl(2), and ioctl(2) are in Plan 9 accessed through ordinary read and write operations on special files analogous to device files



[#30784] Tuesday, June 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trousransla

Total Points: 285
Total Questions: 112
Total Answers: 113

Location: Spain
Member since Thu, Dec 23, 2021
2 Years ago
;