Also removing lseek64, pread64, pwrite64.
Those functions have lost their "raison d'ĂȘtre", when off_t switched to
64bits.
Change-Id: I5aea35f01d6d10e3d6578a70323da7be5eca315a
{
int r = 0;
- if (lseek64(device, (u64_t) offset * SECTOR_SIZE, SEEK_SET, NULL) < 0)
+ if (lseek(device, offset * SECTOR_SIZE, SEEK_SET) < 0)
return -1;
switch (rw) {
#if 0
printf("%s at block %5d\n", dir == READING ? "reading " : "writing", bno);
#endif
- r= lseek64(dev, btoa64(bno), SEEK_SET, NULL);
- if (r != 0)
- fatal("lseek64 failed");
+ r= lseek(dev, btoa64(bno), SEEK_SET);
+ if (r < 0)
+ fatal("lseek failed");
if (dir == READING) {
if (read(dev, rwbuf, block_size) == block_size)
return;
{
int r = 0;
- if (lseek64(device, (u64_t) offset * SECTOR_SIZE, SEEK_SET, NULL) < 0)
+ if (lseek(device, offset * SECTOR_SIZE, SEEK_SET) < 0)
return -1;
switch (rw) {
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <minix/type.h>
#include "tdist.h"
/* For reads, read in the data for the chunk; possibly less. */
if (!do_write) {
- chunk = r = pread64(state.fd, state.buf, chunk,
+ chunk = r = pread(state.fd, state.buf, chunk,
position);
if (r < 0) {
/* For writes, write the data to the file; possibly less. */
if (do_write) {
- chunk = r = pwrite64(state.fd, state.buf, chunk,
+ chunk = r = pwrite(state.fd, state.buf, chunk,
position);
if (r <= 0) {
int _len(const char *_s);
void _begsig(int _dummy);
-ssize_t pread64(int fd, void *buf, size_t count, u64_t where);
-ssize_t pwrite64(int fd, const void *buf, size_t count, u64_t where);
-
#endif /* _LIB_H */
int access(const char *, int);
unsigned int alarm(unsigned int);
int chdir(const char *);
-#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
int chown(const char *, uid_t, gid_t) __RENAME(__posix_chown);
#else
int chown(const char *, uid_t, gid_t);
*/
#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
defined(_NETBSD_SOURCE)
-#ifndef __minix
+#ifndef __minix
int fdatasync(int);
#endif /* !__minix */
int fsync(int);
int brk(void *);
int fchdir(int);
-#if !defined(__minix) && defined(_XOPEN_SOURCE)
+#if defined(_XOPEN_SOURCE)
int fchown(int, uid_t, gid_t) __RENAME(__posix_fchown);
#else
int fchown(int, uid_t, gid_t);
/*
* Implementation-defined extensions
*/
-#ifdef __minix
-
-int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos);
-#if defined(_NETBSD_SOURCE)
-#include <minix/type.h>
-#endif /* defined(_NETBSD_SOURCE) */
-#endif /* __minix */
-
#if defined(_NETBSD_SOURCE)
#ifndef __minix
int acct(const char *);
#define bind _bind
#define chdir _chdir
#define chmod _chmod
-#define chown _chown
#define chroot _chroot
#define close _close
#define dup _dup
#define execve _execve
#define fchdir _fchdir
#define fchmod _fchmod
-#define fchown _fchown
#define fcntl _fcntl
#define flock _flock
#define fstatfs _fstatfs
_exit.c _ucontext.c environ.c __getcwd.c vfork.c sizeup.c init.c \
getrusage.c
-# Minix specific syscalls.
-SRCS+= cprofile.c lseek64.c sprofile.c stack_utils.c _mcontext.c
+# Minix specific syscalls / utils.
+SRCS+= cprofile.c sprofile.c stack_utils.c _mcontext.c
.include "${ARCHDIR}/sys-minix/Makefile.inc"
#include <unistd.h>
#ifdef __weak_alias
-__weak_alias(chown, _chown)
+__weak_alias(__posix_chown, chown)
#endif
int chown(const char *name, uid_t owner, gid_t grp)
#include <unistd.h>
#ifdef __weak_alias
-__weak_alias(fchown, _fchown)
+__weak_alias(__posix_fchown, fchown)
#endif
int fchown(int fd, uid_t owner, gid_t grp)
+++ /dev/null
-#include <sys/cdefs.h>
-#include "namespace.h"
-#include <lib.h>
-
-#include <string.h>
-#include <unistd.h>
-#include <minix/u64.h>
-
-int lseek64(fd, offset, whence, newpos)
-int fd;
-u64_t offset;
-int whence;
-u64_t *newpos;
-{
- message m;
-
- memset(&m, 0, sizeof(m));
- m.VFS_LSEEK_FD = fd;
- m.VFS_LSEEK_OFF_LO = ex64lo(offset);
- m.VFS_LSEEK_OFF_HI = ex64hi(offset);
- m.VFS_LSEEK_WHENCE = whence;
- if (_syscall(VFS_PROC_NR, VFS_LSEEK, &m) < 0) return -1;
- if (newpos)
- *newpos= make64(m.VFS_LSEEK_OFF_LO, m.VFS_LSEEK_OFF_HI);
- return 0;
-}
#include <sys/cdefs.h>
#include "namespace.h"
-#include <lib.h>
+#include <errno.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(pread, _pread)
#endif
-#include <lib.h>
-#include <unistd.h>
-#include <minix/u64.h>
-
-ssize_t pread64(int fd, void *buffer, size_t nbytes, u64_t where)
-{
- u64_t here;
- ssize_t r;
-
- if (lseek64(fd, make64(0,0), SEEK_CUR, &here) < 0) return(-1);
- if (lseek64(fd, where, SEEK_SET, NULL) < 0) return(-1);
- if ((r = read(fd, buffer, nbytes)) < 0) {
- int e = errno;
- lseek64(fd, here, SEEK_SET, NULL);
- errno = e;
- return(-1);
- }
-
- if (lseek64(fd, here, SEEK_SET, NULL) < 0) return(-1);
-
- return(r);
-}
-
ssize_t pread(int fd, void *buffer, size_t nbytes, off_t where)
{
off_t here;
#include <sys/cdefs.h>
#include "namespace.h"
-#include <lib.h>
+#include <errno.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(pwrite, _pwrite)
#endif
-#include <minix/u64.h>
-
-ssize_t pwrite64(int fd, const void *buffer, size_t nbytes, u64_t where)
-{
- u64_t here;
- ssize_t w;
-
- if (lseek64(fd, make64(0,0), SEEK_CUR, &here) < 0) return(-1);
- if (lseek64(fd, where, SEEK_SET, NULL) < 0) return(-1);
- if ((w = write(fd, buffer, nbytes)) < 0) {
- int e = errno;
- lseek64(fd, here, SEEK_SET, NULL);
- errno = e;
- return(-1);
- }
-
- if (lseek64(fd, here, SEEK_SET, NULL) < 0) return(-1);
-
- return(w);
-}
-
ssize_t pwrite(int fd, const void *buffer, size_t nbytes, off_t where)
{
off_t here;
# Import from sys-minix
.for i in access.c brk.c close.c environ.c execve.c fork.c fsync.c \
getgid.c getpid.c geteuid.c getuid.c gettimeofday.c getvfsstat.c \
- init.c link.c loadname.c lseek.c lseek64.c _mcontext.c mknod.c \
+ init.c link.c loadname.c lseek.c _mcontext.c mknod.c \
mmap.c nanosleep.c open.c pread.c pwrite.c read.c sbrk.c \
select.c setuid.c sigprocmask.c stack_utils.c stat.c stime.c \
syscall.c _ucontext.c umask.c unlink.c waitpid.c write.c \
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:");
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) {
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);
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);
mkfs_seek(uint64_t pos, int whence)
{
if(whence == SEEK_SET) pos += fs_offset_bytes;
-#ifdef __minix
- uint64_t newpos;
- if((lseek64(fd, pos, whence, &newpos)) < 0)
- err(1, "mkfs_seek: lseek64 failed");
- return newpos;
-#else
off_t newpos;
if((newpos=lseek(fd, pos, whence)) == (off_t) -1)
err(1, "mkfs_seek: lseek failed");
return newpos;
-#endif
}