| 802 | } |
| 803 | |
| 804 | static int |
| 805 | soo_aio_queue(struct file *fp, struct kaiocb *job) |
| 806 | { |
| 807 | struct socket *so; |
| 808 | struct sockbuf *sb; |
| 809 | int error; |
| 810 | |
| 811 | so = fp->f_data; |
| 812 | error = (*so->so_proto->pr_usrreqs->pru_aio_queue)(so, job); |
| 813 | if (error == 0) |
| 814 | return (0); |
| 815 | |
| 816 | switch (job->uaiocb.aio_lio_opcode & (LIO_WRITE | LIO_READ)) { |
| 817 | case LIO_READ: |
| 818 | sb = &so->so_rcv; |
| 819 | break; |
| 820 | case LIO_WRITE: |
| 821 | sb = &so->so_snd; |
| 822 | break; |
| 823 | default: |
| 824 | return (EINVAL); |
| 825 | } |
| 826 | |
| 827 | SOCKBUF_LOCK(sb); |
| 828 | if (!aio_set_cancel_function(job, soo_aio_cancel)) |
| 829 | panic("new job was cancelled"); |
| 830 | TAILQ_INSERT_TAIL(&sb->sb_aiojobq, job, list); |
| 831 | if (!(sb->sb_flags & SB_AIO_RUNNING)) { |
| 832 | if (soaio_ready(so, sb)) |
| 833 | sowakeup_aio(so, sb); |
| 834 | else |
| 835 | sb->sb_flags |= SB_AIO; |
| 836 | } |
| 837 | SOCKBUF_UNLOCK(sb); |
| 838 | return (0); |
| 839 | } |
| 840 | #endif |
nothing calls this directly
no test coverage detected