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

linuxÇý¶¯ ×ÔÐýËøµÄÔËÓÃ


linuxÇý¶¯ ×ÔÐýËøµÄÔËÓÃ
//hello.c
#define __NO_VERSION__
#include <linux/module.h>
#include <linux/config.h>
#include <linux/version.h>
#include <asm/uaccess.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <asm/page.h>
#include <linux/poll.h>
#include <linux/kdev_t.h>
#include <asm/semaphore.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <asm/uaccess.h>
#include <asm/irq.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
unsigned int test_major = 0;
static int global_var=0;
static int globalvar_count = 0;
char *mystr="wodeshen" ;
static struct semaphore sem;
static spinlock_t spin = SPIN_LOCK_UNLOCKED; //ºê¶¨Òå ÒѾ­³õʼ»¯
static ssize_t read_test(struct file *file,char *buf,size_t count,loff_t *f_pos)
{
int left;
printk(KERN_INFO "read_test\n");
if (verify_area(VERIFY_WRITE,buf,count) == -EFAULT )
return -EFAULT;
if (down_interruptible(&sem))
{
return - ERESTARTSYS;
}
printk("copy_to_user======2=======\n");
copy_to_user(buf, mystr, strlen(mystr));
/*
for(left = count ; left > 0 ; left--)
{
__put_user('1',buf);
buf++;
}
*/
up(&sem);
//return sizeof(int);
return  strlen(mystr);
}
static ssize_t write_test(struct file *file, const char *buf, size_t count, loff_t *f_pos)
{
if (down_interruptible(&sem))
{
return - ERESTARTSYS;
}
if (copy_from_user(&global_var, buf, sizeof(int)))
{
up(&sem);
return - EFAULT;
}
up(&sem);
printk(KERN_INFO "write_test\n");
return sizeof(int);
}
static int open_test(struct inode *inode,struct file *file )
{
spin_lock(&spin);
printk("globalvar open\n");
//ÁÙ½ç×ÊÔ´·ÃÎÊ
if (globalvar_count)
{
spin_unlock(&spin);
return - EBUSY;
}
globalvar_count++;
//ÊÍ·Å×Ô


Ïà¹ØÎĵµ£º

LinuxÉ豸ģÐÍÖ®input×ÓϵͳÏê½â

Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......

LinuxÖеŤ×÷¶ÓÁÐ(work queue)

¹¤×÷¶ÓÁÐ(work queue)ÊÇLinux kernelÖн«¹¤×÷ÍƺóÖ´ÐеÄÒ»ÖÖ»úÖÆ¡£ÕâÖÖ»úÖƺÍBH(bottom half)»òTasklets²»Í¬Ö®´¦ÔÚÓÚ¹¤×÷¶ÓÁÐÊÇ°ÑÍƺóµÄ¹¤×÷½»ÓÉÒ»¸öÄÚºËÏß³ÌÈ¥Ö´ÐУ¬Òò´Ë¹¤×÷¶ÓÁеÄÓÅÊƾÍÔÚÓÚËüÔÊÐíÖØе÷¶ÈÉõÖÁ˯Ãß¡£
linux 2.6.20ÒԺ󣬹¤×÷¶ÓÁлúÖƺÍ֮ǰµÄ°æ±¾ÓÐÒ»µã²»Í¬£¬ÔÚÍøÉÏÕÒÁËÒ»µã×ÊÁÏ£¬Ò²ÏàÓ¦µÄ¿´ÁËһЩcode£ ......

ÔÚlinuxÉÏsilent°²×°oracle¼òÖ±ÊÇÒ»³¡Ø¬ÃÎ

 Parsing command line arguments:
    Parameter "silent" = true
java.lang.ArrayIndexOutOfBoundsException: 2
        at oracle.net.ca.CmdlineArgs.parseArgs(Unknown Source)
        at oracle.net.ca.I ......

Linux ¼à¿Ø/SNMPÅäÖÃ

http://www.zhetao.com/content.dep?m=news&id=1235137892661247
 ·¢²¼ÈÕÆÚ 2009-2-20 21:51:32
Linux
ϵͳµÄ
SNMP
·þÎñÉèÖÃ
1)
°²×°
SNMP
ÂÔ£¬Çë²ÎÔÄ
LINUX
ϵͳ
SNMP
°²×°ËµÃ÷£¬Ò»°ãÇé¿öÏÂ
Linux
ÖеľùÒѾ­×Ô¶¯°²×°ÁË
SNMP
·þÎñ¡£ÒÔÏÂÃüÁî¿ÉÒÔ¼ì²â
SNMP
·þÎñÊÇ·ñ°²×°ÒÔ¼°°²×°µÄÎļþ°ü¡£
[ ......

¡¾×ª¡¿linuxÎļþºÍĿ¼¹ÜÀí

1¡¢LinuxÎļþϵͳÊÇ´Ó/¿ªÊ¼µÄ£»
ÔÚLinux²Ù×÷ϵͳµÄÎļþ¹ÜÀíÖУ¬ÃüÁîÐÐģʽ£¨ÔÚ¿ØÖÆ̨»òÖÕ¶ËÏ£©µÄÎļþ»òĿ¼¹ÜÀí£¬ÒªÉ漰·¾¶ÕâÒ»¸ÅÄÕâÊÇLinuxÃüÁîÐвÙ×÷µÄ×î»ù´¡µÄ»ù´¡¡£Èç¹ûÎÒÃÇÁ˽âÁË·¾¶µÄ¸ÅÄ¾Í¿ÉÒÔËæÐÄËùÓûµÄ½øÈëÈκÎĿ¼£¬½øÐÐÎÒÃÇÏëµÄ¹¤×÷¡£
Linux Îļþϵͳ£¬ÊÇÒ»¸ö³ÊÊ÷Ðνṹ£¬ÊÇ´Ó/×öΪÈë¿Ú£¬/£¨Ò²±»³ÆΪ¸ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ