»ñÈ¡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
Ïà¹ØÎĵµ£º
°²×°Ç°×¼±¸ºÃÁ½¸ö·ÖÇøA ºÍB£¬·ÖÇø A ÓÃÀ´´æ·ÅÏÂÔØÀ´µÄ Fedora 10 µÄISO¾µÏñÎļþ£¬·ÖÇø B ÓÃÀ´°²×° Fedora 10 .¡£
×¢Ò⣺´æ·Å¾µÏñÎļþµÄ·ÖÇø±ØÐëΪ Fat32 ¸ñʽ£¬·ñÔòÎÞ·¨½øÐа²×°¡££¨±¾ÈËÒѲâÊÔ¹ý£©
½âѹ Fedora-10-i386-netinst.iso ´ËISO Îļþ£¬½«½âѹ³öÀ´µÄ isolinux ºÍ images Á½¸öÎļþ¼ÐÓë Fedora 10 µÄ ISO ¾µÏñÎÄ ......
/*
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 ......
ѧϰUbuntu LinuxºÜ¾ÃÁË£¬ÓÉÓںܶàÈ˶ÔÓÚUbuntu Linux·ÖÇøÓÐËùÌáÎÊ£¬ËùÒÔÏ£ÍûÒÔÏÂÎÄÕ¶Դó¼ÒÓÐËù°ïÖú¡£Ubuntu Linux ·ÖÇø¸ÅÄ Ê×ÏȽéÉÜÒ»ÏÂlinuxÖеķÖÇø¸ÅÄÕâ¸ö¿ÉÊǰÑÒ»¿ªÊ¼Ñ§Ï°µÄÎÒº¦¿àÁË¡£ÔÚ Linux Öй涨£¬Ã¿Ò»¸öÓ²ÅÌÉ豸×î¶àÄÜÓÐ 4 ¸öÖ÷·ÖÇø£¨ÆäÖаüº¬À©Õ¹·ÖÇø£©¹¹³É£¬ÈκÎÒ»¸öÀ©Õ¹·ÖÇø¶¼ÒªÕ¼ÓÃÒ»¸öÖ÷·ÖÇøºÅÂë£ ......