This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

/dev

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
This page is a translated version of the page /dev and the translation is 43% complete.

O diretório /dev

A maioria dos usuários Linux entendem que /dev/sda1 é apenas um modo rápido de se referir à primeira partição do primeiro disco que o kernel encontrou. Bem simples, certo?

But consider hotpluggable devices like USB, IEEE 1394, hot-swappable PCI, etc. What is the first device for each of these? And for how long? What will the other devices be named when the first one disappears? How will that affect ongoing transactions? Wouldn't it be fun if a printing job were suddenly moved from a high-end laser printer to an almost-dead matrix printer just because someone decided to pull the plug on the laser printer (which just happened to be the first printer)?

Enter the device manager. A modern device manager (including udev and eudev) must:

  • Run in userspace;
  • Dynamically create and remove device files;
  • Provide consistent device naming;
  • Provide a userspace application program interface (API).

Every time a change happens within the device structure, the kernel emits a uevent which gets picked up by the device manager. The device manager then follows the rules declared in the /etc/udev/rules.d, /run/udev/rules.d and /lib/udev/rules.d directories. Based on the information contained within the uevent, it finds the rule or rules it needs to trigger and performs the required actions. These actions may involve the creation or deletion of device files, and may also trigger the loading of particular firmware files into kernel memory.