亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dirlib.c

?? 大名鼎鼎的嵌入式操作系統vxworks的完整的源代碼
?? C
字號:
/* dirLib.c - directory handling library (POSIX) *//* Copyright 1984-1995 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01p,02nov01,cyr  doc: fix SPR 35650 fstatfs01o,19jun96,dgp  doc: added note to stat() (SPR #6560)01n,18jan95,rhp  doc: explain opendir() does not work over netDrv01m,19apr94,jmm  fixed closedir() so it doesn't attempt invalid free ()                 added statfs(), fstatfs(), and utime()01m,18oct94,tmk  made closedir() check close() status before freeing (SPR#2744)01l,05mar93,jdi  doc tweak.01k,23nov92,jdi  documentation cleanup.01j,18jul92,smb  Changed errno.h to errnoLib.h.01i,26may92,rrr  the tree shuffle01h,10dec91,gae  added includes for ANSI.01g,04oct91,rrr  passed through the ansification filter                  -changed functions to ansi style		  -changed includes to have absolute path from h/		  -changed READ, WRITE and UPDATE to O_RDONLY O_WRONLY and ...		  -changed VOID to void		  -changed copyright notice01f,05apr91,jdi	 documentation -- removed header parens and x-ref numbers;		 doc review by kdl.01e,11feb91,jaa	 documentation.01d,01oct90,dnw  changed to return ENOTDIR instead of S_dirLib_NOT_DIRECTORY		 removed references to deleted dirLib.h01c,09aug90,kdl  mangen fixes.01b,07may90,kdl  lint.01a,04may90,kdl  written.	   +llk	   +dnw*//*DESCRIPTIONThis library provides POSIX-defined routines for opening, reading, andclosing directories on a file system.  It also provides routines to obtainmore detailed information on a file or directory.SEARCHING DIRECTORIESBasic directory operations, including opendir(), readdir(), rewinddir(),and closedir(), determine the names of files and subdirectories in adirectory.A directory is opened for reading using opendir(), specifying the name ofthe directory to be opened.  The opendir() call returns a pointer to adirectory descriptor, which identifies a directory stream.  The stream isinitially positioned at the first entry in the directory.Once a directory stream is opened, readdir() is used to obtain individualentries from it.  Each call to readdir() returns one directory entry, insequence from the start of the directory.  The readdir() routine returns apointer to a `dirent' structure, which contains the name of the file (orsubdirectory) in the `d_name' field.The rewinddir() routine resets the directory stream to the start of thedirectory.  After rewinddir() has been called, the next readdir() will causethe current directory state to be read in, just as if a new opendir() hadoccurred.  The first entry in the directory will be returned by the firstreaddir().The directory stream is closed by calling closedir().GETTING FILE INFORMATIONThe directory stream operations described above provide a mechanism todetermine the names of the entries in a directory, but they do not provideany other information about those entries.  More detailed information isprovided by stat() and fstat().The stat() and fstat() routines are essentially the same, except for howthe file is specified.  The stat() routine takes the name of the file asan input parameter, while fstat() takes a file descriptor number asreturned by open() or creat().  Both routines place the information from adirectory entry in a `stat' structure whose address is passed as an inputparameter.  This structure is defined in the include file stat.h.  Thefields in the structure include the file size, modification date/time,whether it is a directory or regular file, and various other values.The `st_mode' field contains the file type; several macro functions areprovided to test the type easily.  These macros operate on the `st_mode'field and evaluate to TRUE or FALSE depending on whether the file is aspecific type.  The macro names are:.RS 4.iP S_ISREG 15test if the file is a regular file.iP S_ISDIRtest if the file is a directory.iP S_ISCHRtest if the file is a character special file.iP S_ISBLKtest if the file is a block special file.iP S_ISFIFOtest if the file is a FIFO special file.RE.LPOnly the regular file and directory types are used for VxWorks localfile systems.  However, the other file types may appear when gettingfile status from a remote file system (using NFS).As an example, the S_ISDIR macro tests whether a particular entry describesa directory.  It is used as follows:.CS    char          *filename;    struct stat   fileStat;    stat (filename, &fileStat);    if (S_ISDIR (fileStat.st_mode))	printf ("%s is a directory.\en", filename);    else	printf ("%s is not a directory.\en", filename);.CESee the ls() routine in usrLib for an illustration of how to combinethe directory stream operations with the stat() routine.INCLUDE FILES: dirent.h, stat.h*//* LINTLIBRARY */#include "vxWorks.h"#include "dirent.h"#include "ioLib.h"#include "memLib.h"#include "sys/stat.h"#include "errnoLib.h"#include "fcntl.h"#include "stdlib.h"#include "unistd.h"#include "utime.h"/********************************************************************************* opendir - open a directory for searching (POSIX)** This routine opens the directory named by <dirName> and allocates a* directory descriptor (DIR) for it.  A pointer to the DIR structure is* returned.  The return of a NULL pointer indicates an error.** After the directory is opened, readdir() is used to extract individual* directory entries.  Finally, closedir() is used to close the directory.** WARNING: For remote file systems mounted over netDrv, opendir() fails,* because the netDrv implementation strategy does not provide a way to * distinguish directories from plain files.  To permit use of opendir() * on remote files, use NFS rather than netDrv.** RETURNS: A pointer to a directory descriptor, or NULL if there is an error.** SEE ALSO:* closedir(), readdir(), rewinddir(), ls()*/DIR *opendir    (    char        *dirName                /* name of directory to open */    )    {    FAST int	fd;			/* file descriptor for open directory */    FAST DIR	*pDir;			/* ptr to allocated dir descriptor */    struct stat	fileStat;		/* structure for file stat */    if ((fd = open (dirName, O_RDONLY, 0)) == ERROR)	return (NULL);				/* can't open */    /* Check that it really is a directory */    if (fstat (fd, &fileStat) != OK)	{	(void) close (fd);	return (NULL);				/* can't stat */	}    if (S_ISDIR (fileStat.st_mode) != TRUE)	{	errnoSet (ENOTDIR);	(void) close (fd);	return (NULL);				/* not a dir */	}    /* Allocate directory descriptor */    if ((pDir = (DIR *) calloc (sizeof (DIR), 1)) == NULL)	{	(void) close (fd);	return (NULL);				/* no memory */	}    pDir->dd_fd     = fd;			/* put file descriptor in DIR */    pDir->dd_cookie = 0;			/* start at beginning of dir */    return (pDir);    }/********************************************************************************* readdir - read one entry from a directory (POSIX)** This routine obtains directory entry data for the next file from an* open directory.  The <pDir> parameter is the pointer to a directory* descriptor (DIR) which was returned by a previous opendir().** This routine returns a pointer to a `dirent' structure which contains* the name of the next file.  Empty directory entries and MS-DOS volume* label entries are not reported.  The name of the file (or subdirectory)* described by the directory entry is returned in the `d_name' field* of the `dirent' structure.  The name is a single null-terminated string.** The returned `dirent' pointer will be NULL, if it is at the end of the* directory or if an error occurred.  Because there are two conditions which* might cause NULL to be returned, the task's error number (`errno') must be* used to determine if there was an actual error.  Before calling readdir(),* set `errno' to OK.  If a NULL pointer is returned, check the new* value of `errno'.  If `errno' is still OK, the end of the directory was* reached; if not, `errno' contains the error code for an actual error which* occurred.** RETURNS: A pointer to a `dirent' structure,* or NULL if there is an end-of-directory marker or error.** SEE ALSO:* opendir(), closedir(), rewinddir(), ls()*/struct dirent *readdir    (    DIR         *pDir                   /* pointer to directory descriptor */    )    {    if (ioctl (pDir->dd_fd, FIOREADDIR, (int)pDir) != OK)	return (NULL);				/* can't ioctl */    return (&pDir->dd_dirent);			/* return ptr to dirent */    }/********************************************************************************* rewinddir - reset position to the start of a directory (POSIX)** This routine resets the position pointer in a directory descriptor (DIR).* The <pDir> parameter is the directory descriptor pointer that was returned* by opendir().** As a result, the next readdir() will cause the current directory data to be* read in again, as if an opendir() had just been performed.  Any changes* in the directory that have occurred since the initial opendir() will now* be visible.  The first entry in the directory will be returned by the* next readdir().** RETURNS: N/A** SEE ALSO:* opendir(), readdir(), closedir()*/void rewinddir    (    DIR         *pDir                   /* pointer to directory descriptor */    )    {    pDir->dd_cookie = 0;			/* reset filesys-specific ptr */    }/********************************************************************************* closedir - close a directory (POSIX)** This routine closes a directory which was previously opened using* opendir().  The <pDir> parameter is the directory descriptor pointer* that was returned by opendir().** RETURNS: OK or ERROR.** SEE ALSO:* opendir(), readdir(), rewinddir()*/STATUS closedir    (    DIR         *pDir                   /* pointer to directory descriptor */    )    {    FAST STATUS	status;			/* return status */    if ((status = close (pDir->dd_fd)) != ERROR)        free ((char *) pDir);    return (status);    }/********************************************************************************* fstat - get file status information (POSIX)** This routine obtains various characteristics of a file (or directory).* The file must already have been opened using open() or creat().* The <fd> parameter is the file descriptor returned by open() or creat().** The <pStat> parameter is a pointer to a `stat' structure (defined* in stat.h).  This structure must be allocated before fstat() is called.** Upon return, the fields in the `stat' structure are updated to* reflect the characteristics of the file.** RETURNS: OK or ERROR.** SEE ALSO:* stat(), ls()*/STATUS fstat    (    int         fd,                     /* file descriptor for file to check */    struct stat *pStat                  /* pointer to stat structure */    )    {    return (ioctl (fd, FIOFSTATGET, (int)pStat));    }/********************************************************************************* stat - get file status information using a pathname (POSIX)** This routine obtains various characteristics of a file (or directory).* This routine is equivalent to fstat(), except that the <name> of the file* is specified, rather than an open file descriptor.** The <pStat> parameter is a pointer to a `stat' structure (defined* in stat.h).  This structure must have already been allocated before* this routine is called.** NOTE: When used with netDrv devices (FTP or RSH), stat() returns the size* of the file and always sets the mode to regular; stat() does not distinguish* between files, directories, links, etc.** Upon return, the fields in the `stat' structure are updated to* reflect the characteristics of the file.** RETURNS: OK or ERROR.** SEE ALSO:* fstat(), ls()*/STATUS stat    (    char        *name,                  /* name of file to check */    struct stat *pStat                  /* pointer to stat structure */    )    {    FAST int	fd;			/* file descriptor */    FAST STATUS	status;			/* return status */    if ((fd = open (name, O_RDONLY, 0)) == ERROR)	return (ERROR);				/* can't open file */    status = fstat (fd, pStat);    status |= close (fd);    return (status);    }/********************************************************************************* fstatfs - get file status information (POSIX)** This routine obtains various characteristics of a file system.* A file in the file system must already have been opened using open() or creat().* The <fd> parameter is the file descriptor returned by open() or creat().** The <pStat> parameter is a pointer to a `statfs' structure (defined* in stat.h).  This structure must be allocated before fstat() is called.** Upon return, the fields in the `statfs' structure are updated to* reflect the characteristics of the file.** RETURNS: OK or ERROR.** SEE ALSO:* statfs(), ls()*/STATUS fstatfs    (    int           fd,                     /* file descriptor for file to check */    struct statfs *pStat                  /* pointer to statfs structure */    )    {    return (ioctl (fd, FIOFSTATFSGET, (int)pStat));    }/********************************************************************************* statfs - get file status information using a pathname (POSIX)** This routine obtains various characteristics of a file system.* This routine is equivalent to fstatfs(), except that the <name> of the file* is specified, rather than an open file descriptor.** The <pStat> parameter is a pointer to a `statfs' structure (defined* in stat.h).  This structure must have already been allocated before* this routine is called.** Upon return, the fields in the `statfs' structure are updated to* reflect the characteristics of the file.** RETURNS: OK or ERROR.** SEE ALSO:* fstatfs(), ls()*/STATUS statfs    (    char          *name,                  /* name of file to check */    struct statfs *pStat                  /* pointer to statfs structure */    )    {    FAST int	fd;			/* file descriptor */    FAST STATUS	status;			/* return status */    if ((fd = open (name, O_RDONLY, 0)) == ERROR)	return (ERROR);				/* can't open file */    status = fstatfs (fd, pStat);    status |= close (fd);    return (status);    }/********************************************************************************* utime - update time on a file** RETURNS: OK or ERROR.** SEE ALSO:* stat(), fstat(), ls()*/int utime    (    char *           file,    struct utimbuf * newTimes    )    {    int fd;    int retVal;    if ((fd = open (file, O_RDONLY, 0666)) == ERROR)        return (ERROR);    else	{        retVal = ioctl (fd, FIOTIMESET, (int) newTimes);	close (fd);	return (retVal);	}    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人三级电影在线| 亚洲欧洲性图库| 中文字幕一区二区三区不卡| 依依成人精品视频| 国产在线一区二区综合免费视频| 91蝌蚪porny成人天涯| 日韩精品资源二区在线| 亚洲免费视频中文字幕| 激情小说亚洲一区| 91麻豆精品国产91久久久久久久久| 久久午夜国产精品| 日本亚洲欧美天堂免费| 一本大道av一区二区在线播放| 精品国产乱码久久久久久牛牛| 亚洲欧美日韩一区二区| 国产91丝袜在线播放九色| 欧美一区二区在线免费播放| 亚洲三级在线免费观看| 国产98色在线|日韩| 精品国产123| 日韩av一二三| 欧美日韩成人一区| 亚洲自拍偷拍麻豆| 色婷婷综合激情| 国产精品伦一区二区三级视频| 久久精品国产免费| 91精品国产综合久久久久久久久久| 亚洲黄一区二区三区| 成人免费观看av| 日本一区二区三区dvd视频在线| 麻豆免费看一区二区三区| 欧美精品久久一区| 亚洲成va人在线观看| 在线观看免费亚洲| 亚洲在线中文字幕| 日本韩国视频一区二区| 亚洲欧美色图小说| 欧美性猛片xxxx免费看久爱| 亚洲三级在线看| 91国产精品成人| 亚洲精品久久久久久国产精华液| 99精品国产热久久91蜜凸| 国产精品你懂的在线| 91视频一区二区三区| 亚洲精品中文字幕在线观看| 欧美性生活大片视频| 五月综合激情日本mⅴ| 7777精品伊人久久久大香线蕉完整版 | 中文字幕 久热精品 视频在线| 蜜桃av一区二区在线观看| 日韩免费视频一区二区| 国产成人精品一区二区三区四区 | 人人精品人人爱| 91精品国产入口在线| 麻豆国产精品视频| 国产亚洲成av人在线观看导航| 国产精品91xxx| 最新日韩在线视频| 欧美日韩成人在线一区| 久久超碰97中文字幕| 国产精品网站导航| 欧美日韩中文一区| 久久99国产精品尤物| 欧美国产欧美亚州国产日韩mv天天看完整| 99re这里只有精品6| 视频一区视频二区中文| 久久久精品中文字幕麻豆发布| 成人毛片老司机大片| 婷婷国产在线综合| 久久久91精品国产一区二区精品| a亚洲天堂av| 国产欧美视频一区二区| 在线观看不卡一区| 国产曰批免费观看久久久| 亚洲视频中文字幕| 欧美v亚洲v综合ⅴ国产v| jizz一区二区| 久久精品国产在热久久| 亚洲精品视频在线观看免费 | 人人超碰91尤物精品国产| 国产亚洲欧美激情| 欧美日韩国产三级| 国产成a人亚洲精| 日韩二区三区在线观看| 国产精品全国免费观看高清 | 欧美视频精品在线| 国产suv精品一区二区6| 日韩精品一二三区| 亚洲免费色视频| 亚洲图片欧美一区| 久久久久99精品一区| 欧美肥妇bbw| 色婷婷精品久久二区二区蜜臀av | 在线区一区二视频| 成人丝袜视频网| 精品一区二区成人精品| 视频在线在亚洲| 亚洲黄色尤物视频| 国产精品的网站| 久久久久久亚洲综合影院红桃| 欧美一区二区三区免费大片| 91视频.com| 波多野结衣在线一区| 国产在线视频不卡二| 男人操女人的视频在线观看欧美| 依依成人综合视频| 一区二区三区四区精品在线视频| 日本一区二区综合亚洲| 久久久久国产精品麻豆| 欧美成人精品福利| 欧美刺激午夜性久久久久久久| 欧美日韩国产系列| 4438亚洲最大| 欧美老肥妇做.爰bbww| 欧美主播一区二区三区| 在线中文字幕不卡| 在线影视一区二区三区| 一本一道波多野结衣一区二区 | 综合网在线视频| 18成人在线观看| 亚洲天堂2014| 亚洲激情网站免费观看| 亚洲一线二线三线视频| 亚洲午夜一区二区三区| 亚洲国产日韩a在线播放性色| 一卡二卡欧美日韩| 亚洲成人在线免费| 日本va欧美va精品发布| 美女性感视频久久| 国产一区二区影院| 粉嫩高潮美女一区二区三区| 成人动漫一区二区| 欧美午夜精品一区二区三区| 欧美日韩亚洲高清一区二区| 欧美日本一区二区三区四区 | 狠狠色狠狠色综合系列| 国产高清视频一区| 99久久久精品| 欧美艳星brazzers| 欧美变态tickling挠脚心| 久久精品视频免费观看| 国产精品三级av| 亚洲午夜羞羞片| 狠狠色丁香婷婷综合久久片| 国产成人综合在线| 在线区一区二视频| 日韩精品在线看片z| 国产欧美一区二区精品性色| 亚洲日本在线a| 日本美女一区二区| 懂色av中文字幕一区二区三区| 色综合中文字幕| 日韩一区二区免费高清| 欧美极品美女视频| 一区二区三区日韩欧美精品| 麻豆精品视频在线观看| www.在线成人| 日韩一级视频免费观看在线| 中文一区在线播放| 日韩国产精品91| av影院午夜一区| 日韩欧美国产精品一区| 精品综合免费视频观看| 日韩一级黄色片| 久久久精品欧美丰满| 夜夜精品视频一区二区| fc2成人免费人成在线观看播放| 色屁屁一区二区| 精品国产a毛片| 尤物在线观看一区| 国产一区二区在线视频| 欧美日韩精品欧美日韩精品| 国产精品视频一区二区三区不卡| 亚洲mv大片欧洲mv大片精品| 成人精品视频一区二区三区| 欧美一区二区网站| 亚洲欧美aⅴ...| 粉嫩aⅴ一区二区三区四区 | 久久不见久久见免费视频7| 91麻豆自制传媒国产之光| 久久久久国产免费免费| 日本不卡不码高清免费观看| 波多野结衣91| 国产视频一区不卡| 久久国内精品自在自线400部| 91福利视频网站| 中文字幕视频一区| 国产大片一区二区| 久久嫩草精品久久久久| 日av在线不卡| 欧美一级一级性生活免费录像| 一区二区三区免费网站| 91在线观看美女| 亚洲欧洲三级电影| 99re热这里只有精品免费视频| 中文字幕不卡在线| 成人av免费在线| 中文字幕日韩欧美一区二区三区| 福利电影一区二区| 中文字幕精品综合|