OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [linux/] [pread64.c] - Diff between revs 148 and 158

Only display areas with differences | Details | Blame | View Log

Rev 148 Rev 158
/*
/*
FUNCTION
FUNCTION
<<pread64>>---read a large file from specified position
<<pread64>>---read a large file from specified position
 
 
INDEX
INDEX
        pread64
        pread64
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <unistd.h>
        #include <unistd.h>
        ssize_t pread64(int <[fd]>, void *<[buf]>, size_t <[n]>, loff_t <[off]>);
        ssize_t pread64(int <[fd]>, void *<[buf]>, size_t <[n]>, loff_t <[off]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <unistd.h>
        #include <unistd.h>
        ssize_t pread64(<[fd]>, <[buf]>, <[n]>, <[off]>)
        ssize_t pread64(<[fd]>, <[buf]>, <[n]>, <[off]>)
        int <[fd]>;
        int <[fd]>;
        void *<[buf]>;
        void *<[buf]>;
        size_t <[n]>;
        size_t <[n]>;
        loff_t <[off]>;
        loff_t <[off]>;
 
 
DESCRIPTION
DESCRIPTION
The <<pread64>> function is similar to <<pread>>.  The only difference is
The <<pread64>> function is similar to <<pread>>.  The only difference is
that it operates on large files and so takes a 64-bit offset.  Like <<pread>>>,
that it operates on large files and so takes a 64-bit offset.  Like <<pread>>>,
the file position is unchanged by the function (i.e. the file position
the file position is unchanged by the function (i.e. the file position
is the same before and after a call to <<pread>>).
is the same before and after a call to <<pread>>).
 
 
RETURNS
RETURNS
<<pread64>> returns the number of bytes read or <<-1>> if failure occurred.
<<pread64>> returns the number of bytes read or <<-1>> if failure occurred.
 
 
PORTABILITY
PORTABILITY
<<pread64>> is an EL/IX extension.
<<pread64>> is an EL/IX extension.
 
 
Supporting OS subroutine required: <<read>>, <<lseek64>>.
Supporting OS subroutine required: <<read>>, <<lseek64>>.
*/
*/
 
 
#include <_ansi.h>
#include <_ansi.h>
#include <unistd.h>
#include <unistd.h>
#include <reent.h>
#include <reent.h>
#include <machine/weakalias.h>
#include <machine/weakalias.h>
 
 
ssize_t
ssize_t
_DEFUN (__libc_pread64, (fd, buf, n, off),
_DEFUN (__libc_pread64, (fd, buf, n, off),
     int fd _AND
     int fd _AND
     _PTR buf _AND
     _PTR buf _AND
     size_t n _AND
     size_t n _AND
     loff_t off)
     loff_t off)
{
{
  loff_t cur_pos;
  loff_t cur_pos;
  _READ_WRITE_RETURN_TYPE num_read;
  _READ_WRITE_RETURN_TYPE num_read;
 
 
  if ((cur_pos = lseek64 (fd, 0, SEEK_CUR)) == (loff_t)-1)
  if ((cur_pos = lseek64 (fd, 0, SEEK_CUR)) == (loff_t)-1)
    return -1;
    return -1;
 
 
  if (lseek64 (fd, off, SEEK_SET) == (loff_t)-1)
  if (lseek64 (fd, off, SEEK_SET) == (loff_t)-1)
    return -1;
    return -1;
 
 
  num_read = read (fd, buf, n);
  num_read = read (fd, buf, n);
 
 
  if (lseek64 (fd, cur_pos, SEEK_SET) == (loff_t)-1)
  if (lseek64 (fd, cur_pos, SEEK_SET) == (loff_t)-1)
    return -1;
    return -1;
 
 
  return (ssize_t)num_read;
  return (ssize_t)num_read;
}
}
weak_alias(__libc_pread64,pread64);
weak_alias(__libc_pread64,pread64);
weak_alias(__libc_pread64,__pread64);
weak_alias(__libc_pread64,__pread64);
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.