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

ÉîÈëdz³ö LinuxÉ豸Çý¶¯×èÈûÓë·Ç×èÈû (select poll)


×èÈû²Ù×÷ÊÇÖ¸£¬ÔÚÖ´ÐÐÉ豸²Ù×÷ʱ£¬Èô²»ÄÜ»ñµÃ×ÊÔ´£¬Ôò½ø³Ì¹ÒÆðÖ±µ½Âú×ã¿É²Ù×÷µÄÌõ¼þÔÙ½øÐвÙ×÷¡£·Ç×èÈû²Ù×÷µÄ½ø³ÌÔÚ²»ÄܽøÐÐÉ豸²Ù×÷ʱ£¬²¢²»¹ÒÆð¡£±»¹ÒÆðµÄ½ø³Ì½øÈësleep״̬£¬±»´Óµ÷¶ÈÆ÷µÄÔËÐжÓÁÐÒÆ×ߣ¬Ö±µ½µÈ´ýµÄÌõ¼þ±»Âú×ã¡£
ÔÚLinuxÇý¶¯³ÌÐòÖУ¬ÎÒÃÇ¿ÉÒÔʹÓõȴý¶ÓÁУ¨wait queue£©À´ÊµÏÖ×èÈû²Ù×÷¡£wait queueºÜÔç¾Í×÷Ϊһ¸ö»ù±¾µÄ¹¦Äܵ¥Î»³öÏÖÔÚLinuxÄÚºËÀïÁË£¬ËüÒÔ¶ÓÁÐΪ»ù´¡Êý¾Ý½á¹¹£¬Óë½ø³Ìµ÷¶È»úÖƽôÃܽáºÏ£¬Äܹ»ÓÃÓÚʵÏÖºËÐĵÄÒ첽ʼþ֪ͨ»úÖÆ¡£µÈ´ý¶ÓÁпÉÒÔÓÃÀ´Í¬²½¶Ôϵͳ×ÊÔ´µÄ·ÃÎÊ£¬ÉϽÚÖÐËù½²ÊöLinuxÐźÅÁ¿ÔÚÄÚºËÖÐÒ²ÊÇÓɵȴý¶ÓÁÐÀ´ÊµÏֵġ£
ÏÂÃæÎÒÃÇÖØж¨ÒåÉ豸"globalvar"£¬Ëü¿ÉÒÔ±»¶à¸ö½ø³Ì´ò¿ª£¬µ«ÊÇÿ´ÎÖ»Óе±Ò»¸ö½ø³ÌдÈëÁËÒ»¸öÊý¾ÝÖ®ºó±¾½ø³Ì»òÆäËü½ø³Ì²Å¿ÉÒÔ¶ÁÈ¡¸ÃÊý¾Ý£¬·ñÔòÒ»Ö±×èÈû¡£
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/wait.h>
#include <asm/semaphore.h>
MODULE_LICENSE("GPL");
#define MAJOR_NUM 254
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*);
struct file_operations globalvar_fops =
{
¡¡read: globalvar_read,
write: globalvar_write,
};
static int global_var = 0;
static struct semaphore sem;
static wait_queue_head_t outq;
static int flag = 0;
static int __init globalvar_init(void)
{
¡¡int ret;
¡¡ret = register_chrdev(MAJOR_NUM, "globalvar", &globalvar_fops);
¡¡if (ret)
¡¡{
¡¡¡¡printk("globalvar register failure");
¡¡}
¡¡else
¡¡{
¡¡¡¡printk("globalvar register success");
¡¡¡¡init_MUTEX(&sem);
¡¡¡¡init_waitqueue_head(&outq);
¡¡}
¡¡return ret;
}
static void __exit globalvar_exit(void)
{
¡¡int ret;
¡¡ret = unregister_chrdev(MAJOR_NUM, "globalvar");
¡¡if (ret)
¡¡{
¡¡¡¡printk("globalvar unregister failure");
¡¡}
¡¡else
¡¡{
¡¡¡¡printk("globalvar unregister success");
¡¡}
}
static ssize_t globalvar_read(struct file *filp, char *buf, size_t len, loff_t *off)
{
¡¡//µÈ´ýÊý¾Ý¿É»ñµÃ
¡¡if (wait_event_interruptible(outq, flag


Ïà¹ØÎĵµ£º

linux ulimit max open files

ÓÐʱºòÔÚ³ÌÐòÀïÃæÐèÒª´ò¿ª¶à¸öÎļþ£¬½øÐзÖÎö£¬ÏµÍ³Ò»°ãĬÈÏÊýÁ¿ÊÇ1024£¬£¨ÓÃulimit -a¿ÉÒÔ¿´µ½£©¶ÔÓÚÕý³£Ê¹ÓÃÊǹ»ÁË£¬µ«ÊǶÔÓÚ³ÌÐòÀ´½²£¬¾ÍÌ«ÉÙÁË¡£
Ð޸İ취£º
ÖØÆô¾ÍOK
ÐÞ¸Ä2¸öÎļþ¡£
1./etc/security/limits.conf
vi /etc/security/limits.conf
¼ÓÉÏ£º
* soft nofile 8192
* hard nofile 20480
2./etc/pam.d/l ......

LinuxͼÐνçÃæÖпͻ§¶Ë·þÎñÆ÷´°¿Ú¹ÜÀíÆ÷Ö®¼äµÄ¹Øϵ


LinuxͼÐνçÃæÖпͻ§¶Ë¡¢·þÎñÆ÷¡¢´°¿Ú¹ÜÀíÆ÷Ö®¼äµÄ¹Øϵ
×÷Õߣº
ÁõºéÌΣ¬»ªÇåÔ¶¼ûǶÈëʽѧԺ
½ðÅƽ²Ê¦£¬ARM ATCÊÚȨÅàѵ½²Ê¦¡£
ºÜ
¶àLINUX³õѧÕßÔÚѧϰlinuxͼÐη½ÃæµÄ֪ʶʱ»áÓöµ½Ò»Ð©¸ÅÄÈ磺X¡¢X11¡¢Xfree86¡¢WM¡¢KDE¡¢GNOME¡¢QT¡¢QT/E¡¢
Qtopia¡¢DirectFB¡¢Framebuffer¡¢ÏÔ¿¨¼ÓËÙÇý¶¯µÈµÈ¡£Àí½âËüÃÇÖ ......

LinuxÏÂSVN·þÎñÆ÷µÄ°²×°

        Õâ´Îתµ½Á˺½¿ÕµÄÒ»¸öÏîÄ¿£¬ÐèÒªÔÚLinuxÏÂÓÃC×ö¿ª·¢¡£°æ±¾¹ÜÀí²ÉÓÃSVN£¬´Ó×òÌìÏÂÎ翪ʼÎҾͿªÊ¼ÁË°²×°£¬ÕæµÄÊÇÍ´¿àµÄ¹ý³Ì¡£ÏÖÔÚµ¹ÊÇ°²×°ºÃÁË£¬µ«ÊÇÅäÖÃÃüÁûÓÐÕÆÎÕ¡£
        Èç¹ûÓÐȨÏÞ´ÓÍøÉÏÖ±½Ó¸üÐÂÈí¼þ£¬ÎÒ²»±Øÿ´Î¶¼È¥ÕÒÔ´Âë°ü£¬È ......

ÔÚLinuxÉϽ»²æ±àÒëwindows³ÌÐò

ת×Ô:http://www.cublog.cn/u/12592/showart_163722.html
×î½ü¼¸Ìì¸ã wxWidgets£¬ÓÉÓÚҪͬʱ±àÒëÓ¦ÓóÌÐòµÄ Windows °æ±¾£¬ÓÖÀÁµÃÔÚÐéÄâ»úÀïÃæ±àÒë³ÌÐò£¬ÓÚÊÇÏëµ½Óý»²æ±àÒëµÄ·½Ê½ÔÚ Linux ÉϱàÒëºÃ Windows °æ±¾µÄ³ÌÐò£¬ÔÙÓà Wine »òÕßÐéÄâ»úÀ´Ö´ÐС£ÊÔÁËһϣ¬ÕâÖÖ·½·¨ºÜºÃÓ㬱ÈÔÚÐéÄâ»úÀïÃæ±àÒë³ÌÐò¿ìºÜ¶à¡£
ÎҵIJÙ×÷ ......

linuxÇý¶¯¿ª·¢Ñ§Ï°±Ê¼Ç£¨¶þ£©

                scull µÄMakefile
Makefile½Å±¾ÈçÏÂËùʾ¡£
--------------------------------------------------------------------------------
KERNEL_MAKE := -C /home/zhoumin/hi3511/Hi3511_VSSDK_V1.1.2.1/pub/kbuild-LESS_REL
PWD := $(shell pwd ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ