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

Ìí¼ÓLinuxϵͳµ÷ÓÃ

¡¾ÊµÑé»·¾³¡¿
Fedora£¬ÄÚºË2.6.21.6
¡¾ÊµÑé²½Öè¡¿
1. cd /usr/src/linux
2. vi kernel/sys.c
ÔÚ×îºóÌí¼ÓÈçÏ´úÂ룺
asmlinkage long sys_processinfo(void)
{
int num=0;
unsigned long state;
struct task_struct *p;
for_each_process(p)
{
printk("pid=%-5d,name=%-20s",p->tgid,p->comm);
printk("prio=%-5d,",p->prio);
state=p->state;
if(state==-1)
printk("state: Z\n");
else if (state==1)
printk("state: R\n");
else printk("state: S\n");
num++;
}
return num;
}
ÉÏÊö´úÂëʵÏÖ±éÀúÕû¸öÈÎÎñÁÐ±í£¬²¢½«½ø³Ìid£¬name ¼°state ´òÓ¡ÔÚÆÁÄ»ÉÏ£¬·µ»Ø½ø³Ì×Ü
7
Êý¡£
3. vi arch/i386/kernel/syscall_table.S
ÔÚ×îºó¼ÓÈë .long sys_processinfo
4. vi include/asm/unistd.h
ÔÚÖмäÌí¼Ó #define __NR_process 322 ·ÖÅäϵͳµ÷ÓúÅ
½«ÏÂÃæ¸ÄΪ #define NR_syscalls 323
5. vi /usr/include/asm/unistd.h
ÔÚ×îºóÌí¼Ó #define __NR_process 322
6. ¿ªÊ¼ÖØбàÒëÄÚºË
cd /usr/src/linux
make mrproper
make menuconfig
make
make modules_install
make install
reboot
7. ½øÈëÐÂÄںˣ¬±àд²âÊÔ³ÌÐòtest.c
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <asm/unistd.h>
#include <syscall.h>
int main()
{
syscall(322);
printf("the total number is: %d",syscall(322));
return 0;
}
8. gcc –o test test.c
9. ./test ÏÔʾ½á¹û


Ïà¹ØÎĵµ£º

xp+vmware+linuxµÄÍøÂçÁ¬½Ó

ÒÔÏÂת×Ô£ºhttp://www.lerich.com/viewthread.php?tid=640
Ö÷»úΪWindowsXPϵͳ£¬VMwareÐéÄâ»úÀï°²×°Linux²Ù×÷ϵͳ¡£°²×°ÍêVMwareºó£¬Ö÷»úµÄÍøÂçÁ¬½ÓÀïÃæ³öÏÖÁËÁ½¸öеÄÁ¬½Ó£¬¼´VMware Network Adapter VMnet1ºÍVMware Network Adapter VMnet8Èçͼ¡£ÐéÄâ»úÀï°²×°µÄϵͳ¾ÍÊÇ¿¿ÕâÁ½¸öÐéÄâÍø¿¨À´ÁªÍøµÄ¡££¨ÈçÏÂͼ£©
Ö÷»úÉÏÀ ......

LinuxÏÂʱ¼ä¶ÈÁ¿µÄÉîÈë·ÖÎö

Ò»)ANSI clockº¯Êý
1)¸ÅÊö:
clock º¯ÊýµÄ·µ»ØÖµÀàÐÍÊÇclock_t,Ëü³ýÒÔCLOCKS_PER_SECÀ´µÃ³öʱ¼ä,Ò»°ãÓÃÁ½´Îclockº¯ÊýÀ´¼ÆËã½ø³Ì×ÔÉíÔËÐеÄʱ¼ä.
ANSI clockÓÐÈý¸öÎÊÌâ:
1)Èç¹û³¬¹ýÒ»¸öСʱ,½«Òªµ¼ÖÂÒç³ö.
2)º¯ÊýclockûÓп¼ÂÇCPU±»×Ó½ø³ÌʹÓõÄÇé¿ö.
3)Ò²²»ÄÜÇø·ÖÓû§¿Õ¼äºÍÄں˿ռä.
ËùÒÔclockº¯ÊýÔÚlinuxϵͳÉϱäµÃ ......

linux ftpÃüÁîʹÓã¬ÏÂÔØÎļþ

Linux ftpÃüÁîµÄ¹¦ÄÜÊÇÓÃÃüÁîµÄ·½Ê½À´¿ØÖÆÔÚ±¾µØ»úºÍÔ¶³Ì»úÖ®¼ä´«ËÍÎļþ
Linux ftpÃüÁîµÄÒ»°ã¸ñʽÈçÏ£º
$ ftp Ö÷»úÃû/IP
×î³£ÓõÄÃüÁîÓУº
   ls ÁгöÔ¶³Ì»úµÄµ±Ç°Ä¿Â¼
   cd ÔÚÔ¶³Ì»úÉϸı乤×÷Ŀ¼
   lcd ÔÚ±¾µØ»úÉϸı乤×÷Ŀ¼
   ascii ÉèÖÃÎļþ´«Ê䷽ʽΪASCIIģʽ ......

linux Ö÷ºÅÓë´ÓºÅ

¿ÉÒÔ¶ÁÈ¡/proc/devicesÎļþÒÔ»ñµÃLinuxÄں˷ÖÅä¸ø¸ÃÉ豸µÄÖ÷É豸ºÅ¡£
Ö÷É豸ºÅÓÃÀ´Çø·Ö²»Í¬ÖÖÀàµÄÉ豸£¬¶ø´ÎÉ豸ºÅÓÃÀ´Çø·ÖͬһÀàÐ͵Ķà¸öÉ豸
ÔÚLinuxÄں˿´À´£¬Ö÷É豸ºÅ±êʶÉ豸¶ÔÓ¦µÄÇý¶¯³ÌÐò£¬
¸æËßLinuxÄÚºËʹÓÃÄÄÒ»¸öÇý¶¯³ÌÐòΪ¸ÃÉ豸(Ò²¾ÍÊÇ/devϵÄÉ豸Îļþ)·þÎñ£»¶ø´ÎÉ豸ºÅÔòÓÃÀ´±êʶ¾ßÌåÇÒΨһµÄij¸öÉ豸¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ