亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产精品久久久久久久久久免费看| 无码av免费一区二区三区试看| 欧美久久久影院| 91麻豆免费观看| 97久久超碰国产精品电影| 成人激情开心网| 成人福利在线看| 国产乱人伦偷精品视频免下载| 黑人精品欧美一区二区蜜桃 | 国产中文一区二区三区| 久久97超碰国产精品超碰| 久久精品国产一区二区三 | 日本高清不卡视频| 在线精品视频一区二区三四| 欧洲精品视频在线观看| 欧美色爱综合网| 欧美一区二区精品久久911| 国产成人精品亚洲午夜麻豆| 日日夜夜精品视频天天综合网| 一区二区三区在线观看动漫 | 日韩在线一二三区| 亚洲裸体xxx| 日韩美女精品在线| 亚洲人成网站色在线观看| 亚洲欧美偷拍三级| 亚洲成av人影院| 九九**精品视频免费播放| 国产裸体歌舞团一区二区| 成人丝袜视频网| 一本色道亚洲精品aⅴ| 欧美裸体一区二区三区| 久久综合久色欧美综合狠狠| 中文乱码免费一区二区| 亚洲免费大片在线观看| 日韩中文字幕亚洲一区二区va在线| 蜜桃视频免费观看一区| 成人午夜私人影院| 日韩专区一卡二卡| 人妖欧美一区二区| 国产精品99久久久久久宅男| 国产综合成人久久大片91| 激情五月婷婷综合网| 91麻豆成人久久精品二区三区| 国产精品久久久久精k8| 欧美日韩精品一区二区三区四区| 国产成人av电影在线| 一区二区三区电影在线播| 91久久久免费一区二区| 一区二区国产视频| 夜夜嗨av一区二区三区| 激情综合色播五月| 精品国产免费人成电影在线观看四季| 激情综合亚洲精品| 国产精品无遮挡| 7777精品伊人久久久大香线蕉 | voyeur盗摄精品| 北条麻妃国产九九精品视频| 色综合天天视频在线观看| 欧美精品xxxxbbbb| 亚洲免费av在线| 国产v综合v亚洲欧| 久久尤物电影视频在线观看| √…a在线天堂一区| 色噜噜狠狠成人网p站| 天天做天天摸天天爽国产一区| 精品亚洲porn| 免费黄网站欧美| 欧洲一区二区三区在线| 激情综合色播激情啊| 亚洲高清免费一级二级三级| 亚洲精品网站在线观看| 97aⅴ精品视频一二三区| 亚洲精品第1页| 色综合天天性综合| 国产精品99久久久久久久vr| 婷婷开心激情综合| 一区二区三区四区视频精品免费| 91精品国产日韩91久久久久久| 国产精品自产自拍| 中文字幕一区在线| 亚洲综合色成人| 成人国产精品视频| 亚洲国产成人av网| 国产一区二区三区四区在线观看| 成人网页在线观看| 欧美日韩三级一区| 一区二区视频在线| 国产精品一区久久久久| 久久久蜜桃精品| 久久99精品国产.久久久久久 | 成人一区二区在线观看| 亚洲激情五月婷婷| 欧美午夜不卡视频| av午夜一区麻豆| 国产精品免费视频一区| 精品国产凹凸成av人导航| 日韩一区二区在线观看视频 | 亚洲国产三级在线| 日韩欧美亚洲国产另类| 国产精品影视网| 亚洲高清三级视频| 中文子幕无线码一区tr| 18成人在线观看| 国产精品美女一区二区| 欧美大片在线观看一区二区| 精久久久久久久久久久| 日韩欧美一二三区| 日本视频免费一区| 日韩一区二区三区四区五区六区| 午夜免费久久看| 91精品国产色综合久久ai换脸| 午夜欧美2019年伦理| 日韩视频免费观看高清在线视频| 免费成人结看片| 欧美精品一区视频| 国产成人精品三级| 国产精品福利一区| 在线免费不卡视频| 欧美美女黄视频| 久久97超碰色| 欧美国产精品一区二区| 99re免费视频精品全部| 亚洲激情图片小说视频| 欧美二区在线观看| 韩国精品免费视频| 亚洲欧美综合另类在线卡通| 欧洲av一区二区嗯嗯嗯啊| 天堂va蜜桃一区二区三区| 精品伦理精品一区| 丁香天五香天堂综合| 一区二区三区欧美视频| 91.麻豆视频| 国产91精品入口| 亚洲黄色免费电影| 日韩欧美三级在线| www.性欧美| 手机精品视频在线观看| 久久久噜噜噜久久人人看| 91在线播放网址| 日本亚洲电影天堂| 国产精品免费视频观看| 欧美精品在线视频| 亚洲日本丝袜连裤袜办公室| 天天综合网天天综合色| 日韩精品一区二区三区四区视频| 韩国女主播成人在线| 国产精品久久久久久亚洲伦 | 日本高清视频一区二区| 午夜精品久久久久久久久| 久久人人爽人人爽| 91国产免费观看| 国产一区二区三区在线观看免费 | 久久精品国产澳门| 亚洲图片另类小说| 欧美不卡激情三级在线观看| 色系网站成人免费| 欧美综合在线视频| 亚洲精品一区二区三区福利 | 国产午夜精品久久久久久免费视| 色激情天天射综合网| 精品在线你懂的| 一区二区成人在线视频| 国产亚洲精品超碰| 欧美高清视频在线高清观看mv色露露十八| 国产精品自拍一区| 丝袜亚洲另类欧美| 亚洲欧美欧美一区二区三区| 欧美不卡一区二区三区四区| 欧美性色黄大片| 欧美三级日韩三级| 午夜欧美在线一二页| 久久免费偷拍视频| 欧美精品v国产精品v日韩精品 | 国产成人av一区| 午夜精品久久久久久久99樱桃| 中文字幕成人网| 日韩欧美国产综合一区| 91国偷自产一区二区三区成为亚洲经典 | 久久午夜羞羞影院免费观看| 欧美日韩免费在线视频| 99久久免费视频.com| 国产在线视频一区二区| 日韩精品视频网| 亚洲资源在线观看| 综合激情成人伊人| 欧美国产日韩一二三区| 精品久久免费看| 欧美一区二区三区四区高清| 91看片淫黄大片一级在线观看| 国产69精品久久久久777| 久久99久久精品欧美| 日本伊人午夜精品| 天天综合色天天综合色h| 一区二区激情小说| 一区av在线播放| 亚洲精品写真福利| 日韩精品在线网站| 久久99精品国产麻豆婷婷洗澡| 亚洲v日本v欧美v久久精品| 亚洲精品视频自拍|