comparison src/console.c @ 34:a7144583914c

fix
author mir3636
date Thu, 14 Feb 2019 23:33:57 +0900
parents 7a63dacab7f8
children
comparison
equal deleted inserted replaced
33:7a63dacab7f8 34:a7144583914c
287 } 287 }
288 288
289 release(&input.lock); 289 release(&input.lock);
290 ilock(ip); 290 ilock(ip);
291 291
292 //int r = target - n;
293
294 //if (r > 0)
295 // f->off += r;
296 //iunlock(f->ip);
297
298 goto next(target - n); 292 goto next(target - n);
299
300 //goto next(r);
301 } 293 }
302 294
303 __code cbc_consoleread (struct inode *ip, char *dst, int n, __code(*next)(int ret)) 295 __code cbc_consoleread (struct inode *ip, char *dst, int n, __code(*next)(int ret))
304 { 296 {
305 uint target; 297 uint target;
310 acquire(&input.lock); 302 acquire(&input.lock);
311 303
312 if (n > 0) { 304 if (n > 0) {
313 proc->cbc_arg.cbc_console_arg.n = n; 305 proc->cbc_arg.cbc_console_arg.n = n;
314 proc->cbc_arg.cbc_console_arg.target = target; 306 proc->cbc_arg.cbc_console_arg.target = target;
315 proc->cbc_arg.cbc_console_arg.dst = dst; 307 proc->cbc_arg.cbc_console_arg.dst = dst;
316 proc->cbc_arg.cbc_console_arg.ip = ip; 308 proc->cbc_arg.cbc_console_arg.ip = ip;
317 proc->cbc_arg.cbc_console_arg.next = next; 309 proc->cbc_arg.cbc_console_arg.next = next;
318 if (input.r == input.w) { 310 goto cbc_consoleread2();
319 if (proc->killed) { 311 }
320 release(&input.lock);
321 ilock(ip);
322 goto next(-1);
323 }
324
325 goto cbc_sleep(&input.r, &input.lock, cbc_consoleread2);
326 }
327 goto cbc_consoleread1(); 312 goto cbc_consoleread1();
328 }
329 } 313 }
330 314
331 int consoleread (struct inode *ip, char *dst, int n) 315 int consoleread (struct inode *ip, char *dst, int n)
332 { 316 {
333 uint target; 317 uint target;