uml: convert libc layer to call read and write
This patch converts calls in the os layer to os_{read,write}_file to calls directly to libc read() and write() where it is clear that the I/O buffer is in the kernel. We can do that here instead of calling os_{read,write}_file_k since we are in libc code and can call libc directly. With the change in the calls, error handling needs to be changed to refer to errno directly rather than the return value of the call. CATCH_EINTR wrappers were also added where needed. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
ef0470c053
commit
a61f334fd2
@@ -132,10 +132,10 @@ static int aio_thread(void *arg)
|
|||||||
{ .data = (void *) (long) event.data,
|
{ .data = (void *) (long) event.data,
|
||||||
.err = event.res });
|
.err = event.res });
|
||||||
reply_fd = ((struct aio_context *) reply.data)->reply_fd;
|
reply_fd = ((struct aio_context *) reply.data)->reply_fd;
|
||||||
err = os_write_file(reply_fd, &reply, sizeof(reply));
|
err = write(reply_fd, &reply, sizeof(reply));
|
||||||
if(err != sizeof(reply))
|
if(err != sizeof(reply))
|
||||||
printk("aio_thread - write failed, fd = %d, "
|
printk("aio_thread - write failed, fd = %d, "
|
||||||
"err = %d\n", reply_fd, -err);
|
"err = %d\n", reply_fd, errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -147,7 +147,7 @@ static int do_not_aio(struct aio_thread_req *req)
|
|||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
unsigned long long actual;
|
unsigned long long actual;
|
||||||
int err;
|
int n;
|
||||||
|
|
||||||
actual = lseek64(req->io_fd, req->offset, SEEK_SET);
|
actual = lseek64(req->io_fd, req->offset, SEEK_SET);
|
||||||
if(actual != req->offset)
|
if(actual != req->offset)
|
||||||
@@ -155,21 +155,22 @@ static int do_not_aio(struct aio_thread_req *req)
|
|||||||
|
|
||||||
switch(req->type){
|
switch(req->type){
|
||||||
case AIO_READ:
|
case AIO_READ:
|
||||||
err = os_read_file(req->io_fd, req->buf, req->len);
|
n = read(req->io_fd, req->buf, req->len);
|
||||||
break;
|
break;
|
||||||
case AIO_WRITE:
|
case AIO_WRITE:
|
||||||
err = os_write_file(req->io_fd, req->buf, req->len);
|
n = write(req->io_fd, req->buf, req->len);
|
||||||
break;
|
break;
|
||||||
case AIO_MMAP:
|
case AIO_MMAP:
|
||||||
err = os_read_file(req->io_fd, &c, sizeof(c));
|
n = read(req->io_fd, &c, sizeof(c));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk("do_not_aio - bad request type : %d\n", req->type);
|
printk("do_not_aio - bad request type : %d\n", req->type);
|
||||||
err = -EINVAL;
|
return -EINVAL;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
if(n < 0)
|
||||||
|
return -errno;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These are initialized in initcalls and not changed */
|
/* These are initialized in initcalls and not changed */
|
||||||
@@ -185,12 +186,12 @@ static int not_aio_thread(void *arg)
|
|||||||
|
|
||||||
signal(SIGWINCH, SIG_IGN);
|
signal(SIGWINCH, SIG_IGN);
|
||||||
while(1){
|
while(1){
|
||||||
err = os_read_file(aio_req_fd_r, &req, sizeof(req));
|
err = read(aio_req_fd_r, &req, sizeof(req));
|
||||||
if(err != sizeof(req)){
|
if(err != sizeof(req)){
|
||||||
if(err < 0)
|
if(err < 0)
|
||||||
printk("not_aio_thread - read failed, "
|
printk("not_aio_thread - read failed, "
|
||||||
"fd = %d, err = %d\n", aio_req_fd_r,
|
"fd = %d, err = %d\n", aio_req_fd_r,
|
||||||
-err);
|
errno);
|
||||||
else {
|
else {
|
||||||
printk("not_aio_thread - short read, fd = %d, "
|
printk("not_aio_thread - short read, fd = %d, "
|
||||||
"length = %d\n", aio_req_fd_r, err);
|
"length = %d\n", aio_req_fd_r, err);
|
||||||
@@ -200,10 +201,10 @@ static int not_aio_thread(void *arg)
|
|||||||
err = do_not_aio(&req);
|
err = do_not_aio(&req);
|
||||||
reply = ((struct aio_thread_reply) { .data = req.aio,
|
reply = ((struct aio_thread_reply) { .data = req.aio,
|
||||||
.err = err });
|
.err = err });
|
||||||
err = os_write_file(req.aio->reply_fd, &reply, sizeof(reply));
|
err = write(req.aio->reply_fd, &reply, sizeof(reply));
|
||||||
if(err != sizeof(reply))
|
if(err != sizeof(reply))
|
||||||
printk("not_aio_thread - write failed, fd = %d, "
|
printk("not_aio_thread - write failed, fd = %d, "
|
||||||
"err = %d\n", req.aio->reply_fd, -err);
|
"err = %d\n", req.aio->reply_fd, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -277,10 +278,12 @@ static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len,
|
|||||||
if(err){
|
if(err){
|
||||||
reply = ((struct aio_thread_reply) { .data = aio,
|
reply = ((struct aio_thread_reply) { .data = aio,
|
||||||
.err = err });
|
.err = err });
|
||||||
err = os_write_file(aio->reply_fd, &reply, sizeof(reply));
|
err = write(aio->reply_fd, &reply, sizeof(reply));
|
||||||
if(err != sizeof(reply))
|
if(err != sizeof(reply)){
|
||||||
|
err = -errno;
|
||||||
printk("submit_aio_26 - write failed, "
|
printk("submit_aio_26 - write failed, "
|
||||||
"fd = %d, err = %d\n", aio->reply_fd, -err);
|
"fd = %d, err = %d\n", aio->reply_fd, -err);
|
||||||
|
}
|
||||||
else err = 0;
|
else err = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,9 +378,10 @@ static int submit_aio_24(enum aio_type type, int io_fd, char *buf, int len,
|
|||||||
};
|
};
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = os_write_file(aio_req_fd_w, &req, sizeof(req));
|
err = write(aio_req_fd_w, &req, sizeof(req));
|
||||||
if(err == sizeof(req))
|
if(err == sizeof(req))
|
||||||
err = 0;
|
err = 0;
|
||||||
|
else err = -errno;
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@@ -48,9 +48,9 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
|
|||||||
change.what = op;
|
change.what = op;
|
||||||
memcpy(change.addr, addr, sizeof(change.addr));
|
memcpy(change.addr, addr, sizeof(change.addr));
|
||||||
memcpy(change.netmask, netmask, sizeof(change.netmask));
|
memcpy(change.netmask, netmask, sizeof(change.netmask));
|
||||||
n = os_write_file(fd, &change, sizeof(change));
|
CATCH_EINTR(n = write(fd, &change, sizeof(change)));
|
||||||
if(n != sizeof(change)){
|
if(n != sizeof(change)){
|
||||||
printk("etap_change - request failed, err = %d\n", -n);
|
printk("etap_change - request failed, err = %d\n", errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,10 +123,11 @@ static int etap_tramp(char *dev, char *gate, int control_me,
|
|||||||
err = pid;
|
err = pid;
|
||||||
os_close_file(data_remote);
|
os_close_file(data_remote);
|
||||||
os_close_file(control_remote);
|
os_close_file(control_remote);
|
||||||
n = os_read_file(control_me, &c, sizeof(c));
|
CATCH_EINTR(n = read(control_me, &c, sizeof(c)));
|
||||||
if(n != sizeof(c)){
|
if(n != sizeof(c)){
|
||||||
printk("etap_tramp : read of status failed, err = %d\n", -n);
|
err = -errno;
|
||||||
return -EINVAL;
|
printk("etap_tramp : read of status failed, err = %d\n", -err);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
if(c != 1){
|
if(c != 1){
|
||||||
printk("etap_tramp : uml_net failed\n");
|
printk("etap_tramp : uml_net failed\n");
|
||||||
|
@@ -36,7 +36,7 @@ static int helper_child(void *arg)
|
|||||||
errval = execvp_noalloc(data->buf, argv[0], argv);
|
errval = execvp_noalloc(data->buf, argv[0], argv);
|
||||||
printk("helper_child - execvp of '%s' failed - errno = %d\n", argv[0],
|
printk("helper_child - execvp of '%s' failed - errno = %d\n", argv[0],
|
||||||
-errval);
|
-errval);
|
||||||
os_write_file(data->fd, &errval, sizeof(errval));
|
write(data->fd, &errval, sizeof(errval));
|
||||||
kill(os_getpid(), SIGKILL);
|
kill(os_getpid(), SIGKILL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -92,11 +92,12 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
|
|||||||
* Read the errno value from the child, if the exec failed, or get 0 if
|
* Read the errno value from the child, if the exec failed, or get 0 if
|
||||||
* the exec succeeded because the pipe fd was set as close-on-exec.
|
* the exec succeeded because the pipe fd was set as close-on-exec.
|
||||||
*/
|
*/
|
||||||
n = os_read_file(fds[0], &ret, sizeof(ret));
|
n = read(fds[0], &ret, sizeof(ret));
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
ret = pid;
|
ret = pid;
|
||||||
} else {
|
} else {
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
|
n = -errno;
|
||||||
printk("run_helper : read on pipe failed, ret = %d\n",
|
printk("run_helper : read on pipe failed, ret = %d\n",
|
||||||
-n);
|
-n);
|
||||||
ret = n;
|
ret = n;
|
||||||
|
@@ -232,10 +232,9 @@ int __init create_tmp_file(unsigned long long len)
|
|||||||
|
|
||||||
zero = 0;
|
zero = 0;
|
||||||
|
|
||||||
err = os_write_file(fd, &zero, 1);
|
err = write(fd, &zero, 1);
|
||||||
if(err != 1){
|
if(err != 1){
|
||||||
errno = -err;
|
perror("write");
|
||||||
perror("os_write_file");
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,10 +42,10 @@ unsigned long os_process_pc(int pid)
|
|||||||
proc_stat, -fd);
|
proc_stat, -fd);
|
||||||
return ARBITRARY_ADDR;
|
return ARBITRARY_ADDR;
|
||||||
}
|
}
|
||||||
err = os_read_file(fd, buf, sizeof(buf));
|
CATCH_EINTR(err = read(fd, buf, sizeof(buf)));
|
||||||
if(err < 0){
|
if(err < 0){
|
||||||
printk("os_process_pc - couldn't read '%s', err = %d\n",
|
printk("os_process_pc - couldn't read '%s', err = %d\n",
|
||||||
proc_stat, -err);
|
proc_stat, errno);
|
||||||
os_close_file(fd);
|
os_close_file(fd);
|
||||||
return ARBITRARY_ADDR;
|
return ARBITRARY_ADDR;
|
||||||
}
|
}
|
||||||
@@ -75,11 +75,11 @@ int os_process_parent(int pid)
|
|||||||
return FAILURE_PID;
|
return FAILURE_PID;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = os_read_file(fd, data, sizeof(data));
|
CATCH_EINTR(n = read(fd, data, sizeof(data)));
|
||||||
os_close_file(fd);
|
os_close_file(fd);
|
||||||
|
|
||||||
if(n < 0){
|
if(n < 0){
|
||||||
printk("Couldn't read '%s', err = %d\n", stat, -n);
|
printk("Couldn't read '%s', err = %d\n", stat, errno);
|
||||||
return FAILURE_PID;
|
return FAILURE_PID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,11 +69,12 @@ static int write_sigio_thread(void *unused)
|
|||||||
p = &fds->poll[i];
|
p = &fds->poll[i];
|
||||||
if(p->revents == 0) continue;
|
if(p->revents == 0) continue;
|
||||||
if(p->fd == sigio_private[1]){
|
if(p->fd == sigio_private[1]){
|
||||||
n = os_read_file(sigio_private[1], &c, sizeof(c));
|
CATCH_EINTR(n = read(sigio_private[1], &c,
|
||||||
|
sizeof(c)));
|
||||||
if(n != sizeof(c))
|
if(n != sizeof(c))
|
||||||
printk("write_sigio_thread : "
|
printk("write_sigio_thread : "
|
||||||
"read on socket failed, "
|
"read on socket failed, "
|
||||||
"err = %d\n", -n);
|
"err = %d\n", errno);
|
||||||
tmp = current_poll;
|
tmp = current_poll;
|
||||||
current_poll = next_poll;
|
current_poll = next_poll;
|
||||||
next_poll = tmp;
|
next_poll = tmp;
|
||||||
@@ -86,10 +87,10 @@ static int write_sigio_thread(void *unused)
|
|||||||
(fds->used - i) * sizeof(*fds->poll));
|
(fds->used - i) * sizeof(*fds->poll));
|
||||||
}
|
}
|
||||||
|
|
||||||
n = os_write_file(respond_fd, &c, sizeof(c));
|
CATCH_EINTR(n = write(respond_fd, &c, sizeof(c)));
|
||||||
if(n != sizeof(c))
|
if(n != sizeof(c))
|
||||||
printk("write_sigio_thread : write on socket "
|
printk("write_sigio_thread : write on socket "
|
||||||
"failed, err = %d\n", -n);
|
"failed, err = %d\n", errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,15 +128,15 @@ static void update_thread(void)
|
|||||||
char c;
|
char c;
|
||||||
|
|
||||||
flags = set_signals(0);
|
flags = set_signals(0);
|
||||||
n = os_write_file(sigio_private[0], &c, sizeof(c));
|
n = write(sigio_private[0], &c, sizeof(c));
|
||||||
if(n != sizeof(c)){
|
if(n != sizeof(c)){
|
||||||
printk("update_thread : write failed, err = %d\n", -n);
|
printk("update_thread : write failed, err = %d\n", errno);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = os_read_file(sigio_private[0], &c, sizeof(c));
|
CATCH_EINTR(n = read(sigio_private[0], &c, sizeof(c)));
|
||||||
if(n != sizeof(c)){
|
if(n != sizeof(c)){
|
||||||
printk("update_thread : read failed, err = %d\n", -n);
|
printk("update_thread : read failed, err = %d\n", errno);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,10 +460,10 @@ static void tty_output(int master, int slave)
|
|||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
while(os_write_file(master, buf, sizeof(buf)) > 0) ;
|
while(write(master, buf, sizeof(buf)) > 0) ;
|
||||||
if(errno != EAGAIN)
|
if(errno != EAGAIN)
|
||||||
panic("tty_output : write failed, errno = %d\n", errno);
|
panic("tty_output : write failed, errno = %d\n", errno);
|
||||||
while(((n = os_read_file(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
|
while(((n = read(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
|
||||||
|
|
||||||
if(got_sigio){
|
if(got_sigio){
|
||||||
printk("Yes\n");
|
printk("Yes\n");
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
@@ -199,9 +200,11 @@ int map(struct mm_id * mm_idp, unsigned long virt, unsigned long len,
|
|||||||
.fd = phys_fd,
|
.fd = phys_fd,
|
||||||
.offset= offset
|
.offset= offset
|
||||||
} } } );
|
} } } );
|
||||||
ret = os_write_file(fd, &map, sizeof(map));
|
CATCH_EINTR(ret = write(fd, &map, sizeof(map)));
|
||||||
if(ret != sizeof(map))
|
if(ret != sizeof(map)){
|
||||||
|
ret = -errno;
|
||||||
printk("map : /proc/mm map failed, err = %d\n", -ret);
|
printk("map : /proc/mm map failed, err = %d\n", -ret);
|
||||||
|
}
|
||||||
else ret = 0;
|
else ret = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -231,9 +234,11 @@ int unmap(struct mm_id * mm_idp, void *addr, unsigned long len, int done,
|
|||||||
{ .addr =
|
{ .addr =
|
||||||
(unsigned long) addr,
|
(unsigned long) addr,
|
||||||
.len = len } } } );
|
.len = len } } } );
|
||||||
ret = os_write_file(fd, &unmap, sizeof(unmap));
|
CATCH_EINTR(ret = write(fd, &unmap, sizeof(unmap)));
|
||||||
if(ret != sizeof(unmap))
|
if(ret != sizeof(unmap)){
|
||||||
|
ret = -errno;
|
||||||
printk("unmap - proc_mm write returned %d\n", ret);
|
printk("unmap - proc_mm write returned %d\n", ret);
|
||||||
|
}
|
||||||
else ret = 0;
|
else ret = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -266,9 +271,11 @@ int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
|
|||||||
.len = len,
|
.len = len,
|
||||||
.prot = prot } } } );
|
.prot = prot } } } );
|
||||||
|
|
||||||
ret = os_write_file(fd, &protect, sizeof(protect));
|
CATCH_EINTR(ret = write(fd, &protect, sizeof(protect)));
|
||||||
if(ret != sizeof(protect))
|
if(ret != sizeof(protect)){
|
||||||
|
ret = -errno;
|
||||||
printk("protect failed, err = %d", -ret);
|
printk("protect failed, err = %d", -ret);
|
||||||
|
}
|
||||||
else ret = 0;
|
else ret = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -431,12 +431,13 @@ void map_stub_pages(int fd, unsigned long code,
|
|||||||
.fd = code_fd,
|
.fd = code_fd,
|
||||||
.offset = code_offset
|
.offset = code_offset
|
||||||
} } });
|
} } });
|
||||||
n = os_write_file(fd, &mmop, sizeof(mmop));
|
CATCH_EINTR(n = write(fd, &mmop, sizeof(mmop)));
|
||||||
if(n != sizeof(mmop)){
|
if(n != sizeof(mmop)){
|
||||||
|
n = errno;
|
||||||
printk("mmap args - addr = 0x%lx, fd = %d, offset = %llx\n",
|
printk("mmap args - addr = 0x%lx, fd = %d, offset = %llx\n",
|
||||||
code, code_fd, (unsigned long long) code_offset);
|
code, code_fd, (unsigned long long) code_offset);
|
||||||
panic("map_stub_pages : /proc/mm map for code failed, "
|
panic("map_stub_pages : /proc/mm map for code failed, "
|
||||||
"err = %d\n", -n);
|
"err = %d\n", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( stack ) {
|
if ( stack ) {
|
||||||
@@ -453,10 +454,10 @@ void map_stub_pages(int fd, unsigned long code,
|
|||||||
.fd = map_fd,
|
.fd = map_fd,
|
||||||
.offset = map_offset
|
.offset = map_offset
|
||||||
} } });
|
} } });
|
||||||
n = os_write_file(fd, &mmop, sizeof(mmop));
|
CATCH_EINTR(n = write(fd, &mmop, sizeof(mmop)));
|
||||||
if(n != sizeof(mmop))
|
if(n != sizeof(mmop))
|
||||||
panic("map_stub_pages : /proc/mm map for data failed, "
|
panic("map_stub_pages : /proc/mm map for data failed, "
|
||||||
"err = %d\n", -n);
|
"err = %d\n", errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,8 +53,8 @@ int open_tty_log(void *tty, void *current_tty)
|
|||||||
.direction = 0,
|
.direction = 0,
|
||||||
.sec = tv.tv_sec,
|
.sec = tv.tv_sec,
|
||||||
.usec = tv.tv_usec } );
|
.usec = tv.tv_usec } );
|
||||||
os_write_file(tty_log_fd, &data, sizeof(data));
|
write(tty_log_fd, &data, sizeof(data));
|
||||||
os_write_file(tty_log_fd, ¤t_tty, data.len);
|
write(tty_log_fd, ¤t_tty, data.len);
|
||||||
return tty_log_fd;
|
return tty_log_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ void close_tty_log(int fd, void *tty)
|
|||||||
.direction = 0,
|
.direction = 0,
|
||||||
.sec = tv.tv_sec,
|
.sec = tv.tv_sec,
|
||||||
.usec = tv.tv_usec } );
|
.usec = tv.tv_usec } );
|
||||||
os_write_file(tty_log_fd, &data, sizeof(data));
|
write(tty_log_fd, &data, sizeof(data));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
os_close_file(fd);
|
os_close_file(fd);
|
||||||
@@ -98,10 +98,10 @@ static int log_chunk(int fd, const char *buf, int len)
|
|||||||
try = (len > sizeof(chunk)) ? sizeof(chunk) : len;
|
try = (len > sizeof(chunk)) ? sizeof(chunk) : len;
|
||||||
missed = copy_from_user_proc(chunk, (char *) buf, try);
|
missed = copy_from_user_proc(chunk, (char *) buf, try);
|
||||||
try -= missed;
|
try -= missed;
|
||||||
n = os_write_file(fd, chunk, try);
|
n = write(fd, chunk, try);
|
||||||
if(n != try) {
|
if(n != try) {
|
||||||
if(n < 0)
|
if(n < 0)
|
||||||
return n;
|
return -errno;
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
if(missed != 0)
|
if(missed != 0)
|
||||||
@@ -130,7 +130,7 @@ int write_tty_log(int fd, const char *buf, int len, void *tty, int is_read)
|
|||||||
.direction = direction,
|
.direction = direction,
|
||||||
.sec = tv.tv_sec,
|
.sec = tv.tv_sec,
|
||||||
.usec = tv.tv_usec } );
|
.usec = tv.tv_usec } );
|
||||||
os_write_file(tty_log_fd, &data, sizeof(data));
|
write(tty_log_fd, &data, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
return log_chunk(fd, buf, len);
|
return log_chunk(fd, buf, len);
|
||||||
@@ -161,7 +161,7 @@ void log_exec(char **argv, void *tty)
|
|||||||
.direction = 0,
|
.direction = 0,
|
||||||
.sec = tv.tv_sec,
|
.sec = tv.tv_sec,
|
||||||
.usec = tv.tv_usec } );
|
.usec = tv.tv_usec } );
|
||||||
os_write_file(tty_log_fd, &data, sizeof(data));
|
write(tty_log_fd, &data, sizeof(data));
|
||||||
|
|
||||||
for(ptr = argv; ; ptr++){
|
for(ptr = argv; ; ptr++){
|
||||||
if(copy_from_user_proc(&arg, ptr, sizeof(arg)))
|
if(copy_from_user_proc(&arg, ptr, sizeof(arg)))
|
||||||
|
Reference in New Issue
Block a user