| 866 | } |
| 867 | |
| 868 | static int |
| 869 | linux2freebsd_msghdr(const struct linux_msghdr *linux_msg, struct msghdr *freebsd_msg, int send_flag) |
| 870 | { |
| 871 | int ret = 0; |
| 872 | |
| 873 | if (linux_msg == NULL || freebsd_msg == NULL) { |
| 874 | return -1;; |
| 875 | } |
| 876 | |
| 877 | if (linux_msg->msg_name && freebsd_msg->msg_name && send_flag) { |
| 878 | linux2freebsd_sockaddr(linux_msg->msg_name, linux_msg->msg_namelen, freebsd_msg->msg_name); |
| 879 | } else { |
| 880 | freebsd_msg->msg_name = linux_msg->msg_name; |
| 881 | } |
| 882 | freebsd_msg->msg_namelen = linux_msg->msg_namelen; |
| 883 | |
| 884 | /* Save the old iov pointer, compatible with the Linux interface */ |
| 885 | msg_iovlen_tmp = linux_msg->msg_iovlen; |
| 886 | if (msg_iovlen_tmp > UIO_MAXIOV) { |
| 887 | return -1; // EMSGSIZE; |
| 888 | } |
| 889 | memcpy(msg_iov_tmp, linux_msg->msg_iov, msg_iovlen_tmp * sizeof(struct iovec)); |
| 890 | freebsd_msg->msg_iov = linux_msg->msg_iov; |
| 891 | freebsd_msg->msg_iovlen = linux_msg->msg_iovlen; |
| 892 | |
| 893 | freebsd_msg->msg_controllen = linux_msg->msg_controllen; |
| 894 | if (linux_msg->msg_control && send_flag) { |
| 895 | ret = linux2freebsd_cmsg(linux_msg, freebsd_msg); |
| 896 | if(ret < 0) { |
| 897 | return ret; |
| 898 | } |
| 899 | } else { |
| 900 | freebsd_msg->msg_control = linux_msg->msg_control; |
| 901 | } |
| 902 | |
| 903 | freebsd_msg->msg_flags = linux_msg->msg_flags; |
| 904 | |
| 905 | return 0; |
| 906 | } |
| 907 | |
| 908 | int |
| 909 | ff_socket(int domain, int type, int protocol) |
no test coverage detected