| 511 | #endif |
| 512 | |
| 513 | int |
| 514 | sys_pipe2(struct thread *td, struct pipe2_args *uap) |
| 515 | { |
| 516 | int error, fildes[2]; |
| 517 | |
| 518 | if (uap->flags & ~(O_CLOEXEC | O_NONBLOCK)) |
| 519 | return (EINVAL); |
| 520 | error = kern_pipe(td, fildes, uap->flags, NULL, NULL); |
| 521 | if (error) |
| 522 | return (error); |
| 523 | error = copyout(fildes, uap->fildes, 2 * sizeof(int)); |
| 524 | if (error) { |
| 525 | (void)kern_close(td, fildes[0]); |
| 526 | (void)kern_close(td, fildes[1]); |
| 527 | } |
| 528 | return (error); |
| 529 | } |
| 530 | |
| 531 | /* |
| 532 | * Allocate kva for pipe circular buffer, the space is pageable |
nothing calls this directly
no test coverage detected