mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 08:54:40 +00:00
ad8ae0a2f5
svn path=/trunk/; revision=2634
50 lines
901 B
C
50 lines
901 B
C
/* $Id:
|
|
*/
|
|
/*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: ReactOS POSIX+ Subsystem
|
|
* FILE: subsys/psx/lib/psxdll/unistd/read.c
|
|
* PURPOSE: Read from a file
|
|
* PROGRAMMER: KJK::Hyperion <noog@libero.it>
|
|
* UPDATE HISTORY:
|
|
* 15/02/2002: Created
|
|
*/
|
|
|
|
#include <ddk/ntddk.h>
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
|
|
ssize_t read(int fildes, void *buf, size_t nbyte)
|
|
{
|
|
}
|
|
|
|
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset)
|
|
{
|
|
HANDLE hFile;
|
|
NTSTATUS nErrCode;
|
|
IO_STATUS_BLOCK isbStatus;
|
|
|
|
/* get the file handle for the specified file descriptor */
|
|
if(fcntl(fildes, F_GETFH, &hFile) == -1)
|
|
return (-1);
|
|
|
|
/* read data from file */
|
|
nErrCode = NtReadFile
|
|
(
|
|
hFile,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
&isbStatus,
|
|
buf,
|
|
nbyte,
|
|
(PLARGE_INTEGER)&off_t,
|
|
NULL
|
|
);
|
|
|
|
return ((ssize_t)isbStatus.Information);
|
|
}
|
|
|
|
/* EOF */
|
|
|