Bandicoot
Bandicoot

Reputation: 3949

Device number for Network devices

In Linux, why aren't network device drivers associated with the major/minor device numbers or /dev files ?

Upvotes: 1

Views: 366

Answers (1)

Logan Bowers
Logan Bowers

Reputation: 447

Generally, network devices do not lend themselves well to the filesystem model.

/dev files are of two types: block and character. The quintessential block device is a disk drive which can be intuitively represented as a single large file. The quintessential character device is a console, where keyboard presses are read in and the terminal display is written out as "streams" of bytes. Both of these interfaces are very similar to the operations performed on regular files, so it makes sense to represent the physical devices AS files.

Network devices, however, do not fit either model. An ethernet interface doesn't represent a large store of bytes, nor does it represent a single incoming or outgoing stream of bytes. Applications use the network services via the socket API (man 2 socket) which conveniently doesn't require them to know anything about the network topology, so there isn't really a use for a file representation of an interface.

Upvotes: 3

Related Questions