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

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

?? dirlib.c

?? vxworks 5.5 kernel code
?? 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一区二区三区免费野_久草精品视频
欧美一级高清大全免费观看| 国产精品久久久久久久久免费丝袜| 日韩美女主播在线视频一区二区三区| 欧美国产禁国产网站cc| 午夜在线成人av| 一本久久a久久免费精品不卡| 精品人在线二区三区| 亚洲电影一区二区| 91视频免费观看| 亚洲国产精品v| 国产精品羞羞答答xxdd| 欧美一卡2卡3卡4卡| 亚洲一区二区在线观看视频 | 久久久久久久久岛国免费| 一区二区三区国产精品| 国产99久久精品| 精品国产乱码久久久久久浪潮| 亚洲成人在线网站| 99re66热这里只有精品3直播| 国产偷国产偷精品高清尤物| 美女性感视频久久| 91精品国产欧美日韩| 亚洲一二三区在线观看| 在线观看日韩精品| 亚洲国产日韩av| 色综合天天视频在线观看| 亚洲视频你懂的| 91一区在线观看| 亚洲精品成人精品456| 97精品久久久午夜一区二区三区 | 一区二区三区精品在线观看| 99久久精品国产麻豆演员表| 国产精品久久夜| 不卡的电影网站| 最新热久久免费视频| 成年人国产精品| 亚洲精品乱码久久久久久久久| 欧美在线一二三| 中文字幕在线观看一区二区| 91浏览器在线视频| 亚洲最大色网站| 欧美色成人综合| 日本欧美一区二区三区| 2023国产精品视频| 成人精品视频一区| 一区二区三区精品在线| 欧美色综合网站| 老司机精品视频导航| 久久久久国色av免费看影院| 成人综合日日夜夜| 一区二区三区精密机械公司| 日韩一区二区在线看片| 国产在线一区二区综合免费视频| 国产欧美精品一区| 在线观看成人小视频| 美国精品在线观看| 国产欧美日韩亚州综合 | 欧美日韩一本到| 久久av资源网| 亚洲视频 欧洲视频| 欧美日韩国产a| 紧缚奴在线一区二区三区| 国产精品精品国产色婷婷| 欧美无乱码久久久免费午夜一区 | 国产成人午夜视频| 一区二区三区在线观看欧美| 在线综合视频播放| 国产精品12区| 亚洲国产美女搞黄色| 久久综合色天天久久综合图片| 91影视在线播放| 九色综合国产一区二区三区| 亚洲色图欧洲色图| xvideos.蜜桃一区二区| 欧美主播一区二区三区| 国产麻豆成人传媒免费观看| 一区二区三区国产精品| 国产三级精品视频| 91精品国产综合久久福利软件 | 欧美日韩成人激情| 成人性视频免费网站| 日本最新不卡在线| 成人欧美一区二区三区在线播放| 欧美一区二区三区在线观看| 97久久超碰国产精品电影| 国产一区二区三区久久久 | 欧美高清视频不卡网| 福利一区二区在线| 三级欧美在线一区| 亚洲蜜桃精久久久久久久| 国产亚洲女人久久久久毛片| 日韩小视频在线观看专区| 91国产免费看| www.日本不卡| 国产999精品久久久久久绿帽| 日本亚洲三级在线| 亚洲图片有声小说| 亚洲欧美一区二区三区孕妇| 久久久久久久综合| 日韩三级.com| 91精品国产综合久久精品麻豆 | 久久九九久精品国产免费直播| 在线播放中文一区| 欧美性大战久久| 91久久国产最好的精华液| 99久久99久久免费精品蜜臀| 国产乱码精品一区二区三区五月婷| 奇米影视一区二区三区| 日韩不卡一二三区| 视频一区中文字幕国产| 亚洲国产wwwccc36天堂| 亚洲国产wwwccc36天堂| 亚洲图片欧美色图| 午夜精品免费在线观看| 亚洲午夜影视影院在线观看| 一区二区三区四区不卡视频 | 色噜噜狠狠成人网p站| jizzjizzjizz欧美| 99久久免费国产| jizzjizzjizz欧美| 一本色道**综合亚洲精品蜜桃冫| 91美女视频网站| 欧美在线播放高清精品| 欧美裸体一区二区三区| 日韩一区二区精品在线观看| 欧美一区二区美女| 精品国产乱码91久久久久久网站| 精品国产伦理网| 国产亚洲精久久久久久| 国产精品福利电影一区二区三区四区| 国产精品久久久一本精品| 亚洲男女一区二区三区| 亚洲精选视频在线| 日日摸夜夜添夜夜添精品视频 | 亚洲国产日韩一级| 日本亚洲最大的色成网站www| 精品系列免费在线观看| 成人av电影免费观看| 欧美亚洲高清一区| 精品国免费一区二区三区| 欧美经典一区二区| 一区二区三区视频在线观看| 水野朝阳av一区二区三区| 国产精品一级在线| 91激情在线视频| 日韩午夜三级在线| 国产精品视频一区二区三区不卡| 亚洲精品伦理在线| 麻豆精品国产91久久久久久| 成人动漫一区二区在线| 91精品一区二区三区久久久久久| 久久夜色精品国产噜噜av| 亚洲美女免费在线| 毛片一区二区三区| 成人免费黄色大片| 欧美日韩午夜影院| 国产三级一区二区三区| 亚洲成精国产精品女| 国产一级精品在线| 91黄视频在线观看| 国产丝袜美腿一区二区三区| 亚洲国产成人91porn| 成人免费av网站| 日韩精品一区二区三区中文不卡| 亚洲人成人一区二区在线观看| 久热成人在线视频| 欧美日韩久久不卡| 亚洲品质自拍视频| 国内精品嫩模私拍在线| 欧美性感一类影片在线播放| 国产精品热久久久久夜色精品三区 | 国内精品久久久久影院色| 色综合色狠狠天天综合色| 久久综合九色综合97_久久久| 亚洲国产视频一区| 99这里都是精品| 国产欧美综合在线| 老司机精品视频一区二区三区| 欧美亚洲国产一区二区三区va| 中文字幕不卡三区| 国产电影一区在线| 精品国产1区二区| 青青草成人在线观看| 欧美日韩亚洲高清一区二区| 亚洲欧美国产高清| 成人av免费观看| 国产日韩精品一区二区三区在线| 美女网站在线免费欧美精品| 9191国产精品| 亚洲成人在线观看视频| 在线一区二区视频| 一区二区三区**美女毛片| www.亚洲色图| 国产精品国产三级国产普通话蜜臀| 国产盗摄精品一区二区三区在线| 久久亚洲欧美国产精品乐播| 国产一区二区三区在线观看免费视频| 日韩欧美成人一区二区| 蜜桃视频在线一区| 日韩欧美色综合网站|