Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : linux

LinuxÍøÂçÇý¶¯³ÌÐò±àд(ËÄ)

¡¡Èý.±àдLinuxÍøÂçÇý¶¯³ÌÐòÖÐÐèҪעÒâµÄÎÊÌâ
¡¡¡¡3.1 ÖжϹ²Ïí
¡¡¡¡LinuxϵͳÔËÐм¸¸öÉ豸¹²Ïíͬһ¸öÖжϡ£ÐèÒª¹²ÏíµÄ»°£¬ÔÚÉêÇëµÄʱºòÖ¸Ã÷¹²Ïí·½Ê½¡£ÏµÍ³ÌṩµÄrequest_irq()µ÷ÓõĶ¨Ò壺
¡¡¡¡¡¡¡¡int request_irq(unsigned int irq,
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡void (*handler)(int irq, void *dev_id, struct pt_regs *regs),
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡unsigned long irqflags,
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡const char * devname,
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡void *dev_id);
¡¡¡¡Èç¹û¹²ÏíÖжϣ¬irqflagsÉèÖÃSA_SHIRQÊôÐÔ£¬ÕâÑù¾ÍÔÊÐí±ðµÄÉ豸ÉêÇëͬһ¸öÖжϡ£ÐèҪעÒâËùÓÐÓõ½Õâ¸öÖжϵÄÉ豸ÔÚµ÷ÓÃrequest_irq()¶¼±ØÐëÉèÖÃÕâ¸öÊôÐÔ¡£ÏµÍ³Ôڻص÷ÿ¸öÖжϴ¦Àí³ÌÐòʱ£¬¿ÉÒÔÓÃdev_idÕâ¸ö²ÎÊýÕÒµ½ÏàÓ¦µÄÉ豸¡£ÏµÍ³Ôڻص÷ÿ¸öÖжϴ¦Àí³ÌÐòʱ£¬¿ÉÒÔÓÃdev_idÕâ¸ö²ÎÊýÕÒµ½ÏàÓ¦µÄÉ豸¡£Ò»°ãdev_id¾ÍÉèΪdevice½á¹¹±¾Éí¡£ÏµÍ³´¦Àí¹²ÏíÖжÏÊÇÓø÷×ÔµÄdev_id²ÎÊýÒÀ´Îµ÷ÓÃÿһ¸öÖжϴ¦Àí³ÌÐò¡£
¡¡¡¡3.2 Ó²¼þ·¢ËÍæʱµÄ´¦Àí
¡¡¡¡Ö÷CPUµÄ´¦ÀíÄÜÁ¦Ò»°ã±ÈÍøÂç·¢ËÍÒª¿ì£¬ËùÒÔ¾­³£»áÓöµ½ÏµÍ³ÓÐÊý¾ÝÒª·¢£¬µ«ÉÏÒ»°üÊý¾ÝÍøÂçÉ豸»¹Ã»·¢ËÍÍê¡£ÒòΪÔÚLinuxÀïÍøÂçÉ豸Çý¶¯³ÌÐòÒ»°ã²»×öÊý¾Ý»º´æ£¬²»ÄÜ·¢Ë͵ÄÊý¾Ý¶¼Ê ......

ÈçºÎ±àдLinuxÉ豸Çý¶¯³ÌÐò

ÐòÑÔ
¡¡¡¡LinuxÊÇUnix²Ù×÷ϵͳµÄÒ»ÖÖ±äÖÖ£¬ÔÚLinuxϱàдÇý¶¯³ÌÐòµÄÔ­ÀíºÍ˼ÏëÍêÈ«ÀàËÆÓÚÆäËûµÄUnixϵͳ£¬µ«Ëüdos»òwindow»·¾³ÏµÄÇý¶¯³ÌÐòÓкܴóµÄÇø±ð¡£ÔÚLinux»·¾³ÏÂÉè¼ÆÇý¶¯³ÌÐò£¬Ë¼Ïë¼ò½à£¬²Ù×÷·½±ã£¬¹¦ÄÜÒ²ºÜÇ¿´ó£¬µ«ÊÇÖ§³Öº¯ÊýÉÙ£¬Ö»ÄÜÒÀÀµkernelÖеĺ¯Êý£¬ÓÐЩ³£ÓõIJÙ×÷Òª×Ô¼ºÀ´±àд£¬¶øÇÒµ÷ÊÔÒ²²»·½±ã¡£±¾ÈËÕ⼸ÖÜÀ´ÎªÊµÑéÊÒ×ÔÐÐÑÐÖƵÄÒ»¿é¶àýÌ忨±àÖÆÁËÇý¶¯³ÌÐò£¬»ñµÃÁËһЩ¾­Ñ飬ԸÓëLinux fans¹²Ïí£¬Óв»µ±Ö®´¦£¬ÇëÓèÖ¸Õý¡£
¡¡¡¡ÒÔϵÄһЩÎÄ×ÖÖ÷ÒªÀ´Ô´ÓÚkhg£¬johnsonmµÄWrite linux device driver£¬Brennan's Guide to Inline Assembly£¬The Linux A-Z£¬»¹ÓÐÇ廪BBSÉϵÄÓйØdevice driverµÄһЩ×ÊÁÏ. ÕâЩ×ÊÁÏÓеÄÒѾ­¹ýʱ£¬ÓеĻ¹ÓÐһЩ´íÎó£¬ÎÒÒÀ¾Ý×Ô¼ºµÄÊÔÑé½á¹û½øÐÐÁËÐÞÕý.
¡¡¡¡Ò»¡¢Linux device driver µÄ¸ÅÄî
¡¡¡¡ÏµÍ³µ÷ÓÃÊDzÙ×÷ϵͳÄں˺ÍÓ¦ÓóÌÐòÖ®¼äµÄ½Ó¿Ú£¬É豸Çý¶¯³ÌÐòÊDzÙ×÷ϵͳÄں˺ͻúÆ÷Ó²¼þÖ®¼äµÄ½Ó¿Ú.É豸Çý¶¯³ÌÐòΪӦÓóÌÐòÆÁ±ÎÁËÓ²¼þµÄϸ½Ú£¬ÕâÑùÔÚÓ¦ÓóÌÐò¿´À´£¬Ó²¼þÉ豸ֻÊÇÒ»¸öÉ豸Îļþ£¬ Ó¦ÓóÌÐò¿ÉÒÔÏó²Ù×÷ÆÕͨÎļþÒ»Ñù¶ÔÓ²¼þÉ豸½øÐвÙ×÷.É豸Çý¶¯³ÌÐòÊÇÄں˵ÄÒ»²¿·Ö£¬ËüÍê³ÉÒÔÏµĹ¦ÄÜ:
¡¡¡¡1.¶ÔÉ豸³õʼ»¯ºÍÊÍ·Å.
¡¡¡¡2. ......

[ת] ʹÓÃPythonдLinuxµÄÊØ»¤½ø³Ì(daemon)

A simple unix/linux daemon in Python
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
by Sander Marechal
I've
written a simple Python class for creating daemons on unix/linux
systems. It was pieced together for various other examples, mostly
corrections to various Python Cookbook
articles and a couple of examples posted to the Python mailing lists.
It has support for a pidfile to keep track of the process. I hope it's
useful to someone.
Below is the Daemon class. To use it, simply subclass it and implement the run() method.
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.

Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.pidfile = pidfile

def daemonize(self):
"&q ......

[ת] ʹÓÃPythonдLinuxµÄÊØ»¤½ø³Ì(daemon)

A simple unix/linux daemon in Python
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
by Sander Marechal
I've
written a simple Python class for creating daemons on unix/linux
systems. It was pieced together for various other examples, mostly
corrections to various Python Cookbook
articles and a couple of examples posted to the Python mailing lists.
It has support for a pidfile to keep track of the process. I hope it's
useful to someone.
Below is the Daemon class. To use it, simply subclass it and implement the run() method.
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.

Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.pidfile = pidfile

def daemonize(self):
"&q ......

fken0.1.5·¢²¼£ºÈÃLinuxÖն˰ïÄã±³µ¥´Ê£¡

 Èç¹ûÄã·ûºÏÏÂÃæÁ½¸öÌõ¼þ£¬Äã¿ÉÄܶÔfken¸ÐÐËȤ£º
ÄãÊǸöLinuxµÄÖÒʵÓû§£¬²¢ÇÒ´óÁ¿Ê¹ÓÃÃüÁîÐУ»
³öÓÚijЩԭÒò£¨±ÈÈç³ö¹ú¿¼G£©£¬ÄãÐèÒª´óÁ¿µØ±³µ¥´Ê
fken£¬¼´fuck englishµÄËõд£¬ÊÇÓÃPython±àдµÄС¹¤¾ß¡£
fkenÕâ¸öС¹¤¾ßÄÜÈÃÄãÔÚƵ·±Ê¹ÓÃLinuxÖն˵Ĺý³ÌÖи¨ÖúÄã±³µ¥´Ê»òÕßÓ¢Óï¾äÐÍ£¬Ç¿»¯ÄãµÄ¼ÇÒä¡£
fken¿ÉÒÔµ¥¶ÀʹÓã¬ËüµÄ×÷ÓÃÊÇËæ»ú·µ»ØÒ»ÌõÓû§Ï£ÍûÇ¿»¯¼ÇÒäµÄÌõÄ¿£¬µ«ÕâûʲôÆæÃîµÄ£¬ÃîµÄÊÇfken¿ÉÒÔºÍLinuxÖÕ¶ËÍêÃÀµØ½áºÏÔÚÒ»Æð——ÿµ±ÄãÔÚÖÕ¶ËÖÐÖ´ÐÐÍêÒ»ÌõÃüÁîÖ®ºó£¬Öն˶¼»á´òÓ¡Ò»Ìõ´ÓfkenµÃµ½Ò»ÌõÐèÒª¼ÇÒäµÄÌõÄ¿£¬ÕâÑùÈç¹ûÄãÊÇÒ»¸ö´óÁ¿Ê¹ÓÃÃüÁîÐеÄLinuxÓû§µÄ»°£¬Äã¾Í»áÔÚʹÓÃterminalµÄ¹ý³ÌÖлعËÄãÏë¼ÇÒäµÄÄÚÈÝ£¬´Ó¶ø´ïµ½Ç¿»¯¼ÇÒäµÄÄ¿µÄ¡£
fkenµÄÔ´´úÂë¼ûfken0.1.5Ô´´úÂë
¡£
fkenµÄÎļþ×é³É£º
fken.py£ºÖ÷ÒªµÄÔ´´úÂëÎļþ£»
fken£º¿Í»§¶Ë³ÌÐò£»
fkend£ºfkenµÄÊØ»¤½ø³Ì(daemon)£¬Ò»¸ö΢Ð͵ÄÊý¾Ý¿â£¬¿ÉÒÔ¶ÁÈ¡Óû§¶¨ÒåµÄÊý¾ÝÎļþÖеÄÌõÄ¿£»
fken_prompt_enhance£ºÒ»¸öbash½Å²½Îļþ£¬ÐÞ¸ÄPS1£¬½«fkenºÍlinuxÖÕ¶ËÕûºÏÔÚÒ»Æð£¬Ê¹µÃlinuxÖն˵ÄÃüÁîÐÐÌáʾ·û¸ü¾ßÐÅÏ¢Á¿£¬Ò²¸üÃÀ¹Û£¨Õâ¸öÓеãÖ÷¹Û...£©
~/.fken.conf£ºÅäÖÃÎļþ£¬Ä¿Ç°ÓÐÓõľÍһР......

Linuxѧϰ±Ê¼Ç

ÃüÁî
1.
file
×÷Óãº
file ͨ¹ý̽²âÎļþÄÚÈÝÀ´ÅжÏÎļþÀàÐÍ¡£
ʹÓÃfileÃüÁî¿ÉÒÔÖªµÀij¸öÎļþ¾¿¾¹ÊǶþ½øÖÆ(ELF¸ñʽ)µÄ¿ÉÖ´ÐÐÎļþ, »¹ÊÇShell scrīptÎļþ,»òÕßÊÇÆäËüµÄʲô¸ñʽ¡£fileÄÜʶ±ðµÄÎļþÀàÐÍÓÐĿ¼¡¢Shell½Å±¾¡¢Ó¢ÎÄÎı¾¡¢¶þ½øÖÆ¿ÉÖ´ÐÐÎļþ¡¢CÓïÑÔÔ´Îļþ¡¢Îı¾Îļþ¡¢DOSµÄ¿ÉÖ´ÐÐÎļþ¡£ ÐèҪ˵Ã÷µÄÊÇ,fileÃüÁî²»ÄÜ̽²â°üÀ¨Í¼ÐΡ¢ÒôƵ¡¢ÊÓƵµÈ¶àýÌåÎļþÀàÐÍ¡£
ȨÏÞ£º
ËùÓÐÓû§
¸ñʽ£º
file [options] ÎļþÃû
options:
-v ÔÚ±ê×¼Êä³öºóÏÔʾ°æ±¾ÐÅÏ¢£¬²¢ÇÒÍ˳ö
-z ̽²âѹËõ¹ýµÄÎļþÀàÐÍ
-L ÔÊÐí·ûºÏÁ¬½Ó
-f name ¶ÔnameÎļþÖеÄÎļþÃûÁбí½øÐÐfile²Ù×÷
¾ÙÀý£º
mxc@mxc-laptop:~$ file -v test.c
file-4.26
magic file from /etc/magic:/usr/share/file/magic
mxc@mxc-laptop:~$ file -z poppler-data-0.1.tar.gz
poppler-data-0.1.tar.gz: POSIX tar archive (GNU) (gzip compressed data, from Unix, last modified: Fri Sep 22 09:34:46 2006)
mxc@mxc-laptop:~$ file -f test.c
/home/mxc/test.c:   ASCII text
/home/mxc/wget-log: UTF-8 Unicode text, with CR, LF line terminators
2
mkdir
×÷Óãº
½¨Á¢Ãû³ÆΪdirnameµÄ ......

Linux ÐźŽéÉÜ

1) SIGHUP
±¾ÐźÅÔÚÓû§ÖÕ¶ËÁ¬½Ó(Õý³£»ò·ÇÕý³£)½áÊøʱ·¢³ö, Í¨³£ÊÇÔÚÖն˵ĿØÖƽø³Ì½áÊøʱ, Í¨ÖªÍ¬Ò»sessionÄڵĸ÷¸ö×÷Òµ, ÕâʱËüÃÇÓë¿ØÖÆÖն˲»ÔÙ¹ØÁª¡£
µÇ¼Linuxʱ£¬ÏµÍ³»á·ÖÅä¸øµÇ¼Óû§Ò»¸öÖÕ¶Ë(Session)¡£ÔÚÕâ¸öÖÕ¶ËÔËÐеÄËùÓгÌÐò£¬°üÀ¨Ç°Ì¨½ø³Ì×éºÍºǫ́½ø³Ì×飬һ°ã¶¼ÊôÓÚÕâ
¸ö Session¡£µ±Óû§Í˳öLinuxµÇ¼ʱ£¬Ç°Ì¨½ø³Ì×éºÍºǫ́ÓжÔÖÕ¶ËÊä³öµÄ½ø³Ì½«»áÊÕµ½SIGHUPÐźš£Õâ¸öÐźŵÄĬÈϲÙ×÷ΪÖÕÖ¹½ø³Ì£¬Òò´ËÇ°
̨½ø ³Ì×éºÍºǫ́ÓÐÖÕ¶ËÊä³öµÄ½ø³Ì¾Í»áÖÐÖ¹¡£²»¹ý¿ÉÒÔ²¶»ñÕâ¸öÐźţ¬±ÈÈçwgetÄܲ¶»ñSIGHUPÐźţ¬²¢ºöÂÔËü£¬ÕâÑù¾ÍËãÍ˳öÁËLinuxµÇ
¼£¬wgetÒ² ÄܼÌÐøÏÂÔØ¡£
´ËÍ⣬¶ÔÓÚÓëÖÕ¶ËÍÑÀë¹ØϵµÄÊØ»¤½ø³Ì£¬Õâ¸öÐźÅÓÃÓÚ֪ͨËüÖØжÁÈ¡ÅäÖÃÎļþ¡£
2) SIGINT
³ÌÐòÖÕÖ¹(interrupt)ÐźÅ, ÔÚÓû§¼üÈëINTR×Ö·û(ͨ³£ÊÇCtrl-C)ʱ·¢³ö£¬ÓÃÓÚ֪ͨǰ̨½ø³Ì×éÖÕÖ¹½ø³Ì¡£
3) SIGQUIT
ºÍSIGINTÀàËÆ, µ«ÓÉQUIT×Ö·û(ͨ³£ÊÇCtrl-\)À´¿ØÖÆ. ½ø³ÌÔÚÒòÊÕµ½SIGQUITÍ˳öʱ»á²úÉúcoreÎļþ, ÔÚÕâ¸öÒâÒåÉÏÀàËÆÓÚÒ»¸ö³ÌÐò´íÎóÐźš£
4) SIGILL
Ö´ÐÐÁË·Ç·¨Ö¸Áî. Í¨³£ÊÇÒòΪ¿ÉÖ´ÐÐÎļþ±¾Éí³öÏÖ´íÎó,  ......
×ܼǼÊý:5772; ×ÜÒ³Êý:962; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [950] [951] [952] [953] 954 [955] [956] [957] [958] [959]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ