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

linux ×Ö·ûÇý¶¯2


µ¼º½£º[Ê×Ò³]>[linuxÄÚºËѧϰ±Ê¼Ç]
Ŀ¼
 [Òþ²Ø]
1 ×Ö·ûÉ豸Çý¶¯ÖªÊ¶½²½â
1.1 ÃèÊö×Ö·ûÉ豸»ù±¾½á¹¹Ìå
1.2 ×÷ÓÃ
1.3 ¸÷×Ö¶ÎÏê½â
1.4 ²Ù×÷
1.5 ÊµÀý
1.5.1 ´úÂë
1.5.2 ÔËÐÐ
[±à¼­]×Ö·ûÉ豸Çý¶¯ÖªÊ¶½²½â
×÷Õߣº[Å£ÌÎ]
[±à¼­]ÃèÊö×Ö·ûÉ豸»ù±¾½á¹¹Ìå
/linux/include/linux/cdev.h
13struct cdev {
14 struct kobject kobj;
15 struct module *owner;
16 const struct file_operations *ops;
17 struct list_head list;
18 dev_t dev;
19 unsigned int count;
20};
[±à¼­]×÷ÓÃ
ÃèÊö×Ö·ûÉ豸µÄ»ù±¾½á¹¹Ì壬ÓÃÓÚ½øÒ»²½·â×°ÔÚ¸ü´óµÄ½á¹¹ÌåÄÚ£¬ÒÔÃèÊö¾ßÌåµÄ×Ö·ûÉ豸£¬ÀýÈ磺
struct xxx_cdev {
const char *name;
struct cdev cdev;
...
}
ÕâÑù¾Í¿ÉÒÔʹÓÃxxx_cdev½á¹¹ÃèÊö¾ßÌåµÄ×Ö·ûÉ豸ÁË¡£
[±à¼­]¸÷×Ö¶ÎÏê½â
1¡¢struct kobject kobj;
¾ßÌå½á¹¹²Î¼ûhttp://blog.chinaunix.net/u1/55599/showart.php?id=1086478£¬´Ë´¦ËüÊÇÒ»¸öÄÚǶµÄ½á¹¹£¬×÷ÓÃÊÇÌṩÒýÓüÆÊý¡£ÔÚµ÷ÓÃcdev_init()º¯Êý³õʼ»¯cdev½á¹¹Ìåʱ£¬»áµ÷ÓÃkobject_init()º¯Êý³õʼ»¯¸ÃÊý¾ÝÓò¡£¾ßÌå¼ûÏÂÎÄcdev_init()º¯Êý¡£
2¡¢struct module *owner;
Ö¸³ö¸Ã×Ö·ûÉ豸ËùÊôµÄÄ£¿é£¬Ò»°ã³õʼ»¯ÎªTHIS_MODULES¡£
3¡¢struct file_operations *ops;
Îļþ²Ù×÷Ö¸Õ룬ҲÊǸýṹÖÐ×îÖØÒªµÄÊý¾ÝÓò¡£×Ö·ûÉ豸Çý¶¯µÄ±àдÖ÷Òª¾ÍÊÇʵÏÖfile_operationsÀïµÄһЩ³£Óú¯Êý£¬±ÈÈçread£¬write£¬open£¬releaseµÈ¡£¹ØÓÚfile_operations½á¹¹µÄÏê½â²Î¼û£ºhttp://blog.chinaunix.net/u2/73521/showart_1086491.html
4¡¢struct list_head list;
Óë×Ö·ûÉ豸Îļþ¶ÔÓ¦µÄË÷Òý½ÚµãÁ´±íÍ·£¬ÓÃÓÚÊÕ¼¯Ïàͬ×Ö·ûÉ豸Çý¶¯³ÌÐòËù¶ÔÓ¦µÄ×Ö·ûÉ豸ÎļþµÄË÷Òý½Úµã¡£¿ÉÄܺܶàÉ豸Îļþ¾ßÓÐÏàͬµÄÉ豸ºÅ£¬²¢¶ÔÓ¦ÓÚÏàͬµÄ×Ö·ûÉ豸¡£¸Ã×Ö¶ÎÔÚcdev_alloc()ºÍcdev_init()ÖнøÐÐÁ˳õʼ»¯¡£
5¡¢dev_t dev;
´ú±í¸Ã×Ö·ûÉ豸µÄÉ豸ºÅ¡£dev_tʵ¼ÊÉÏΪunsigned intÀàÐÍ£¬32λ¡£ÆäÖиß12λΪÖ÷É豸ºÅ£¬µÍ20λΪ´ÎÉ豸ºÅ¡£Èç¹ûÒÑÖªÒ»¸öÉ豸ºÅ£¬¿ÉÒÔʹÓÃһϺê·Ö±ðÈ¡µÃÖ÷É豸ºÅºÍ´ÎÉ豸ºÅ£º
MAJOR(dev_t dev) /*È¡µÃÖ÷É豸ºÅ*/
MINOR(dev_t dev) /*È¡µÃ´ÎÉ豸ºÅ*/
ÕâÁ½¸öºêµÄÔ­ÐÍÊÇ£º/linux/include/linux/kdev_t.h
4#define MINORBITS 20
5#define MINORMASK ((1U << MINORBITS) - 1)


Ïà¹ØÎĵµ£º

Linux C ²Î¿¼ÊÖ²á Ö® »·¾³±äÁ¿Æª

getenv£¨È¡µÃ»·¾³±äÁ¿ÄÚÈÝ£©
Ïà¹Øº¯Êý putenv£¬setenv£¬unsetenv
±íÍ·Îļþ #include<stdlib.h>
¶¨Ò庯Êý char * getenv(const char *name);
º¯Êý˵Ã÷ getenv()ÓÃÀ´È¡µÃ²ÎÊýname»·¾³±äÁ¿µÄÄÚÈÝ¡£²ÎÊýnameΪ»·¾³±äÁ¿µÄÃû³Æ£¬Èç¹û¸Ã±äÁ¿´æÔÚÔò»á·µ»ØÖ¸Ïò¸ÃÄÚÈݵÄÖ¸Õë¡£»·¾³±äÁ¿µÄ¸ñʽΪname£½value¡£
·µ»ØÖµ Ö´Ðг ......

ÔÚ Linux ÏÂÔËÐÐ ASP.NET 2.0

µ¥Î»ÓÐһ̨ÏÐÖÃµÄ¾É IBM Netfinity 7000 µÄ·þÎñÆ÷£¬Ë« Pentium Pro 200 MHz CPU£¬512 MB Äڴ棬һ¸ö 9.1 GB ºÍÎå¸ö 4.5 GB µÄ SCSI Ó²ÅÌ¡£ÎÒÏ뽫Æä·ÏÎïÀûÓÃһϣ¬ÓÚÊÇ£º
1. µ½ http://tw.releases.ubuntu.com/edgy/ ÏÂÔØ  PC (Intel x86) server install CD £¬½«ÏÂÔصõ½µÄ ubuntu-6.10-server-i386.iso Îļþ¿Ì¼һÕÅ ......

Linux¶¨Ê±Æ÷——setitimer()

setitimer()ÊDZȽϾ«×¼µÄ¶¨Ê±Æ÷£¬ÊÇLinuxµÄAPI
ÒÔÏ´úÂëÊǸöµ¹¼ÆʱÀý×Ó£º
#include <signal.h>
#include <sys/time.h>
static int time_count=30;
static void sigalrm_handler(int sig)
{
time_count--;
printf("timer signal.. %d\n", time_count);
}
struct itimerval v; ......

LinuxÈçºÎ×ß³ö×ÀÃæÀ§¾³£¿

       ½üÈÕ£¬ÔÚLinuxCON 2009´ó»áÉÏ£¬×ÀÃæ Linux ÓÖ³ÉΪҵ½ç¹Ø×¢µÄ½¹µãÖ®Ò»¡£¸÷ÖÖ²»Í¬µÄÉùÒô£¬É¤ÃŶ¼ºÜ´ó¡£ÔÚÕâ·×·×ÈÂȵķÕΧÖУ¬ Linux ÈçºÎ×ß³ö×ÀÃæÀ§¾³£¿
       ×ݹÛÈ«¾Ö£¬ÆÕ¼°×ÀÃæ Linux µÄ×î´óÕÏ°­Ö®Ò»ÊÇϵͳ°²×°µÄ²Ù×÷À§ÄÑÐÔ¡£Ô¤×° Windows Òѳɴó ......

LinuxÖеÄinitÃüÁî

ÎÒÃÇ˵һÏÂLinuxÖеÄinitÃüÁî
InitÊÇLinux²Ù×÷ϵͳÖв»¿ÉȱÉٵijÌÐòÖ®Ò»¡£init½ø³ÌÊÇLinuxÄÚºËÒýµ¼ÔËÐеģ¬ÊÇϵͳÖеĵÚÒ»¸ö½ø³Ì£¬Æä½ø³ÌºÅ£¨PID£©ÓÀԶΪ1¡£Äã¿ÉÒÔͨ¹ý#ps   -ef|headÀ´²é¿´½ø³ÌÃüÁî¡£
1)    ¼¸¸ö³£ÓõÄÃüÁî
   ²é¿´ÏµÍ³½ø³ÌÃüÁ#ps   -ef|head
&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ