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

linux 0.11 ÄÚºËѧϰ ioctl.c


/*
 * ioctl.c ÎļþʵÏÖÁËÊäÈë/Êä³ö¿ØÖÆÏµÍ³µ÷ÓÃioctl()£¬¸Ãº¯Êý
 * Ö÷ÒªÊǵ÷Óú¯Êýtty_ioctl()¶ÔÖն˵ÄIO½øÐпØÖÆ
 */
/*
 *  linux/fs/ioctl.c
 *
 *  (C) 1991  Linus Torvalds
 */
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <linux/sched.h>
extern int tty_ioctl(int dev, int cmd, int arg);
typedef int (*ioctl_ptr)(int dev,int cmd,int arg);
/* ¶¨ÒåϵͳÖÐÉ豸ÖÖÊý */
#define NRDEVS ((sizeof (ioctl_table))/(sizeof (ioctl_ptr)))
/* ioctl ²Ù×÷º¯ÊýÖ¸Õë±í */
static ioctl_ptr ioctl_table[]={
NULL, /* nodev */
NULL, /* /dev/mem */
NULL, /* /dev/fd */
NULL, /* /dev/hd */
tty_ioctl, /* /dev/ttyx */
tty_ioctl, /* /dev/tty */
NULL, /* /dev/lp */
NULL}; /* named pipes */

/* ÊäÈëÊä³ö¿ØÖƺ¯Êý */
int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
{
struct file * filp;
int dev,mode;
// Èç¹ûÎļþÃèÊö·û³¬³ö¿É´ò¿ªµÄÎļþÊý£¬»òÕß¶ÔÓ¦ÃèÊö·ûµÄÎļþ½á¹¹Ö¸ÕëΪ¿Õ£¬Ôò·µ»Ø³ö´íÂë
if (fd >= NR_OPEN || !(filp = current->filp[fd]))
return -EBADF;
// È¡¶ÔÓ¦ÎļþµÄÊôÐÔ
mode=filp->f_inode->i_mode;
// Èç¹û¸ÃÎļþ²»ÊÇ×Ö·ûÎļþ£¬Ò²²»ÊÇ¿éÉ豸Îļþ£¬Ôò·µ»Ø³ö´íÂë
if (!S_ISCHR(mode) && !S_ISBLK(mode))
return -EINVAL;
// ´Ó×Ö·û»ò¿éÉ豸ÎļþµÄi ½ÚµãÖÐÈ¡É豸ºÅ¡£Èç¹ûÉ豸ºÅ´óÓÚϵͳÏÖÓеÄÉ豸Êý£¬Ôò·µ»Ø³ö´íºÅ
dev = filp->f_inode->i_zone[0];
if (MAJOR(dev) >= NRDEVS)
return -ENODEV;
// Èç¹û¸ÃÉ豸ÔÚioctl º¯ÊýÖ¸Õë±íÖÐûÓжÔÓ¦º¯Êý
if (!ioctl_table[MAJOR(dev)])
return -ENOTTY;
// ·ñÔò·µ»ØÊµ¼Êioctl º¯Êý·µ»ØÂë
return ioctl_table[MAJOR(dev)](dev,cmd,arg);
}
²Î¿¼¡¶linuxÄÚºËÍêȫעÊÍ¡·ºÍÍøÉÏÏà¹ØÎÄÕÂ


Ïà¹ØÎĵµ£º

linuxÓëj2ee

Linux ³£ÓÃÃüÁî
Linux ϵͳ³£ÓÃÃüÁî¸ñʽ£º
    command  [option]  [argument1]  [argument2]  ...
ÆäÖÐoptionÒÔ“-”¿ªÊ¼£¬¶à¸öoption¿ÉÓÃÒ»¸ö“-”Á¬ÆðÀ´£¬Èç“ls -l -a” Óë“ls -la”µÄЧ¹ûÊÇÒ»ÑùµÄ¡£¸ù¾Ýà ......

linux£¬windows¹µÍ¨µÄÇÅÁºssh

½éÉÜSSH
ʲôÊÇSSH£¿
´«Í³µÄÍøÂç·þÎñ³ÌÐò£¬È磺ftp¡¢popºÍtelnetÔÚ±¾ÖÊÉ϶¼ÊDz»°²È«µÄ£¬ÒòΪËüÃÇÔÚÍøÂçÉÏÓÃÃ÷ÎÄ´«ËÍ¿ÚÁîºÍÊý¾Ý£¬±ðÓÐÓÃÐĵÄÈ˷dz£ÈÝÒ׾ͿÉÒԽػñÕâЩ¿ÚÁîºÍÊý¾Ý¡£¶øÇÒ£¬ÕâЩ·þÎñ³ÌÐòµÄ°²È«ÑéÖ¤·½Ê½Ò²ÊÇÓÐÆäÈõµãµÄ£¬¾ÍÊǺÜÈÝÒ×Êܵ½“ÖмäÈË”£¨man-in-the-middle£©ÕâÖÖ·½Ê½µÄ¹¥»÷¡£Ëùν“ÖÐ ......

linuxϵÄAndroid¿ª·¢

ÏÂÔØ SDK
ϵͳºÍÈí¼þÐèÇó
ÓÃAndroid sdkµÄ´úÂëºÍ¹¤¾ß¿ª·¢AndroidÓ¦ÓóÌÐò,ÄãÐèÒªÏÂÃæÁгöÀ´µÄºÏÊÊ¿ª·¢µçÄԺͿª·¢»·¾³.
ËùÐè²Ù×÷ϵͳ:
•Windows XP »ò Vista
•Mac OS X 10.4.8 »ò¸ü¸ß°æ±¾ (½öÖ§³Öx86)
•Linux ( Linux Ubuntu Dapper Drake °æ±¾ÒѲâÊÔ)
ËùÐ迪·¢»·¾³:
•Eclipse IDE
◦Ecli ......

linux 0.11 ÄÚºËѧϰ fcntl.c


/*
 *  linux/fs/fcntl.c
 *
 *  (C) 1991  Linus Torvalds
 */
#include <string.h>
#include <errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <fcntl.h>
#include <sys/stat. ......

linux 0.11 ÄÚºËѧϰ inode.c


/*
 *  linux/fs/inode.c
 *
 *  (C) 1991  Linus Torvalds
 */
#include <string.h>
#include <sys/stat.h> // Îļþ״̬ͷÎļþ
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <asm/system.h> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ