File: pread.c

package info (click to toggle)
file 5.11-2%2Bdeb7u8
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,704 kB
  • sloc: ansic: 11,475; sh: 10,051; makefile: 392; python: 130
file content (14 lines) | stat: -rw-r--r-- 313 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: ctime_r.c,v 1.1 2012/05/15 17:14:36 christos Exp $")
#endif  /* lint */
#include <fcntl.h>
#include <unistd.h>

ssize_t
pread(int fd, void *buf, ssize_t len, off_t off) {
	if (lseek(fd, off, SEEK_SET) == (off_t)-1)
		return -1;

	return read(fd, buf, len);
}