Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Notes for Advanced Linux Programming 6. Devices


6.  Devices
A device driver hides the hardware device’s communication
protocols from the operating system and allows the system to interact with the
device through a standardized interface.
Processes can communicate with a device driver via
file-like objects.
6.1 Device Types
A character device represents a hardware device that reads
or writes a serial stream of data bytes.
A block device represents a hardware device that reads or
writes data in fixed-size blocks.
6.2 Device Numbers
Linux identifies devices using two numbers: the major
device number and the minor device number.
The major device number specifies which driver the device
corresponds to.
Minor device numbers distinguish individual devices or
components controlled by a single driver.
The special entry /proc/devices lists major device numbers
corresponding to active device drivers currently loaded into the kernel.
[liuchao@localhost ~]$ cat /proc/devices
Character devices:
  1
mem
  4
/dev/vc/0
  4
tty
  4
ttyS
  5
/dev/tty
  5
/dev/console
  5
/dev/ptmx
  6
lp
  7
vcs
 10
misc
 13
input
 14
sound
 21
sg
 29
fb
 99
ppdev
116 alsa
128 ptm
136 pts
180 usb
189 usb_device
216 rfcomm
254 pcmcia
 
Block devices:
  1
ramdisk
  1
ramdisk
  2
fd
  8
sd
  9
md
 22
ide1
 65
sd
 66
sd
 67
sd
 68
sd
 69
sd
 70
sd
 71
sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
253 device-mapper
254 mdp
 
6.3 Device Entries
Only superuser processes can create block and character
devices using the mknod command or the mknod system call.
To create a device using the mknod command
The first argument is the path of the entry in the file
system.
The second argument is b for a block device or c for a
character device.
Provide the major and minor device numbers as


Ïà¹ØÎĵµ£º

1.³õ¼¶ÈëÃÅ xp sqlplus Á¬½Ó linuxÐéÄâ»ú oracle

1.Ê×ÏÈ¿´¿´ÔÚxpÏÂÊÇ·ñÄܹ»pingͨÐéÄâ»úµÄip£¨ÐéÄâ»ú²é¿´ipÃüÁifconfig£¬´ËÃüÁîÒªÇóÓÐrootȨÏÞ£¬»òÕßÓà /sbin/ifconfig).
2.ÔÚµÚÒ»²½³É¹¦µÄ»ù´¡ÉÏ£¬ÒªÅäÖÃxpÏÂoracle°²×°Ä¿Â¼ÏµÄtnsnames.oraÕâ¸öÎļþ£¨Îҵķ¾¶ÊÇ£ºD:\oracle\product\10.2.0\db_1\NETWORK\ADMIN£¬Õâ¸ö·¾¶Òò»úÆ÷¶øÒì)
    Ê×ÏÈÔÚtnsnam ......

VirtualBoxÏÂLinuxΪHost£¬WindowsΪGuestͨÐÅ

½ñÌìÔÚGentooÏ°²×°ÁËVirtualBoxÐéÄâÁËÒ»¸öXP£¬ÕâÑùÐèҪѸÀ×µÈһЩֻÓÐFor WindowsϵÄÈí¼þʱºò²»ÓñØÐëÖØÐÂÆô¶¯Çл»µ½WindowsÏÂÁË¡£
ÏÔÈ»Á½¸öOS֮ǰµÄÎļþ½»»»Ò²ºÜ¹Ø¼ü£¬½â¾ö·½°¸Ò²·Ç³£µÄ¼òµ¥¡£
1£©ÔÚGentooÏ°²×°openssh
emerge openssh
2£©ÔÚwindows¿Í»§»úÉÏ°²×°FileZilla
......

ѧϰ linux kernelµÄ½¨Òé

ÊÇÒªÓм¸¸ö½×¶ÎµÄ¡£ ¿ªÊ¼¿´ulk,
ulk×îºÃµÄµØ·½¾ÍÊÇËûËù³«µ¼µÄѧϰ·½·¨ÌرðºÃ¡£µ±ÄãÏëѧϰij·½Ãæʱ£¬ÏÈ¿´Í·Îļþ£¬ÔÚû°Ñÿ¸öÊý¾Ý½á¹¹ÖеÄÿ¸öÊý¾ÝÔªËØŪÇå³þ֮ǰ²»Òª¿´ÊµÏÖ´úÂë¡£
¶ÁÍêÍ·Îļþ£¬Òâζ×ÅÆäÖеÄ×éÖ¯¹Øϵ¸ú±ðµÄµØ·½µÄÁªÏµ¾ÍÇå³þÁË£¬ÕâʱºòÄãÈ¥¿´ÊµÏֵĴúÂëÄã»á·¢ÏÖËûÒѾ­×öµÄÕýÊÇÄãËùÏëµÄ¡£
¸ú×Åulk°ÑÕâЩ»ù±¾µ ......

UNIX/Linux ϵͳ´ÅÅÌ ¿Õ¼ä¼à¿Ø ×Ô¶¯»¯½Å±¾ ʾÀý

UNIX/Linux ϵͳ´ÅÅÌ ¿Õ¼ä¼à¿Ø ×Ô¶¯»¯½Å±¾ ʾÀý
1. ·ÖÇø¼à¿Ø /root/disktab ÎļþʾÀý
2. checkdisk ½Å±¾³õʼ»¯²¿·Ö
3. checkdisk ½Å±¾·ÖÎö /root/disktab Îļþ²¿·Ö
4.ÖеĽű¾ÊµÏÖÁËʵʱ¼à¿Ø²¢¼ì²â·ÖÇø×´¿ö£¬Í¨¹ýÇ°Ãæ»ñµÃµÄÓû§¶¨ÒåµÄãÐÖµºÍ df ÃüÁîµÄÊä³ö½øÐбȽϣ¬Èç¹û df ÏÔʾµÄij¸ö·ÖÇøµÄ¿Õ¼äÕ¼Óó¬¹ýÁËÓû§¶¨ÒåµÄã ......

½¨Á¢ARM+LinuxÓ¦ÓóÌÐòµ÷ÊÔ»·¾³

 
½¨Á¢ARM+LinuxÓ¦ÓóÌÐòµ÷ÊÔ»·¾³
 
Gdb+gdbserver+insight»·¾³µÄ´î½¨
1.    ÏÂÔØgdbÔ´´úÂë    http://ftp.gnu.org/gnu/gdb/
 
2.    ÅäÖð²×°gdb+gdbser
$ tar jxvf gdb-6.6.tar.bz2
$ cd x/gdb
$ ./configure --target=arm-linux --prefix=/usr/lo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ