| 5450 | } |
| 5451 | |
| 5452 | int |
| 5453 | sctp_sorecvmsg(struct socket *so, |
| 5454 | struct uio *uio, |
| 5455 | struct mbuf **mp, |
| 5456 | struct sockaddr *from, |
| 5457 | int fromlen, |
| 5458 | int *msg_flags, |
| 5459 | struct sctp_sndrcvinfo *sinfo, |
| 5460 | int filling_sinfo) |
| 5461 | { |
| 5462 | /* |
| 5463 | * MSG flags we will look at MSG_DONTWAIT - non-blocking IO. |
| 5464 | * MSG_PEEK - Look don't touch :-D (only valid with OUT mbuf copy |
| 5465 | * mp=NULL thus uio is the copy method to userland) MSG_WAITALL - ?? |
| 5466 | * On the way out we may send out any combination of: |
| 5467 | * MSG_NOTIFICATION MSG_EOR |
| 5468 | * |
| 5469 | */ |
| 5470 | struct sctp_inpcb *inp = NULL; |
| 5471 | ssize_t my_len = 0; |
| 5472 | ssize_t cp_len = 0; |
| 5473 | int error = 0; |
| 5474 | struct sctp_queued_to_read *control = NULL, *ctl = NULL, *nxt = NULL; |
| 5475 | struct mbuf *m = NULL; |
| 5476 | struct sctp_tcb *stcb = NULL; |
| 5477 | int wakeup_read_socket = 0; |
| 5478 | int freecnt_applied = 0; |
| 5479 | int out_flags = 0, in_flags = 0; |
| 5480 | int block_allowed = 1; |
| 5481 | uint32_t freed_so_far = 0; |
| 5482 | ssize_t copied_so_far = 0; |
| 5483 | int in_eeor_mode = 0; |
| 5484 | int no_rcv_needed = 0; |
| 5485 | uint32_t rwnd_req = 0; |
| 5486 | int hold_sblock = 0; |
| 5487 | int hold_rlock = 0; |
| 5488 | ssize_t slen = 0; |
| 5489 | uint32_t held_length = 0; |
| 5490 | int sockbuf_lock = 0; |
| 5491 | |
| 5492 | if (uio == NULL) { |
| 5493 | SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); |
| 5494 | return (EINVAL); |
| 5495 | } |
| 5496 | |
| 5497 | if (msg_flags) { |
| 5498 | in_flags = *msg_flags; |
| 5499 | if (in_flags & MSG_PEEK) |
| 5500 | SCTP_STAT_INCR(sctps_read_peeks); |
| 5501 | } else { |
| 5502 | in_flags = 0; |
| 5503 | } |
| 5504 | slen = uio->uio_resid; |
| 5505 | |
| 5506 | /* Pull in and set up our int flags */ |
| 5507 | if (in_flags & MSG_OOB) { |
| 5508 | /* Out of band's NOT supported */ |
| 5509 | return (EOPNOTSUPP); |
no test coverage detected