include/unistd.h: merged

Also removing lseek64, pread64, pwrite64.

Those functions have lost their "raison d'être", when off_t switched to
64bits.

Change-Id: I5aea35f01d6d10e3d6578a70323da7be5eca315a
This commit is contained in:
2013-12-02 20:03:35 +01:00
parent 3160cdd5b1
commit d3b0a89bab
18 changed files with 18 additions and 143 deletions

View File

@@ -318,23 +318,13 @@ bread(int fd, char *buf, daddr_t blk, long size)
offset = blk;
offset *= dev_bsize;
#ifndef __minix
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK", blk);
#else
if (lseek64(fd, offset, 0, NULL) < 0)
rwerror("SEEK", blk);
#endif
else if (read(fd, buf, (int)size) == size)
return (0);
rwerror("READ", blk);
#ifndef __minix
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK", blk);
#else
if (lseek64(fd, offset, 0, NULL) < 0)
rwerror("SEEK", blk);
#endif
errs = 0;
memset(buf, 0, (size_t)size);
printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:");
@@ -370,25 +360,15 @@ bwrite(int fd, char *buf, daddr_t blk, long size)
return;
offset = blk;
offset *= dev_bsize;
#ifndef __minix
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK", blk);
#else
if (lseek64(fd, offset, 0, NULL) < 0)
rwerror("SEEK", blk);
#endif
else if (write(fd, buf, (int)size) == size) {
fsmodified = 1;
return;
}
rwerror("WRITE", blk);
#ifndef __minix
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK", blk);
#else
if (lseek64(fd, offset, 0, NULL) < 0)
rwerror("SEEK", blk);
#endif
printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {

View File

@@ -1385,18 +1385,10 @@ void
rdfs(daddr_t bno, int size, void *bf)
{
int n;
#ifndef __minix
off_t offset;
#else
u64_t offset;
#endif
offset = bno;
#ifndef __minix
n = pread(fsi, bf, size, offset * sectorsize);
#else
n = pread64(fsi, bf, size, offset * sectorsize);
#endif
if (n != size)
err(EXIT_FAILURE, "%s: read error for sector %" PRId64,
__func__, (int64_t)bno);
@@ -1409,21 +1401,13 @@ void
wtfs(daddr_t bno, int size, void *bf)
{
int n;
#ifndef __minix
off_t offset;
#else
u64_t offset;
#endif
if (Nflag)
return;
offset = bno;
errno = 0;
#ifndef __minix
n = pwrite(fso, bf, size, offset * sectorsize);
#else
n = pwrite64(fso, bf, size, offset * sectorsize);
#endif
if (n != size)
err(EXIT_FAILURE, "%s: write error for sector %" PRId64,
__func__, (int64_t)bno);