📄 lseek.c
字号:
/* $id:dmLseek.c V1.0 2002/01/15 */
/******************************************************************************
* 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: Lseek.c
*
* MODULE: RLT
*
* PURPOSE: lseek() - POSIX 1003.1b 6.4.2 - Reposition read/write file offset
*
* AUTHOR(S):Zhang Yumin
*
* GROUP:TOOL_GROUP
*
* DATE CREATED:2002/01/15
*
* REFERENCE DOCUMENT ID:
*
* MODIFICATIONS:
* Date user Name Description
* 2002/01/15 Zhang Yumin Create this file
*
*********************************************************************************/
#include <sys/types.h>
#include <sys/reent.h>
off_t sys_lseek(int fd, off_t offset, int whence)
{
}
/********************************************************************
* FUNCTION: lseek
*
* PURPOSE: Reposition read/write file offset.
* PARAMETERS:
*
* Input fd -file descriptor of target file.
* offset&whence
* -If whence is SEEK_SET,the offset is set to offset bytes.
* -If whence is SEEK_CUR,the offset is set to its current
* location plusoffset bytes.
* -If whence isSEEK_END,the offset is set to the size of the
* file plusoffset bytes.
* Output: None
* InOut: None
*
* Return value: Upon successful completion,lseek() returns the resulting
* offset location as measured in bytes from the beginning
* of the file. Otherwise, a value of -1 is returned and
* errno is set to indicate the error.
* Reentrant: No
********************************************************************/
off_t _lseek_r(struct _reent *ptr,int fd, off_t offset,int whence)
{
int rc = sys_lseek(fd,offset,whence);
if(rc < 0)
{
ptr->_errno = -rc;
return -1;
}
return rc;
}
#ifndef _REENT_ONLY
off_t lseek(int fd, off_t offset,int whence)
{
return _lseek_r(_REENT,fd,offset,whence);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -