| 1168 | #endif |
| 1169 | |
| 1170 | int |
| 1171 | sys_recvmsg(struct thread *td, struct recvmsg_args *uap) |
| 1172 | { |
| 1173 | struct msghdr msg; |
| 1174 | struct iovec *uiov, *iov; |
| 1175 | int error; |
| 1176 | |
| 1177 | error = copyin(uap->msg, &msg, sizeof (msg)); |
| 1178 | if (error != 0) |
| 1179 | return (error); |
| 1180 | error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); |
| 1181 | if (error != 0) |
| 1182 | return (error); |
| 1183 | msg.msg_flags = uap->flags; |
| 1184 | #ifdef COMPAT_OLDSOCK |
| 1185 | if (SV_PROC_FLAG(td->td_proc, SV_AOUT)) |
| 1186 | msg.msg_flags &= ~MSG_COMPAT; |
| 1187 | #endif |
| 1188 | uiov = msg.msg_iov; |
| 1189 | msg.msg_iov = iov; |
| 1190 | error = recvit(td, uap->s, &msg, NULL); |
| 1191 | if (error == 0) { |
| 1192 | msg.msg_iov = uiov; |
| 1193 | error = copyout(&msg, uap->msg, sizeof(msg)); |
| 1194 | } |
| 1195 | free(iov, M_IOV); |
| 1196 | return (error); |
| 1197 | } |
| 1198 | |
| 1199 | int |
| 1200 | sys_shutdown(struct thread *td, struct shutdown_args *uap) |