sys_pipe.c (2834ceec7cb6584490e4b230601ef15103e00ba8) | sys_pipe.c (dca5129987a1ec4da4a2627b0a4e74a4eaebc5c9) |
---|---|
1/* 2 * Copyright (c) 1996 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 171 unchanged lines hidden (view full) --- 180 fdp->fd_ofiles[retval[0]] = 0; 181free2: 182 (void)pipeclose(wpipe); 183free1: 184 (void)pipeclose(rpipe); 185 return (error); 186} 187 | 1/* 2 * Copyright (c) 1996 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 171 unchanged lines hidden (view full) --- 180 fdp->fd_ofiles[retval[0]] = 0; 181free2: 182 (void)pipeclose(wpipe); 183free1: 184 (void)pipeclose(rpipe); 185 return (error); 186} 187 |
188/* 189 * Allocate kva for pipe circular buffer, the space is pageable 190 */ |
|
188static void 189pipespace(cpipe) 190 struct pipe *cpipe; 191{ 192 int npages, error; 193 194 npages = round_page(cpipe->pipe_buffer.size)/PAGE_SIZE; 195 /* --- 263 unchanged lines hidden (view full) --- 459 460 endaddr = round_page(uio->uio_iov->iov_base + size); 461 for(i = 0, addr = trunc_page(uio->uio_iov->iov_base); 462 addr < endaddr; 463 addr += PAGE_SIZE, i+=1) { 464 465 vm_page_t m; 466 | 191static void 192pipespace(cpipe) 193 struct pipe *cpipe; 194{ 195 int npages, error; 196 197 npages = round_page(cpipe->pipe_buffer.size)/PAGE_SIZE; 198 /* --- 263 unchanged lines hidden (view full) --- 462 463 endaddr = round_page(uio->uio_iov->iov_base + size); 464 for(i = 0, addr = trunc_page(uio->uio_iov->iov_base); 465 addr < endaddr; 466 addr += PAGE_SIZE, i+=1) { 467 468 vm_page_t m; 469 |
467 vm_fault_quick( addr, VM_PROT_READ); | 470 vm_fault_quick( (caddr_t) addr, VM_PROT_READ); |
468 paddr = pmap_kextract(addr); 469 if (!paddr) { 470 int j; 471 for(j=0;j<i;j++) 472 vm_page_unwire(wpipe->pipe_map.ms[j]); 473 return EFAULT; 474 } 475 --- 284 unchanged lines hidden (view full) --- 760 * If we have put any characters in the buffer, we wake up 761 * the reader. 762 */ 763 if (wpipe->pipe_state & PIPE_WANTR) { 764 wpipe->pipe_state &= ~PIPE_WANTR; 765 wakeup(wpipe); 766 } 767 } | 471 paddr = pmap_kextract(addr); 472 if (!paddr) { 473 int j; 474 for(j=0;j<i;j++) 475 vm_page_unwire(wpipe->pipe_map.ms[j]); 476 return EFAULT; 477 } 478 --- 284 unchanged lines hidden (view full) --- 763 * If we have put any characters in the buffer, we wake up 764 * the reader. 765 */ 766 if (wpipe->pipe_state & PIPE_WANTR) { 767 wpipe->pipe_state &= ~PIPE_WANTR; 768 wakeup(wpipe); 769 } 770 } |
771 772 /* 773 * Don't return EPIPE if I/O was successful 774 */ |
|
768 if ((wpipe->pipe_buffer.cnt == 0) && 769 (uio->uio_resid == 0) && 770 (error == EPIPE)) 771 error = 0; 772 773 if (wpipe->pipe_state & PIPE_SEL) { 774 wpipe->pipe_state &= ~PIPE_SEL; 775 selwakeup(&wpipe->pipe_sel); --- 200 unchanged lines hidden --- | 775 if ((wpipe->pipe_buffer.cnt == 0) && 776 (uio->uio_resid == 0) && 777 (error == EPIPE)) 778 error = 0; 779 780 if (wpipe->pipe_state & PIPE_SEL) { 781 wpipe->pipe_state &= ~PIPE_SEL; 782 selwakeup(&wpipe->pipe_sel); --- 200 unchanged lines hidden --- |