ÉîÈëdz³öLinuxÉ豸Çý¶¯Ö®×èÈûÓë·Ç×èÈû
×¢: ¸ÃϵÁÐÎÄÕÂתÔØ×Ôarm+linux chinaunix²©¿ÍȦȦÖ÷Ö®²©¿Í——http://blog.chinaunix.net/u/22630 /article_54997.html ΪÁËÊʺÏÎҵıàÒë»·¾³£¬Ô´´úÂëÓиĶ¯£¬µ«ÊÇÏàÐÅÎÒ¸ü¸ÄºóµÄ´úÂë¸ü¼ÓÊʺÏÏÖÔÚ´ó¶àÊý¶ÁÕßµÄpc»·¾³¡£
×èÈû²Ù×÷ÊÇÖ¸£¬ÔÚÖ´ÐÐÉ豸²Ù×÷ʱ£¬Èô²»ÄÜ»ñµÃ×ÊÔ´£¬Ôò½ø³Ì¹ÒÆðÖ±µ½Âú×ã¿É²Ù×÷µÄÌõ¼þÔÙ½øÐвÙ×÷¡£±»¹ÒÆðµÄ½ø³Ì½øÈësleep״̬£¬±»´Óµ÷¶ÈÆ÷µÄÔËÐжÓÁÐÒÆ×ߣ¬Ö±µ½µÈ´ýµÄÌõ¼þ±»Âú×ã¡£·Ç×èÈû²Ù×÷µÄ½ø³ÌÔÚ²»ÄܽøÐÐÉ豸²Ù×÷ʱ£¬²¢²»¹ÒÆð¡£±ÈÈçsocketÀïÃæµÄread£¬Èç¹û¿Í»§¶Ë²»·¢ËÍÊý¾Ý£¬ÄÇô·þÎñ¶Ë¾ÍÒªÒ»Ö±µÈÏÂÈ¥¡£
ÔÚLinuxÇý¶¯³ÌÐòÖУ¬ÎÒÃÇ¿ÉÒÔʹÓõȴý¶ÓÁУ¨wait queue£©À´ÊµÏÖ×èÈû²Ù×÷¡£wait queueºÜÔç¾Í×÷Ϊһ¸ö»ù±¾µÄ¹¦Äܵ¥Î»³öÏÖÔÚLinuxÄÚºËÀïÁË£¬ËüÒÔ¶ÓÁÐΪ»ù´¡Êý¾Ý½á¹¹£¬Óë½ø³Ìµ÷¶È»úÖƽôÃܽáºÏ£¬Äܹ»ÓÃÓÚʵÏÖºËÐĵÄÒ첽ʼþ֪ͨ»úÖÆ¡£µÈ´ý¶ÓÁпÉÒÔÓÃÀ´Í¬²½¶Ôϵͳ×ÊÔ´µÄ·ÃÎÊ£¬ÉϽÚÖÐËù½²ÊöLinuxÐźÅÁ¿ÔÚÄÚºËÖÐÒ²ÊÇÓɵȴý¶ÓÁÐÀ´ÊµÏֵġ£
waitµÄAPI£º
wait_event(queue, condition)
wait_event_interruptible(queue, condition)
wait_event_timeout(queue, condition, timeout)
wait_event_interruptible_timeout(queue, condition, timeout)
µÈ´ýcondition±äΪtrue£¬·ñÔòһֱ˯Ãß
condition¿ÉÒÔÔÚÈκεط½±»¸Ä±ä£¬µ«¸Ä±äʱÐëwake_up µÈ´ý¶ÓÁÐwqÀïÃæµÄprocess¡£
»½ÐѺ¯Êý£º
void wake_up(wait_queue_head_t *queue); //»½ÐÑËùÓÐ
void wake_up_interruptible(wait_queue_head_t *queue); //»½ÐÑinterruptible
ÏÂÃæÎÒÃÇÖØж¨ÒåÉ豸"globalvar"£¬Ëü¿ÉÒÔ±»¶à¸ö½ø³Ì´ò¿ª£¬µ«ÊÇÿ´ÎÖ»Óе±Ò»¸ö½ø³ÌдÈëÁËÒ»¸öÊý¾ÝÖ®ºó±¾½ø³Ì»òÆäËü½ø³Ì²Å¿ÉÒÔ¶ÁÈ¡¸ÃÊý¾Ý£¬·ñÔòÒ»Ö±×èÈû¡£
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <asm/uaccess.h>
#include <asm/semaphore.h>
MODULE_LICENSE("GPL");
#define MAJOR_NUM 250 //Ö÷É豸ºÅ
static ssize_t globalvar_read(struct file *, char *, size_t, loff_t*);
static ssize_t globalvar_write(struct file *, const char *, size_t, loff_t*);
static int globalvar_open(struct inode *,struct file *);
Ïà¹ØÎĵµ£º
1.×¼±¸·ÖÇø
ÓÉÓÚSolarisºÍVista(µÄÒýµ¼¼ÓÔØ)±ØÐë°²×°ÔÚÖ÷·ÖÇøÉÏ£¬linuxÊÇ¿ÉÒÔ°´ÔÚÀ©Õ¹·ÖÇøÉϵÄ
ËùÒÔÎÒ°Ñ´ÅÅÌ·Ö³É
30GÖ÷·ÖÇø£º°²×°Vista
27GÖ÷·ÖÇø£º±¾À´Òª°²×°FreeBSD(Ò²±ØÐë°²×°ÔÚÖ÷·ÖÇøÉÏ,µ«ÊÇFreeBSD²»Ö§³ÖÎҵĻú×ÓËùÒÔ·ÅÆú)
135GÀ©Õ¹·ÖÇø£ºÆäÖзֳö40GµÄÂß¼Å̸ ......
ºÜÔçÒÔÇ°,¾ÍÏë°Ñ×Ô¼ºÔÚ¿ª·¢ÏîĿʱ¹ØÓÚlinuxÊØ»¤½ø³ÌµÄ¼¼ÊõÕûÀíÒ»ÏÂ,·¢±íһƪÎÄÕÂ.½ñÌìÔÚÍøÉÏżȻÅöµ½ÓÐһƪдµÄͦ²»´íµÄÎÄÕÂ,ÕýºÃ¿ÉÒÔתÌù¹ýÀ´ºÍ´ó¼Ò·ÖÏí.
Linux Deamon±à³Ì·½·¨
ÊØ»¤½ø³Ì£¨Daemon£©ÊÇÔËÐÐÔÚºǫ́µÄÒ»ÖÖÌØÊâ½ø³Ì¡£Ëü¶ÀÁ¢ÓÚ¿ØÖÆÖն˲¢ÇÒÖ ......
ת×Ô:http://www.cublog.cn/u/12592/showart_163722.html
×î½ü¼¸Ìì¸ã wxWidgets£¬ÓÉÓÚҪͬʱ±àÒëÓ¦ÓóÌÐòµÄ Windows °æ±¾£¬ÓÖÀÁµÃÔÚÐéÄâ»úÀïÃæ±àÒë³ÌÐò£¬ÓÚÊÇÏëµ½Óý»²æ±àÒëµÄ·½Ê½ÔÚ Linux ÉϱàÒëºÃ Windows °æ±¾µÄ³ÌÐò£¬ÔÙÓà Wine »òÕßÐéÄâ»úÀ´Ö´ÐС£ÊÔÁËһϣ¬ÕâÖÖ·½·¨ºÜºÃÓ㬱ÈÔÚÐéÄâ»úÀïÃæ±àÒë³ÌÐò¿ìºÜ¶à¡£
ÎҵIJÙ×÷ ......