aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-05-06 17:51:35 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:13:03 -0400
commita61f334fd2864b9b040f7e882726426ed7e8a317 (patch)
tree51874236a1f324a2664118f54aadd9ba3beb95ca
parentef0470c053274c343b2be8737e0146d65e17f9be (diff)
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>
-rw-r--r--arch/um/os-Linux/aio.c36
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c11
-rw-r--r--arch/um/os-Linux/helper.c5
-rw-r--r--arch/um/os-Linux/mem.c5
-rw-r--r--arch/um/os-Linux/process.c8
-rw-r--r--arch/um/os-Linux/sigio.c21
-rw-r--r--arch/um/os-Linux/skas/mem.c19
-rw-r--r--arch/um/os-Linux/skas/process.c9
-rw-r--r--arch/um/os-Linux/tty_log.c14
9 files changed, 71 insertions, 57 deletions
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index c1f0f76291cf..5d258eb4f506 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -132,10 +132,10 @@ static int aio_thread(void *arg)
132 { .data = (void *) (long) event.data, 132 { .data = (void *) (long) event.data,
133 .err = event.res }); 133 .err = event.res });
134 reply_fd = ((struct aio_context *) reply.data)->reply_fd; 134 reply_fd = ((struct aio_context *) reply.data)->reply_fd;
135 err = os_write_file(reply_fd, &reply, sizeof(reply)); 135 err = write(reply_fd, &reply, sizeof(reply));
136 if(err != sizeof(reply)) 136 if(err != sizeof(reply))
137 printk("aio_thread - write failed, fd = %d, " 137 printk("aio_thread - write failed, fd = %d, "
138 "err = %d\n", reply_fd, -err); 138 "err = %d\n", reply_fd, errno);
139 } 139 }
140 } 140 }
141 return 0; 141 return 0;
@@ -147,7 +147,7 @@ static int do_not_aio(struct aio_thread_req *req)
147{ 147{
148 char c; 148 char c;
149 unsigned long long actual; 149 unsigned long long actual;
150 int err; 150 int n;
151 151
152 actual = lseek64(req->io_fd, req->offset, SEEK_SET); 152 actual = lseek64(req->io_fd, req->offset, SEEK_SET);
153 if(actual != req->offset) 153 if(actual != req->offset)
@@ -155,21 +155,22 @@ static int do_not_aio(struct aio_thread_req *req)
155 155
156 switch(req->type){ 156 switch(req->type){
157 case AIO_READ: 157 case AIO_READ:
158 err = os_read_file(req->io_fd, req->buf, req->len); 158 n = read(req->io_fd, req->buf, req->len);
159 break; 159 break;
160 case AIO_WRITE: 160 case AIO_WRITE:
161 err = os_write_file(req->io_fd, req->buf, req->len); 161 n = write(req->io_fd, req->buf, req->len);
162 break; 162 break;
163 case AIO_MMAP: 163 case AIO_MMAP:
164 err = os_read_file(req->io_fd, &c, sizeof(c)); 164 n = read(req->io_fd, &c, sizeof(c));
165 break; 165 break;
166 default: 166 default:
167 printk("do_not_aio - bad request type : %d\n", req->type); 167 printk("do_not_aio - bad request type : %d\n", req->type);
168 err = -EINVAL; 168 return -EINVAL;
169 break;
170 } 169 }
171 170
172 return err; 171 if(n < 0)
172 return -errno;
173 return 0;
173} 174}
174 175
175/* These are initialized in initcalls and not changed */ 176/* These are initialized in initcalls and not changed */
@@ -185,12 +186,12 @@ static int not_aio_thread(void *arg)
185 186
186 signal(SIGWINCH, SIG_IGN); 187 signal(SIGWINCH, SIG_IGN);
187 while(1){ 188 while(1){
188 err = os_read_file(aio_req_fd_r, &req, sizeof(req)); 189 err = read(aio_req_fd_r, &req, sizeof(req));
189 if(err != sizeof(req)){ 190 if(err != sizeof(req)){
190 if(err < 0) 191 if(err < 0)
191 printk("not_aio_thread - read failed, " 192 printk("not_aio_thread - read failed, "
192 "fd = %d, err = %d\n", aio_req_fd_r, 193 "fd = %d, err = %d\n", aio_req_fd_r,
193 -err); 194 errno);
194 else { 195 else {
195 printk("not_aio_thread - short read, fd = %d, " 196 printk("not_aio_thread - short read, fd = %d, "
196 "length = %d\n", aio_req_fd_r, err); 197 "length = %d\n", aio_req_fd_r, err);
@@ -200,10 +201,10 @@ static int not_aio_thread(void *arg)
200 err = do_not_aio(&req); 201 err = do_not_aio(&req);
201 reply = ((struct aio_thread_reply) { .data = req.aio, 202 reply = ((struct aio_thread_reply) { .data = req.aio,
202 .err = err }); 203 .err = err });
203 err = os_write_file(req.aio->reply_fd, &reply, sizeof(reply)); 204 err = write(req.aio->reply_fd, &reply, sizeof(reply));
204 if(err != sizeof(reply)) 205 if(err != sizeof(reply))
205 printk("not_aio_thread - write failed, fd = %d, " 206 printk("not_aio_thread - write failed, fd = %d, "
206 "err = %d\n", req.aio->reply_fd, -err); 207 "err = %d\n", req.aio->reply_fd, errno);
207 } 208 }
208 209
209 return 0; 210 return 0;
@@ -277,10 +278,12 @@ static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len,
277 if(err){ 278 if(err){
278 reply = ((struct aio_thread_reply) { .data = aio, 279 reply = ((struct aio_thread_reply) { .data = aio,
279 .err = err }); 280 .err = err });
280 err = os_write_file(aio->reply_fd, &reply, sizeof(reply)); 281 err = write(aio->reply_fd, &reply, sizeof(reply));
281 if(err != sizeof(reply)) 282 if(err != sizeof(reply)){
283 err = -errno;
282 printk("submit_aio_26 - write failed, " 284 printk("submit_aio_26 - write failed, "
283 "fd = %d, err = %d\n", aio->reply_fd, -err); 285 "fd = %d, err = %d\n", aio->reply_fd, -err);
286 }
284 else err = 0; 287 else err = 0;
285 } 288 }
286 289
@@ -375,9 +378,10 @@ static int submit_aio_24(enum aio_type type, int io_fd, char *buf, int len,
375 }; 378 };
376 int err; 379 int err;
377 380
378 err = os_write_file(aio_req_fd_w, &req, sizeof(req)); 381 err = write(aio_req_fd_w, &req, sizeof(req));
379 if(err == sizeof(req)) 382 if(err == sizeof(req))
380 err = 0; 383 err = 0;
384 else err = -errno;
381 385
382 return err; 386 return err;
383} 387}
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index fd6cfa5b4a78..acba30161287 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -48,9 +48,9 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
48 change.what = op; 48 change.what = op;
49 memcpy(change.addr, addr, sizeof(change.addr)); 49 memcpy(change.addr, addr, sizeof(change.addr));
50 memcpy(change.netmask, netmask, sizeof(change.netmask)); 50 memcpy(change.netmask, netmask, sizeof(change.netmask));
51 n = os_write_file(fd, &change, sizeof(change)); 51 CATCH_EINTR(n = write(fd, &change, sizeof(change)));
52 if(n != sizeof(change)){ 52 if(n != sizeof(change)){
53 printk("etap_change - request failed, err = %d\n", -n); 53 printk("etap_change - request failed, err = %d\n", errno);
54 return; 54 return;
55 } 55 }
56 56
@@ -123,10 +123,11 @@ static int etap_tramp(char *dev, char *gate, int control_me,
123 err = pid; 123 err = pid;
124 os_close_file(data_remote); 124 os_close_file(data_remote);
125 os_close_file(control_remote); 125 os_close_file(control_remote);
126 n = os_read_file(control_me, &c, sizeof(c)); 126 CATCH_EINTR(n = read(control_me, &c, sizeof(c)));
127 if(n != sizeof(c)){ 127 if(n != sizeof(c)){
128 printk("etap_tramp : read of status failed, err = %d\n", -n); 128 err = -errno;
129 return -EINVAL; 129 printk("etap_tramp : read of status failed, err = %d\n", -err);
130 return err;
130 } 131 }
131 if(c != 1){ 132 if(c != 1){
132 printk("etap_tramp : uml_net failed\n"); 133 printk("etap_tramp : uml_net failed\n");
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index 8a4c9e47326c..97bed16bf4c7 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -36,7 +36,7 @@ static int helper_child(void *arg)
36 errval = execvp_noalloc(data->buf, argv[0], argv); 36 errval = execvp_noalloc(data->buf, argv[0], argv);
37 printk("helper_child - execvp of '%s' failed - errno = %d\n", argv[0], 37 printk("helper_child - execvp of '%s' failed - errno = %d\n", argv[0],
38 -errval); 38 -errval);
39 os_write_file(data->fd, &errval, sizeof(errval)); 39 write(data->fd, &errval, sizeof(errval));
40 kill(os_getpid(), SIGKILL); 40 kill(os_getpid(), SIGKILL);
41 return 0; 41 return 0;
42} 42}
@@ -92,11 +92,12 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
92 * Read the errno value from the child, if the exec failed, or get 0 if 92 * Read the errno value from the child, if the exec failed, or get 0 if
93 * the exec succeeded because the pipe fd was set as close-on-exec. 93 * the exec succeeded because the pipe fd was set as close-on-exec.
94 */ 94 */
95 n = os_read_file(fds[0], &ret, sizeof(ret)); 95 n = read(fds[0], &ret, sizeof(ret));
96 if (n == 0) { 96 if (n == 0) {
97 ret = pid; 97 ret = pid;
98 } else { 98 } else {
99 if (n < 0) { 99 if (n < 0) {
100 n = -errno;
100 printk("run_helper : read on pipe failed, ret = %d\n", 101 printk("run_helper : read on pipe failed, ret = %d\n",
101 -n); 102 -n);
102 ret = n; 103 ret = n;
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 77d16023c286..c6378c6d10d2 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -232,10 +232,9 @@ int __init create_tmp_file(unsigned long long len)
232 232
233 zero = 0; 233 zero = 0;
234 234
235 err = os_write_file(fd, &zero, 1); 235 err = write(fd, &zero, 1);
236 if(err != 1){ 236 if(err != 1){
237 errno = -err; 237 perror("write");
238 perror("os_write_file");
239 exit(1); 238 exit(1);
240 } 239 }
241 240
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index a84a45843f83..92a7b59120d6 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -42,10 +42,10 @@ unsigned long os_process_pc(int pid)
42 proc_stat, -fd); 42 proc_stat, -fd);
43 return ARBITRARY_ADDR; 43 return ARBITRARY_ADDR;
44 } 44 }
45 err = os_read_file(fd, buf, sizeof(buf)); 45 CATCH_EINTR(err = read(fd, buf, sizeof(buf)));
46 if(err < 0){ 46 if(err < 0){
47 printk("os_process_pc - couldn't read '%s', err = %d\n", 47 printk("os_process_pc - couldn't read '%s', err = %d\n",
48 proc_stat, -err); 48 proc_stat, errno);
49 os_close_file(fd); 49 os_close_file(fd);
50 return ARBITRARY_ADDR; 50 return ARBITRARY_ADDR;
51 } 51 }
@@ -75,11 +75,11 @@ int os_process_parent(int pid)
75 return FAILURE_PID; 75 return FAILURE_PID;
76 } 76 }
77 77
78 n = os_read_file(fd, data, sizeof(data)); 78 CATCH_EINTR(n = read(fd, data, sizeof(data)));
79 os_close_file(fd); 79 os_close_file(fd);
80 80
81 if(n < 0){ 81 if(n < 0){
82 printk("Couldn't read '%s', err = %d\n", stat, -n); 82 printk("Couldn't read '%s', err = %d\n", stat, errno);
83 return FAILURE_PID; 83 return FAILURE_PID;
84 } 84 }
85 85
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 8ccf6a36f1c6..8d4e0c6b8c92 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -69,11 +69,12 @@ static int write_sigio_thread(void *unused)
69 p = &fds->poll[i]; 69 p = &fds->poll[i];
70 if(p->revents == 0) continue; 70 if(p->revents == 0) continue;
71 if(p->fd == sigio_private[1]){ 71 if(p->fd == sigio_private[1]){
72 n = os_read_file(sigio_private[1], &c, sizeof(c)); 72 CATCH_EINTR(n = read(sigio_private[1], &c,
73 sizeof(c)));
73 if(n != sizeof(c)) 74 if(n != sizeof(c))
74 printk("write_sigio_thread : " 75 printk("write_sigio_thread : "
75 "read on socket failed, " 76 "read on socket failed, "
76 "err = %d\n", -n); 77 "err = %d\n", errno);
77 tmp = current_poll; 78 tmp = current_poll;
78 current_poll = next_poll; 79 current_poll = next_poll;
79 next_poll = tmp; 80 next_poll = tmp;
@@ -86,10 +87,10 @@ static int write_sigio_thread(void *unused)
86 (fds->used - i) * sizeof(*fds->poll)); 87 (fds->used - i) * sizeof(*fds->poll));
87 } 88 }
88 89
89 n = os_write_file(respond_fd, &c, sizeof(c)); 90 CATCH_EINTR(n = write(respond_fd, &c, sizeof(c)));
90 if(n != sizeof(c)) 91 if(n != sizeof(c))
91 printk("write_sigio_thread : write on socket " 92 printk("write_sigio_thread : write on socket "
92 "failed, err = %d\n", -n); 93 "failed, err = %d\n", errno);
93 } 94 }
94 } 95 }
95 96
@@ -127,15 +128,15 @@ static void update_thread(void)
127 char c; 128 char c;
128 129
129 flags = set_signals(0); 130 flags = set_signals(0);
130 n = os_write_file(sigio_private[0], &c, sizeof(c)); 131 n = write(sigio_private[0], &c, sizeof(c));
131 if(n != sizeof(c)){ 132 if(n != sizeof(c)){
132 printk("update_thread : write failed, err = %d\n", -n); 133 printk("update_thread : write failed, err = %d\n", errno);
133 goto fail; 134 goto fail;
134 } 135 }
135 136
136 n = os_read_file(sigio_private[0], &c, sizeof(c)); 137 CATCH_EINTR(n = read(sigio_private[0], &c, sizeof(c)));
137 if(n != sizeof(c)){ 138 if(n != sizeof(c)){
138 printk("update_thread : read failed, err = %d\n", -n); 139 printk("update_thread : read failed, err = %d\n", errno);
139 goto fail; 140 goto fail;
140 } 141 }
141 142
@@ -459,10 +460,10 @@ static void tty_output(int master, int slave)
459 460
460 memset(buf, 0, sizeof(buf)); 461 memset(buf, 0, sizeof(buf));
461 462
462 while(os_write_file(master, buf, sizeof(buf)) > 0) ; 463 while(write(master, buf, sizeof(buf)) > 0) ;
463 if(errno != EAGAIN) 464 if(errno != EAGAIN)
464 panic("tty_output : write failed, errno = %d\n", errno); 465 panic("tty_output : write failed, errno = %d\n", errno);
465 while(((n = os_read_file(slave, buf, sizeof(buf))) > 0) && !got_sigio) ; 466 while(((n = read(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
466 467
467 if(got_sigio){ 468 if(got_sigio){
468 printk("Yes\n"); 469 printk("Yes\n");
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 470ec531aa5d..6cdfda807b65 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -6,6 +6,7 @@
6#include <signal.h> 6#include <signal.h>
7#include <errno.h> 7#include <errno.h>
8#include <string.h> 8#include <string.h>
9#include <unistd.h>
9#include <sys/mman.h> 10#include <sys/mman.h>
10#include <sys/wait.h> 11#include <sys/wait.h>
11#include <asm/page.h> 12#include <asm/page.h>
@@ -199,9 +200,11 @@ int map(struct mm_id * mm_idp, unsigned long virt, unsigned long len,
199 .fd = phys_fd, 200 .fd = phys_fd,
200 .offset= offset 201 .offset= offset
201 } } } ); 202 } } } );
202 ret = os_write_file(fd, &map, sizeof(map)); 203 CATCH_EINTR(ret = write(fd, &map, sizeof(map)));
203 if(ret != sizeof(map)) 204 if(ret != sizeof(map)){
205 ret = -errno;
204 printk("map : /proc/mm map failed, err = %d\n", -ret); 206 printk("map : /proc/mm map failed, err = %d\n", -ret);
207 }
205 else ret = 0; 208 else ret = 0;
206 } 209 }
207 else { 210 else {
@@ -231,9 +234,11 @@ int unmap(struct mm_id * mm_idp, void *addr, unsigned long len, int done,
231 { .addr = 234 { .addr =
232 (unsigned long) addr, 235 (unsigned long) addr,
233 .len = len } } } ); 236 .len = len } } } );
234 ret = os_write_file(fd, &unmap, sizeof(unmap)); 237 CATCH_EINTR(ret = write(fd, &unmap, sizeof(unmap)));
235 if(ret != sizeof(unmap)) 238 if(ret != sizeof(unmap)){
239 ret = -errno;
236 printk("unmap - proc_mm write returned %d\n", ret); 240 printk("unmap - proc_mm write returned %d\n", ret);
241 }
237 else ret = 0; 242 else ret = 0;
238 } 243 }
239 else { 244 else {
@@ -266,9 +271,11 @@ int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
266 .len = len, 271 .len = len,
267 .prot = prot } } } ); 272 .prot = prot } } } );
268 273
269 ret = os_write_file(fd, &protect, sizeof(protect)); 274 CATCH_EINTR(ret = write(fd, &protect, sizeof(protect)));
270 if(ret != sizeof(protect)) 275 if(ret != sizeof(protect)){
276 ret = -errno;
271 printk("protect failed, err = %d", -ret); 277 printk("protect failed, err = %d", -ret);
278 }
272 else ret = 0; 279 else ret = 0;
273 } 280 }
274 else { 281 else {
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 47852698d5e1..5b1943dc15e9 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -431,12 +431,13 @@ void map_stub_pages(int fd, unsigned long code,
431 .fd = code_fd, 431 .fd = code_fd,
432 .offset = code_offset 432 .offset = code_offset
433 } } }); 433 } } });
434 n = os_write_file(fd, &mmop, sizeof(mmop)); 434 CATCH_EINTR(n = write(fd, &mmop, sizeof(mmop)));
435 if(n != sizeof(mmop)){ 435 if(n != sizeof(mmop)){
436 n = errno;
436 printk("mmap args - addr = 0x%lx, fd = %d, offset = %llx\n", 437 printk("mmap args - addr = 0x%lx, fd = %d, offset = %llx\n",
437 code, code_fd, (unsigned long long) code_offset); 438 code, code_fd, (unsigned long long) code_offset);
438 panic("map_stub_pages : /proc/mm map for code failed, " 439 panic("map_stub_pages : /proc/mm map for code failed, "
439 "err = %d\n", -n); 440 "err = %d\n", n);
440 } 441 }
441 442
442 if ( stack ) { 443 if ( stack ) {
@@ -453,10 +454,10 @@ void map_stub_pages(int fd, unsigned long code,
453 .fd = map_fd, 454 .fd = map_fd,
454 .offset = map_offset 455 .offset = map_offset
455 } } }); 456 } } });
456 n = os_write_file(fd, &mmop, sizeof(mmop)); 457 CATCH_EINTR(n = write(fd, &mmop, sizeof(mmop)));
457 if(n != sizeof(mmop)) 458 if(n != sizeof(mmop))
458 panic("map_stub_pages : /proc/mm map for data failed, " 459 panic("map_stub_pages : /proc/mm map for data failed, "
459 "err = %d\n", -n); 460 "err = %d\n", errno);
460 } 461 }
461} 462}
462 463
diff --git a/arch/um/os-Linux/tty_log.c b/arch/um/os-Linux/tty_log.c
index ae9adb1b74f2..d11a55baa6bd 100644
--- a/arch/um/os-Linux/tty_log.c
+++ b/arch/um/os-Linux/tty_log.c
@@ -53,8 +53,8 @@ int open_tty_log(void *tty, void *current_tty)
53 .direction = 0, 53 .direction = 0,
54 .sec = tv.tv_sec, 54 .sec = tv.tv_sec,
55 .usec = tv.tv_usec } ); 55 .usec = tv.tv_usec } );
56 os_write_file(tty_log_fd, &data, sizeof(data)); 56 write(tty_log_fd, &data, sizeof(data));
57 os_write_file(tty_log_fd, &current_tty, data.len); 57 write(tty_log_fd, &current_tty, data.len);
58 return tty_log_fd; 58 return tty_log_fd;
59 } 59 }
60 60
@@ -83,7 +83,7 @@ void close_tty_log(int fd, void *tty)
83 .direction = 0, 83 .direction = 0,
84 .sec = tv.tv_sec, 84 .sec = tv.tv_sec,
85 .usec = tv.tv_usec } ); 85 .usec = tv.tv_usec } );
86 os_write_file(tty_log_fd, &data, sizeof(data)); 86 write(tty_log_fd, &data, sizeof(data));
87 return; 87 return;
88 } 88 }
89 os_close_file(fd); 89 os_close_file(fd);
@@ -98,10 +98,10 @@ static int log_chunk(int fd, const char *buf, int len)
98 try = (len > sizeof(chunk)) ? sizeof(chunk) : len; 98 try = (len > sizeof(chunk)) ? sizeof(chunk) : len;
99 missed = copy_from_user_proc(chunk, (char *) buf, try); 99 missed = copy_from_user_proc(chunk, (char *) buf, try);
100 try -= missed; 100 try -= missed;
101 n = os_write_file(fd, chunk, try); 101 n = write(fd, chunk, try);
102 if(n != try) { 102 if(n != try) {
103 if(n < 0) 103 if(n < 0)
104 return n; 104 return -errno;
105 return -EIO; 105 return -EIO;
106 } 106 }
107 if(missed != 0) 107 if(missed != 0)
@@ -130,7 +130,7 @@ int write_tty_log(int fd, const char *buf, int len, void *tty, int is_read)
130 .direction = direction, 130 .direction = direction,
131 .sec = tv.tv_sec, 131 .sec = tv.tv_sec,
132 .usec = tv.tv_usec } ); 132 .usec = tv.tv_usec } );
133 os_write_file(tty_log_fd, &data, sizeof(data)); 133 write(tty_log_fd, &data, sizeof(data));
134 } 134 }
135 135
136 return log_chunk(fd, buf, len); 136 return log_chunk(fd, buf, len);
@@ -161,7 +161,7 @@ void log_exec(char **argv, void *tty)
161 .direction = 0, 161 .direction = 0,
162 .sec = tv.tv_sec, 162 .sec = tv.tv_sec,
163 .usec = tv.tv_usec } ); 163 .usec = tv.tv_usec } );
164 os_write_file(tty_log_fd, &data, sizeof(data)); 164 write(tty_log_fd, &data, sizeof(data));
165 165
166 for(ptr = argv; ; ptr++){ 166 for(ptr = argv; ; ptr++){
167 if(copy_from_user_proc(&arg, ptr, sizeof(arg))) 167 if(copy_from_user_proc(&arg, ptr, sizeof(arg)))