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

LINUX´®¿Ú¼òÃ÷½âÎö[ÐÞÕý°æ][0919]

LINUX´®¿Ú¼òÃ÷½âÎö[ÐÞÕý°æ][0919]
09-14
ÉÏÖܵÄʱºò£¬·¢ÁËƪÎÄÕ£¬¹ØÓÚlinux´®¿ÚµÄ¡¾µ±È»³ÌÐòʦת±ðÈ˵ģ¨»¹ÊÇ·¢²¼ÔÚIBM¿ª·¢ÕßÉçÇøµÄàÏ£©¡¿£¬
ËäÈ»µ±Ê±ÄÜÅܵÄͨ£¬µ«ÕâÖÜÔÚÓõÄʱºòÈ´·¢ÏÖ²»ÐÐÁË£¬ÓÚÊǾö¶¨×ÐϸÑо¿ÏÂlinuxÏ´®¿ÚÕⶫÎ÷£¡
µ±È»ÄǸö³ÌÐòÓÐÎÊÌ⣬¾ÍÒª×Ô¼ºÖØÐÂдÀ²¡£¡£¡£¡£¡£¡£OTZ ¡£¡£¡£¡£¶ö¡£¡£¡£ÎÒÏòÀ´±È½ÏÀÁ¡£¡£¡£¡£
µ±È»Ñо¿¹ý³ÌÖл¹ÊÇÃ÷°×Á˲»ÉÙ¶«Î÷µÄ
1£¬½â¾öminicomÆô¶¯ºó²ÅÄÜÕý³£¶ÁÈ¡Êý¾ÝµÄÎÊÌâ
2.  ½â¾ö¶ÁÈ¡Êý¾ÝȱʧµÄÎÊÌâ
3.  ѧϰʹÓÃselectº¯Ê½¼ì²â´®¿Ú״̬ÐÅÏ¢
¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£
µ±È»Õâ´Î˳´ø¼Óµã×Ô¼ºµÄ·ÖÎö
´®¿ÚµÄÅäÖÃÒ»°ãÒ²¾ÍÊDz¨ÌØÂÊ£¬Êý¾Ý¸ñʽÕâЩ¶«Î÷£¬¶ølinux»·¾³ÏÂÔòͨ¹ýÒ»ÃûΪtermiosµÄ½á¹¹Ìå¶ÔÆä½øÐÐÅäÖÃ
Æä³ÉÔ±ÈçÏÂ
                     Termios Structure Members
MemberDescription
c_cflag
Control options
c_lflag
Line options
c_iflag
Input options
c_oflag
Output options
c_cc
Control characters
c_ispeed
Input baud (new interface)
c_ospeed
Output baud (new interface)
¿´Ó¢ÎľͺÜÈÝÒ×Ã÷°×ÁË£¬ËùÒÔÎÒÒ²²»¶à˵ɶÁË¡£
Õâ¸ö½á¹¹ÌåÆäʵºÜ¼òµ¥£¬µ«ÆäÖÐÿһÏîµÄÅäÖÃÈ´Òª¸´ÔӵĶ࣬ʵ¼ÊÉÏÎÒҲûÓÐÖðÏîµÄѧϰ
Ö»ÊǼñÓÐÓõĿ´ÁËÏ£¬¶øÏÂÃæ¾ÍÊǹØÓÚÕâЩ֪ʶµÄ¼Ç¼¡£
1.´ò¿ª´®¿Ú
const char * serial_port[]={
"/dev/ttyS0",
"/dev/ttyS1",
"/dev/ttyS2",
"/dev/ttyS3",
"/dev/ttyS4"
};
int serial_open(int port)
{
int fd = open(serial_port[port], O_RDWR|O_NONBLOCK);
if (-1 == fd)
{
perror("Can't Open Serial Port");
exit (-1);
}
else
{
fcntl(fd, F_SETFL, 0);
}
return fd;
}
´ò¿ªÊ±Ò»°ã¿ÉÒÔÓÃO_RDWR £¬O_NOCTTY £¬ O_NDELAYÕâÈý¸ö²ÎÊýµÄ×éºÏ
·Ö±ð´ú±í¶Áд[µ±È»ÓжÔÓ¦Ö»¶Á£¬Ö»Ð´µÄ£¬²Â¶¼²Âµ½ÁË]£¬µÚ¶þ¸ö¸æËßϵͳ¸Ã´®¿Ú²»±»ÓÃÀ´×÷¿ØÖÆÖնˡ¾Ã»ÅªÃ÷°×£¬·´ÕýÒ»°ãÎÒÊDz»Ó㬼û¹ý¸úmodemͨÐŵijÌÐò»áÓõ½¡¿
×îºóÄǸö¾ÍÊDz»ÒªµÈµÄÒâ˼À²¡£¡£¡£¡£¡£¡£
2.ÅäÖô®¿Ú
 typedef
enum { SERIAL_8N1=0, SERIAL_7E1=1, SERIAL_7O1=2, SERIAL_7S1=3 }serial_format;
voi


Ïà¹ØÎĵµ£º

linuxѹËõÃüÁî tar

root@linux ~]# tar [-cxtzjvfpPN] ÎļþÓëĿ¼ ....
²ÎÊý£º
-c £º½¨Á¢Ò»¸öѹËõÎļþµÄ²ÎÊýÖ¸Áî(create µÄÒâ˼)£»
-x £º½â¿ªÒ»¸öѹËõÎļþµÄ²ÎÊýÖ¸Á
-t £º²é¿´ tarfile ÀïÃæµÄÎļþ£¡
Ìرð×¢Ò⣬ÔÚ²ÎÊýµÄÏ´ïÖУ¬ c/x/t ½öÄÜ´æÔÚÒ»¸ö£¡²»¿Éͬʱ´æÔÚ£¡
ÒòΪ²»¿ÉÄÜͬʱѹËõÓë½âѹËõ¡£
-z £ºÊÇ·ñͬʱ¾ßÓÐ gzip µÄÊôÐÔ£¿Ò ......

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

¡¡Èý.±àдLinuxÍøÂçÇý¶¯³ÌÐòÖÐÐèҪעÒâµÄÎÊÌâ
¡¡¡¡3.1 ÖжϹ²Ïí
¡¡¡¡LinuxϵͳÔËÐм¸¸öÉ豸¹²Ïíͬһ¸öÖжϡ£ÐèÒª¹²ÏíµÄ»°£¬ÔÚÉêÇëµÄʱºòÖ¸Ã÷¹²Ïí·½Ê½¡£ÏµÍ³ÌṩµÄrequest_irq()µ÷ÓõĶ¨Ò壺
¡¡¡¡¡¡¡¡int request_irq(unsigned int irq,
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡void (*handler)(int irq, void *dev_id, struct pt_regs *re ......

LinuxϵͳµÄÍ·ÎļþºÍ¿âÎļþËÑË÷·¾¶

IncludeµÄheaderÎļþ,Á¬½áÊý¾Ý¿â£¬ÏµÍ³¶¨Ò壬×ܹ²ÓÐÏÂÁÐÀ´Ô´Ö¸¶¨gccÈ¥ÄÇÕÒ¡£
µ±³õÔÚ±àÒëʱָ¶¨µÄ(ÔÚ~gcc/gcc/collect2.c:locatelib()
дÔÚspecsÄÚµÄ
ºóÀ´ÓÃ-D -I -LÖ¸¶¨µÄ
gcc»·¾³±äÁ¿É趨(±àÒëµÄʱºò)
ld.soµÄ»·¾³±äÁ¿(ÕâÊÇrun timeµÄʱºò£©
Ò»¡¢Í·Îļþ
gcc ÔÚ±àÒëʱÈçºÎȥѰÕÒËùÐèÒªµÄÍ·Îļþ £º
¡ùËùÒÔheader fil ......

linux ÖеÃ×Ô¼ºµÄipµØÖ·´úÂë

DWORD GetLocalAddr(char* interface)
{
 struct ifreq ifr;
    int fd;
    int err;
    unsigned long ip;
    strcpy(ifr.ifr_name, interface);
    fd = socket(AF_INET, SOCK_DGRAM, 0);
    err = ioctl ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ