MCPcopy Create free account
hub / github.com/F-Stack/f-stack / linux2freebsd_msghdr

Function linux2freebsd_msghdr

lib/ff_syscall_wrapper.c:868–906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

866}
867
868static int
869linux2freebsd_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
908int
909ff_socket(int domain, int type, int protocol)

Callers 2

ff_sendmsgFunction · 0.85
ff_recvmsgFunction · 0.85

Calls 3

linux2freebsd_sockaddrFunction · 0.85
linux2freebsd_cmsgFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected