Lines Matching +full:send +full:- +full:not +full:- +full:empty

1 /*-
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 #include <atf-c.h>
68 ATF_REQUIRE_MSG(socketpair(PF_UNIX, TEST_PROTO, 0, fdp) != -1, in domainsocketpair()
86 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in devnull()
99 ATF_REQUIRE_MSG(fd != -1, "mkstemp(%s) failed", path); in tempfile()
125 ATF_REQUIRE_MSG(rc != -1, "sysctl(KERN_PROC_NFDS) failed"); in getnfds()
147 cm->cmsg_len = CMSG_LEN(nfds * sizeof(int)); in putfds()
148 cm->cmsg_level = SOL_SOCKET; in putfds()
149 cm->cmsg_type = SCM_RIGHTS; in putfds()
158 ATF_REQUIRE_MSG(sb1->st_dev == sb2->st_dev, "different device"); in samefile()
159 ATF_REQUIRE_MSG(sb1->st_ino == sb2->st_ino, "different inode"); in samefile()
206 ATF_REQUIRE_MSG(rc != -1, "getsockopt(LOCAL_CREDS) failed: %s", in localcreds()
236 ATF_REQUIRE_MSG(len != -1, "recvmsg failed: %s", strerror(errno)); in recvfd_payload()
240 "recvmsg: did not receive control message"); in recvfd_payload()
242 *recv_fd = -1; in recvfd_payload()
244 if (cmsghdr->cmsg_level == SOL_SOCKET && in recvfd_payload()
245 cmsghdr->cmsg_type == SCM_RIGHTS && in recvfd_payload()
246 cmsghdr->cmsg_len == CMSG_LEN(sizeof(int))) { in recvfd_payload()
248 ATF_REQUIRE(*recv_fd != -1); in recvfd_payload()
249 } else if (cmsghdr->cmsg_level == SOL_SOCKET && in recvfd_payload()
250 cmsghdr->cmsg_type == SCM_CREDS) in recvfd_payload()
253 ATF_REQUIRE_MSG(*recv_fd != -1, in recvfd_payload()
254 "recvmsg: did not receive single-fd message"); in recvfd_payload()
256 "recvmsg: expected credentials were not received"); in recvfd_payload()
289 &(size_t){sizeof(u_long)}, NULL, 0) != -1, in getsendspace()
301 &(size_t){sizeof(u_long)}, NULL, 0) != -1, in getrecvspace()
308 * Fill socket to a state when next max sized send would fail with EAGAIN.
319 ATF_REQUIRE_MSG(fcntl(fd, F_SETFL, O_NONBLOCK) != -1, in fill()
323 do {} while (send(fd, buf, sendspace, 0) == (ssize_t)sendspace); in fill()
330 ATF_REQUIRE(send(fd, buf, sendspace, 0) == (ssize_t)sendspace); in fill()
376 "FD_CLOEXEC not set on the received file descriptor"); in ATF_TC_BODY()
400 "FD_CLOFORK not set on the received file descriptor"); in ATF_TC_BODY()
445 * Send file then shutdown receive side to exercise unp_dispose() call
462 ATF_REQUIRE(openfiles() == nfiles - 1); in ATF_TC_BODY()
467 * Send maximum possible SCM_RIGHTS message.
469 * and stored in a single mbuf cluster. Check that we can not send too much
470 * and that we can successfully send maximum possible amount. Check that we
471 * can not exploit getrlimit(3).
473 #define MAXFDS ((MCLBYTES - _ALIGN(sizeof(struct cmsghdr)))/sizeof(void *))
497 ATF_REQUIRE(sendmsg(fd[0], &msghdr, 0) == -1); in ATF_TC_BODY()
517 ATF_REQUIRE(recvmsg(fd[1], &msghdr, 0) == -1); in ATF_TC_BODY()
525 * shall bring us the normal data only. The stream data shall not in ATF_TC_BODY()
537 ATF_REQUIRE(recvmsg(fd[1], &msghdr, MSG_DONTWAIT) == -1); in ATF_TC_BODY()
564 ATF_REQUIRE_MSG(len == -1 && errno == EAGAIN, in ATF_TC_BODY()
567 ATF_REQUIRE_MSG(len == -1 && errno == ENOBUFS, in ATF_TC_BODY()
576 * Make sure that we do not receive descriptors with MSG_PEEK.
607 cmsghdr->cmsg_level, cmsghdr->cmsg_type, cmsghdr->cmsg_len); in ATF_TC_BODY()
610 /* ... and make sure we did not receive any descriptors! */ in ATF_TC_BODY()
622 * Send two files. Then receive them. Make sure they are returned in the
652 * Big bundling test. Send an endpoint of the UNIX domain socket over itself,
670 * Big bundling test part two: Send an endpoint of the UNIX domain socket over
685 * Test for PR 151758: Send an character device over the UNIX domain socket
702 * control message to the data. Sender sends large payload using a non-blocking
723 ATF_REQUIRE_MSG(rc != -1, "fcntl(O_NONBLOCK) failed: %s", in ATF_TC_BODY()
726 ATF_REQUIRE_MSG(rc != -1, "setsockopt(LOCAL_CREDS) failed: %s", in ATF_TC_BODY()
730 ATF_REQUIRE_MSG(len != -1 , "sendmsg failed: %s", strerror(errno)); in ATF_TC_BODY()
777 ATF_REQUIRE_MSG(len != -1, in send_cmsg()
802 ATF_REQUIRE_MSG(len != -1, in recv_cmsg()
813 * The kernel must not leak the copied right into the receiver's namespace.
826 * Case 1: Send a single descriptor and truncate the message. in ATF_TC_BODY()
837 * Case 2a: Send two descriptors in separate messages, and truncate at in ATF_TC_BODY()
853 * Case 2b: Send two descriptors in separate messages, and truncate in ATF_TC_BODY()
866 * Case 2c: Send two descriptors in separate messages, and truncate in ATF_TC_BODY()
883 * Case 3: Send three descriptors in the same message, and leave space in ATF_TC_BODY()
918 ATF_REQUIRE_MSG(len != -1, "sendmsg failed: %s", strerror(errno)); in ATF_TC_BODY()
924 msghdr.msg_control = (char *)-1; /* trigger EFAULT */ in ATF_TC_BODY()
931 ATF_REQUIRE_MSG(len == -1, "recvmsg succeeded: %zd", len); in ATF_TC_BODY()
943 * Verify that we can handle empty rights messages.
965 * Try sending incorrect empty message. On 64-bit platforms, where in ATF_TC_BODY()
970 .cmsg_len = sizeof(struct cmsghdr), /* not CMSG_LEN(0)! */ in ATF_TC_BODY()
979 ATF_REQUIRE(len == -1 && errno == EINVAL); in ATF_TC_BODY()
984 * Try sending an empty message followed by a non-empty message. in ATF_TC_BODY()
987 putfds(cm, -1, 0); in ATF_TC_BODY()
996 /* Only the non-empty message should be received. */ in ATF_TC_BODY()
1004 * Now try sending with the non-empty message before the empty message. in ATF_TC_BODY()
1009 putfds(cm, -1, 0); in ATF_TC_BODY()
1022 /* Only the non-empty message should be received. */ in ATF_TC_BODY()
1115 if (len == -1) in ATF_TC_BODY()
1135 if (len == -1) in ATF_TC_BODY()
1139 errx(1, "dfd does not have FD_RESOLVE_BENEATH set"); in ATF_TC_BODY()
1164 errx(1, "dfd2 does not have FD_RESOLVE_BENEATH set"); in ATF_TC_BODY()
1170 ATF_REQUIRE(error != -1); in ATF_TC_BODY()
1174 ATF_REQUIRE(error != -1); in ATF_TC_BODY()