»ñÈ¡linuxµÄÎļþϵͳÏà¹ØÐÅÏ¢µÄ֪ʶµã
ÔÚ struct mntent ÖеijÉÔ±Óë /etc/fstab ÎļþÖеÄÌõÄ¿ÊÇÖ±½Ó¶ÔÓ¦µÄ¡£ËüµÄÄÚÈÝÈçÏ£º
struct mntent {
char *mnt_fsname; /* ¹ÒÔصÄÎļþϵͳµÄÃû×Ö */
char *mnt_dir; /* ¹ÒÔصã */
char *mnt_type; /* ÎļþϵͳÀàÐÍ£ºufs¡¢nfs µÈ */
char *mnt_opts; /* Ñ¡ÏÒÔ¶ººÅΪ·Ö¸ô·û */
int mnt_freq; /* Dump µÄƵÂÊ(ÒÔÌìΪµ¥Î») */
int mnt_passno; /* fsck¼ì²éµÄ´ÎÐò */
};
FILE *setmntent(const char *filename, const char *type);
struct mntent *getmntent(FILE *filep);
int addmntent(FILE *filep, const struct mntent *mnt);
int endmntent(FILE *filep);
char *hasmntopt(const struct mntent *mnt, const char *opt);
setmntent() ÊÇ´ò¿ª°üº¬¹ÒÔصãÏîÄ¿µÄÎļþ, ÆäÖÐµÄ filename ²ÎÊýÊÇÒª´ò¿ªµÄÎļþÃû, type ²ÎÊý¾ÍÏñ fopen() µÄµÚ¶þ¸ö²ÎÊý, ´ú±íÖ»¶Á¡¢Ö»Ð´, »ò¶Áд½Ô¿ÉµÄ´æȡģʽ ¡£·µ»ØFILE*¡£
getmntent() ÔòÊÇÑÐò¶ÁÈ¡Õû¸öµµ°¸£¬´«»ØÖ¸Ïò static struct mntent ½á¹¹µÄÖ¸Õ룬½á¹¹ÖлáÌîÈëÊʵ±µÄÖµ¡£
addmntent() ¿ÉÒÔÔÚÒÑ¿ªÆôµµ°¸µÄÄ©¶Ë¼ÓÉÏ×ÊѶ£¬ËüÔ±¾ÊǸø mount ʹÓõġ£
endmntent() µÄ¹¦ÓÃÊǹرմò¿ªµÄÎļþ¡£Õâ²»ÄÜÖ»ÊǺô½Ð fclose() ¶øÒÑ,ÒòΪ¿ÉÄÜ»¹ÓÐÆäËüÓëFILE * ÓйصÄÄÚ²¿×ÊÁϽṹÐèÒªÇåÀí¡£
hasmntopt() ÊǸö±È½ÏÌØÊâµÄº¯Ê½¡£Ëü»áɨÃèµÚÒ»¸ö²ÎÊýËù´«ÈëµÄstruct mntent£¬ÕÒ³öËüµÄ¹ÒÔØÑ¡ÏîÊÇ·ñ·ûºÏµÚ¶þ¸öÒýÊý¡£¼ÙÈçÕÒµ½Ñ¡Ïî¾Í´«»Ø·ûºÏµÄ×Ó×Ö·û´®µÄλַ£»·ñÔò´«»ØNULL¡£
/etc/fstab¡¢/etc/mtab ºÍ /proc/mounts ÆäÖÐÈκÎÒ»¸ö, ¶¼¿ÉÒÔÔÚ³ÌÐòÖÐʹÓà getmntent() Õâ×麯ÊýÀ´¶ÁÈ¡
eg£º
#include <mntent.h>
struct mntent* mnt;
FILE* fp;
fp = setmntent("/dev/mmc/mmcblk0", "r");
if ( !fp )
{
return FALSE;
}
if(mnt=getmntent(fp) )
{
#if 1
printf("woosoori[%s:%d] mnt->mnt_fsname=%s\n",__FUNCTION__,__LINE__, mnt->mnt_fsname);
printf("woosoori[%s:%d] mnt
Ïà¹ØÎĵµ£º
´´½¨×ÀÃæͼ±ê
Ä¿Ç°½«ÍøÂçÓ¦ÓÃÀ©Õ¹µ½×ÀÃæÊÇÒ»¸öÇ÷ÊÆ£¬´æÔÚןܶà½â¾ö·½°¸£¬±¾ÎÄÒÔ Mozilla Prism ΪÀý£¬ÀàËƵķ½·¨Í¬ÑùÊÊÓÃÓÚ Google Chrome ¡£
1. µ½ Mozilla Prism µÄÍøÕ¾ÉÏÏÂÔØ Prism£¬µã»÷ Download Now Ö®ºó»áÌáʾÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇÒÔ Mozilla Firefox À©Õ¹µÄ·½Ê½£¬ÊʺÏÒѾ°²×°ÓÐ Firefox µÄÅóÓÑ£»Ò»Ö ......
/*
socket selectÄ£ÐÍ£¬·þÎñ¶Ë
¾ø´ó¶àÊý×¢ÊÍ×Ô¼ºÐ´µÄ£¬²Î¿¼man
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/un.h>
#include &l ......
×ölinux cÓïÑÔ¿ª·¢ÓÐһСÕó×ÓÁË£¬ÔÚÕâ±ß×Ô¼º×ܽáÁËЩÐĵã¬ÏàÐÅÄÜÈò»¶®µÃLinux±à³ÌµÄÈËÂýÂý²½ÈëLinuxµîÌá£ÓÐÈκβ»¶Ô»ò²»×¼È·Ö®´¦»¶ÓÌÖÂÛ¡£
1. °²×° linux ²Ù×÷ϵͳ
¼ÈȻҪѧϰlinuxϵÄcÓïÑÔ¿ª·¢£¬ÄÇô°²×°¸ölinux²Ù×÷ϵͳÊDZØÐëµÄ¡£½¨Òé°²×°Ubuntu£¬ÕâÊÇÎÒÄ¿Ç°¼û¹ý½çÃæ×îÓѺõÄlinux²Ù×÷ϵͳÁË¡£¹ØÓÚÈçºÎʹÓÃUbuntuÒ ......
Èç¹ûÄã¼Èû×öϵͳÆô¶¯ÈíÅÌ£¬Í¬Ê±¶àϵͳµÄÒýµ¼LILO ºÍGRUB ÓÖ±»É¾³ý£¬ÄÇôֻÄÜʹÓÃLinux ϵͳ°²×°ÅÌÀ´»Ö¸´rootµÄÃÜÂ룬²½ÖèÈçÏ¡£ Ò». liloÒýµ¼ÔÚ³öÏÖ lilo: Ìáʾʱ¼üÈë linux single Boot: linux single »Ø³µ¿ÉÖ±½Ó½øÈëlinuxµ¥Óû§Ä£Ê½ vi /etc/passwd ɾ³ýrootÏîÖеÄÃÜÂë (ÕâÀïÒ²¿ÉÒÔÖ±½ÓʹÓÃpasswdÃüÁîÖØÐÂÉèÖÃrootµÄÃÜÂë ......
´ÓLinux 2.6ÆðÒýÈëÁËÒ»Ì×еÄÇý¶¯¹ÜÀíºÍ×¢²á»úÖÆ:Platform_deviceºÍPlatform_driver¡£
LinuxÖд󲿷ֵÄÉ豸Çý¶¯£¬¶¼¿ÉÒÔʹÓÃÕâÌ×»úÖÆ, É豸ÓÃPlatform_device±íʾ£¬Çý¶¯ÓÃPlatform_driver½øÐÐ×¢²á¡£
Linux platform driver»úÖƺʹ«Í³µÄdevice driver »úÖÆ(ͨ¹ýdriver_registerº¯Êý½øÐÐ×¢²á)Ïà±È£¬Ò»¸öÊ®·ÖÃ÷ÏÔµÄÓ ......