Some 64-bit file offset changes that were left out accidentally in the first
commit.
This commit is contained in:
parent
bafc45a309
commit
8a2a957d49
@ -25,7 +25,7 @@ extern int errno; /* error number for PM calls */
|
|||||||
|
|
||||||
FORWARD _PROTOTYPE( char *r_name, (void) );
|
FORWARD _PROTOTYPE( char *r_name, (void) );
|
||||||
FORWARD _PROTOTYPE( struct device *r_prepare, (int device) );
|
FORWARD _PROTOTYPE( struct device *r_prepare, (int device) );
|
||||||
FORWARD _PROTOTYPE( int r_transfer, (int proc_nr, int opcode, off_t position,
|
FORWARD _PROTOTYPE( int r_transfer, (int proc_nr, int opcode, u64_t position,
|
||||||
iovec_t *iov, unsigned nr_req, int safe) );
|
iovec_t *iov, unsigned nr_req, int safe) );
|
||||||
FORWARD _PROTOTYPE( int r_do_open, (struct driver *dp, message *m_ptr) );
|
FORWARD _PROTOTYPE( int r_do_open, (struct driver *dp, message *m_ptr) );
|
||||||
FORWARD _PROTOTYPE( void r_init, (void) );
|
FORWARD _PROTOTYPE( void r_init, (void) );
|
||||||
@ -95,7 +95,7 @@ int device;
|
|||||||
PRIVATE int r_transfer(proc_nr, opcode, position, iov, nr_req, safe)
|
PRIVATE int r_transfer(proc_nr, opcode, position, iov, nr_req, safe)
|
||||||
int proc_nr; /* process doing the request */
|
int proc_nr; /* process doing the request */
|
||||||
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||||
off_t position; /* offset on device to read or write */
|
u64_t position; /* offset on device to read or write */
|
||||||
iovec_t *iov; /* pointer to read or write request vector */
|
iovec_t *iov; /* pointer to read or write request vector */
|
||||||
unsigned nr_req; /* length of request vector */
|
unsigned nr_req; /* length of request vector */
|
||||||
int safe; /* safe copies? */
|
int safe; /* safe copies? */
|
||||||
@ -105,6 +105,7 @@ int safe; /* safe copies? */
|
|||||||
vir_bytes user_vir;
|
vir_bytes user_vir;
|
||||||
struct device *dv;
|
struct device *dv;
|
||||||
unsigned long dv_size;
|
unsigned long dv_size;
|
||||||
|
int r;
|
||||||
size_t vir_offset = 0;
|
size_t vir_offset = 0;
|
||||||
|
|
||||||
/* Get minor device number and check for /dev/null. */
|
/* Get minor device number and check for /dev/null. */
|
||||||
@ -129,16 +130,30 @@ int safe; /* safe copies? */
|
|||||||
if (opcode == DEV_GATHER) {
|
if (opcode == DEV_GATHER) {
|
||||||
random_getbytes(random_buf, chunk);
|
random_getbytes(random_buf, chunk);
|
||||||
if(safe) {
|
if(safe) {
|
||||||
sys_safecopyto(proc_nr, user_vir, vir_offset,
|
r= sys_safecopyto(proc_nr, user_vir, vir_offset,
|
||||||
(vir_bytes) random_buf, chunk, D);
|
(vir_bytes) random_buf, chunk, D);
|
||||||
|
if (r != OK)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"random: sys_safecopyto failed for proc %d, grant %d\n",
|
||||||
|
proc_nr, user_vir);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sys_vircopy(SELF, D, (vir_bytes) random_buf,
|
sys_vircopy(SELF, D, (vir_bytes) random_buf,
|
||||||
proc_nr, D, user_vir + vir_offset, chunk);
|
proc_nr, D, user_vir + vir_offset, chunk);
|
||||||
}
|
}
|
||||||
} else if (opcode == DEV_SCATTER) {
|
} else if (opcode == DEV_SCATTER) {
|
||||||
if(safe) {
|
if(safe) {
|
||||||
sys_safecopyfrom(proc_nr, user_vir, vir_offset,
|
r= sys_safecopyfrom(proc_nr, user_vir, vir_offset,
|
||||||
(vir_bytes) random_buf, chunk, D);
|
(vir_bytes) random_buf, chunk, D);
|
||||||
|
if (r != OK)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"random: sys_safecopyfrom failed for proc %d, grant %d\n",
|
||||||
|
proc_nr, user_vir);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sys_vircopy(proc_nr, D, user_vir + vir_offset,
|
sys_vircopy(proc_nr, D, user_vir + vir_offset,
|
||||||
SELF, D, (vir_bytes) random_buf, chunk);
|
SELF, D, (vir_bytes) random_buf, chunk);
|
||||||
@ -156,7 +171,7 @@ int safe; /* safe copies? */
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Book the number of bytes transferred. */
|
/* Book the number of bytes transferred. */
|
||||||
position += count;
|
position= add64u(position, count);
|
||||||
if ((iov->iov_size -= count) == 0) { iov++; nr_req--; vir_offset = 0; }
|
if ((iov->iov_size -= count) == 0) { iov++; nr_req--; vir_offset = 0; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@
|
|||||||
#define SYSUNAME 78
|
#define SYSUNAME 78
|
||||||
#define GETSYSINFO 79 /* to PM or FS */
|
#define GETSYSINFO 79 /* to PM or FS */
|
||||||
#define GETDENTS 80 /* to FS */
|
#define GETDENTS 80 /* to FS */
|
||||||
|
#define LLSEEK 81 /* to FS */
|
||||||
#define FSTATFS 82 /* to FS */
|
#define FSTATFS 82 /* to FS */
|
||||||
#define SELECT 85 /* to FS */
|
#define SELECT 85 /* to FS */
|
||||||
#define FCHDIR 86 /* to FS */
|
#define FCHDIR 86 /* to FS */
|
||||||
|
@ -165,6 +165,8 @@ extern int optreset; /* Reset getopt state */
|
|||||||
|
|
||||||
_PROTOTYPE( int brk, (char *_addr) );
|
_PROTOTYPE( int brk, (char *_addr) );
|
||||||
_PROTOTYPE( int chroot, (const char *_name) );
|
_PROTOTYPE( int chroot, (const char *_name) );
|
||||||
|
_PROTOTYPE( int lseek64, (int _fd, u64_t _offset, int _whence,
|
||||||
|
u64_t *_newpos) );
|
||||||
_PROTOTYPE( int mknod, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr) );
|
_PROTOTYPE( int mknod, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr) );
|
||||||
_PROTOTYPE( int mknod4, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr,
|
_PROTOTYPE( int mknod4, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr,
|
||||||
long _size) );
|
long _size) );
|
||||||
|
@ -17,6 +17,7 @@ libc_FILES=" \
|
|||||||
_getpprocnr.c \
|
_getpprocnr.c \
|
||||||
_getprocnr.c \
|
_getprocnr.c \
|
||||||
_getsysinfo.c \
|
_getsysinfo.c \
|
||||||
|
_lseek64.c \
|
||||||
_reboot.c \
|
_reboot.c \
|
||||||
_seekdir.c \
|
_seekdir.c \
|
||||||
_sysuname.c \
|
_sysuname.c \
|
||||||
|
@ -58,6 +58,7 @@ libc_FILES=" \
|
|||||||
killpg.s \
|
killpg.s \
|
||||||
link.s \
|
link.s \
|
||||||
lseek.s \
|
lseek.s \
|
||||||
|
lseek64.s \
|
||||||
lstat.s \
|
lstat.s \
|
||||||
mkdir.s \
|
mkdir.s \
|
||||||
mkfifo.s \
|
mkfifo.s \
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
/* The following names are synonyms for the variables in the output message. */
|
/* The following names are synonyms for the variables in the output message. */
|
||||||
#define reply_type m_type
|
#define reply_type m_type
|
||||||
#define reply_l1 m2_l1
|
#define reply_l1 m2_l1
|
||||||
|
#define reply_l2 m2_l2
|
||||||
#define reply_i1 m1_i1
|
#define reply_i1 m1_i1
|
||||||
#define reply_i2 m1_i2
|
#define reply_i2 m1_i2
|
||||||
#define reply_t1 m4_l1
|
#define reply_t1 m4_l1
|
||||||
|
@ -99,7 +99,7 @@ PUBLIC _PROTOTYPE (int (*call_vec[]), (void) ) = {
|
|||||||
no_sys, /* 78 = (sysuname) */
|
no_sys, /* 78 = (sysuname) */
|
||||||
do_getsysinfo, /* 79 = getsysinfo */
|
do_getsysinfo, /* 79 = getsysinfo */
|
||||||
do_getdents, /* 80 = getdents */
|
do_getdents, /* 80 = getdents */
|
||||||
no_sys, /* 81 = unused */
|
do_llseek, /* 81 = llseek */
|
||||||
do_fstatfs, /* 82 = fstatfs */
|
do_fstatfs, /* 82 = fstatfs */
|
||||||
no_sys, /* 83 = unused */
|
no_sys, /* 83 = unused */
|
||||||
no_sys, /* 84 = unused */
|
no_sys, /* 84 = unused */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user