fstat.c

来自「嵌入式实验uC-OS-II相关程序用例与参考资料」· C语言 代码 · 共 93 行

C
93
字号
/******************************************************************************
 *  This source code has been made available to you by CORETEK  on
 *  AS-IS.Anyone receiving this source is licensed under
 *  CORETEK copyrights to use it in any way he or she deems fit,including
 *  copying it,modifying it,compiling it,and redistributing it either with
 *  or without modifictions.
 *
 *
 *  Any person who transfers this source code or any derivative work must
 *  include the CORETEK copyright notice, this paragraph,and the preceding
 *  two paragraphs in the transferred software.
 *
 *
 *       COPYRIGHT CORETEK CORPORATION 2001
 *     LICENSED MATERIAL - PROGRAM PROPERTY OF CORETEK
 *****************************************************************************/

/******************************************************************************
 *
 *  FILE: Fstat.c
 *
 *  MODULE: RLT
 *
 *  PURPOSE: fstat() - POSIX 1003.1b 5.6.2 - Get File Status
 *
 *  AUTHOR(S):Zhang Yumin
 *
 *  GROUP:TOOL_GROUP
 *
 *  DATE CREATED:2002/04/02
 *
 *  REFERENCE DOCUMENT ID:
 *
 *  MODIFICATIONS:
 *  Date          user Name       Description
 *  2002/04/02    Zhang Yumin    Create this file
 *
 *********************************************************************************/

#include <sys/stat.h>
#include <sys/reent.h>


int sys_fstat(int fd, struct stat *sbuf)
{
	
}
/********************************************************************
 *  FUNCTION: fstat
 *
 *  PURPOSE:  POSIX 1003.1b 5.6.2 - Get File Status
 *  PARAMETERS:
 *
 *    Input:  fd	-file descriptor of target file.
 *			  sbuf	-buffer store the status.
 *    Output: None
 *    InOut:  None
 *
 *  Return value: If successful, returns 0. On failure, it returns -1
 *		and sets errno values.
 *  Reentrant: Yes
 ********************************************************************/
int _fstat_r(
	struct _reent  *ptr,
  	int          fd,
  	struct stat    *sbuf
)
{
	int rc = sys_fstat(fd,sbuf);
  	if(rc < 0)
  	{
  		ptr->_errno = -rc;
  		return -1;
  	}
  	return rc;
}



#ifndef _REENT_ONLY

int fstat(
  	int          fd,
  	struct stat    *sbuf
)
{
  	return _fstat_r(_REENT,fd,sbuf);
}

#endif


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?