Lines Matching +full:send +full:- +full:empty
1 /*-
45 #include <atf-c.h>
64 ATF_REQUIRE_MSG(socketpair(PF_UNIX, TEST_PROTO, 0, fdp) != -1, in domainsocketpair()
82 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in devnull()
95 ATF_REQUIRE_MSG(fd != -1, "mkstemp(%s) failed", path); in tempfile()
121 ATF_REQUIRE_MSG(rc != -1, "sysctl(KERN_PROC_NFDS) failed"); in getnfds()
143 cm->cmsg_len = CMSG_LEN(nfds * sizeof(int)); in putfds()
144 cm->cmsg_level = SOL_SOCKET; in putfds()
145 cm->cmsg_type = SCM_RIGHTS; in putfds()
154 ATF_REQUIRE_MSG(sb1->st_dev == sb2->st_dev, "different device"); in samefile()
155 ATF_REQUIRE_MSG(sb1->st_ino == sb2->st_ino, "different inode"); in samefile()
202 ATF_REQUIRE_MSG(rc != -1, "getsockopt(LOCAL_CREDS) failed: %s", in localcreds()
232 ATF_REQUIRE_MSG(len != -1, "recvmsg failed: %s", strerror(errno)); in recvfd_payload()
238 *recv_fd = -1; in recvfd_payload()
240 if (cmsghdr->cmsg_level == SOL_SOCKET && in recvfd_payload()
241 cmsghdr->cmsg_type == SCM_RIGHTS && in recvfd_payload()
242 cmsghdr->cmsg_len == CMSG_LEN(sizeof(int))) { in recvfd_payload()
244 ATF_REQUIRE(*recv_fd != -1); in recvfd_payload()
245 } else if (cmsghdr->cmsg_level == SOL_SOCKET && in recvfd_payload()
246 cmsghdr->cmsg_type == SCM_CREDS) in recvfd_payload()
249 ATF_REQUIRE_MSG(*recv_fd != -1, in recvfd_payload()
250 "recvmsg: did not receive single-fd message"); in recvfd_payload()
285 &(size_t){sizeof(u_long)}, NULL, 0) != -1, in getsendspace()
297 &(size_t){sizeof(u_long)}, NULL, 0) != -1, in getrecvspace()
304 * Fill socket to a state when next max sized send would fail with EAGAIN.
315 ATF_REQUIRE_MSG(fcntl(fd, F_SETFL, O_NONBLOCK) != -1, in fill()
319 do {} while (send(fd, buf, sendspace, 0) == (ssize_t)sendspace); in fill()
326 ATF_REQUIRE(send(fd, buf, sendspace, 0) == (ssize_t)sendspace); in fill()
417 * Send file then shutdown receive side to exercise unp_dispose() call
434 ATF_REQUIRE(openfiles() == nfiles - 1); in ATF_TC_BODY()
439 * Send maximum possible SCM_RIGHTS message.
441 * and stored in a single mbuf cluster. Check that we can not send too much
442 * and that we can successfully send maximum possible amount. Check that we
445 #define MAXFDS ((MCLBYTES - _ALIGN(sizeof(struct cmsghdr)))/sizeof(void *))
469 ATF_REQUIRE(sendmsg(fd[0], &msghdr, 0) == -1); in ATF_TC_BODY()
489 ATF_REQUIRE(recvmsg(fd[1], &msghdr, 0) == -1); in ATF_TC_BODY()
509 ATF_REQUIRE(recvmsg(fd[1], &msghdr, MSG_DONTWAIT) == -1); in ATF_TC_BODY()
536 ATF_REQUIRE_MSG(len == -1 && errno == EAGAIN, in ATF_TC_BODY()
539 ATF_REQUIRE_MSG(len == -1 && errno == ENOBUFS, in ATF_TC_BODY()
579 cmsghdr->cmsg_level, cmsghdr->cmsg_type, cmsghdr->cmsg_len); in ATF_TC_BODY()
594 * Send two files. Then receive them. Make sure they are returned in the
624 * Big bundling test. Send an endpoint of the UNIX domain socket over itself,
642 * Big bundling test part two: Send an endpoint of the UNIX domain socket over
657 * Test for PR 151758: Send an character device over the UNIX domain socket
674 * control message to the data. Sender sends large payload using a non-blocking
695 ATF_REQUIRE_MSG(rc != -1, "fcntl(O_NONBLOCK) failed: %s", in ATF_TC_BODY()
698 ATF_REQUIRE_MSG(rc != -1, "setsockopt(LOCAL_CREDS) failed: %s", in ATF_TC_BODY()
702 ATF_REQUIRE_MSG(len != -1 , "sendmsg failed: %s", strerror(errno)); in ATF_TC_BODY()
749 ATF_REQUIRE_MSG(len != -1, in send_cmsg()
774 ATF_REQUIRE_MSG(len != -1, in recv_cmsg()
798 * Case 1: Send a single descriptor and truncate the message. in ATF_TC_BODY()
809 * Case 2a: Send two descriptors in separate messages, and truncate at in ATF_TC_BODY()
825 * Case 2b: Send two descriptors in separate messages, and truncate in ATF_TC_BODY()
838 * Case 2c: Send two descriptors in separate messages, and truncate in ATF_TC_BODY()
855 * Case 3: Send three descriptors in the same message, and leave space in ATF_TC_BODY()
890 ATF_REQUIRE_MSG(len != -1, "sendmsg failed: %s", strerror(errno)); in ATF_TC_BODY()
896 msghdr.msg_control = (char *)-1; /* trigger EFAULT */ in ATF_TC_BODY()
903 ATF_REQUIRE_MSG(len == -1, "recvmsg succeeded: %zd", len); in ATF_TC_BODY()
915 * Verify that we can handle empty rights messages.
937 * Try sending incorrect empty message. On 64-bit platforms, where in ATF_TC_BODY()
951 ATF_REQUIRE(len == -1 && errno == EINVAL); in ATF_TC_BODY()
956 * Try sending an empty message followed by a non-empty message. in ATF_TC_BODY()
959 putfds(cm, -1, 0); in ATF_TC_BODY()
968 /* Only the non-empty message should be received. */ in ATF_TC_BODY()
976 * Now try sending with the non-empty message before the empty message. in ATF_TC_BODY()
981 putfds(cm, -1, 0); in ATF_TC_BODY()
994 /* Only the non-empty message should be received. */ in ATF_TC_BODY()