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:
@@ -864,7 +864,6 @@
|
||||
#define bind _bind
|
||||
#define chdir _chdir
|
||||
#define chmod _chmod
|
||||
#define chown _chown
|
||||
#define chroot _chroot
|
||||
#define close _close
|
||||
#define dup _dup
|
||||
@@ -872,7 +871,6 @@
|
||||
#define execve _execve
|
||||
#define fchdir _fchdir
|
||||
#define fchmod _fchmod
|
||||
#define fchown _fchown
|
||||
#define fcntl _fcntl
|
||||
#define flock _flock
|
||||
#define fstatfs _fstatfs
|
||||
|
||||
@@ -24,7 +24,7 @@ SRCS+= accept.c access.c adjtime.c bind.c brk.c sbrk.c m_closefrom.c getsid.c \
|
||||
_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"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#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)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#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)
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#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;
|
||||
}
|
||||
@@ -1,36 +1,13 @@
|
||||
#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;
|
||||
|
||||
@@ -1,34 +1,13 @@
|
||||
#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;
|
||||
|
||||
@@ -145,7 +145,7 @@ CPPFLAGS.${i}+= -I${LIBCDIR}/locale
|
||||
# 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 \
|
||||
|
||||
Reference in New Issue
Block a user