Diff reduce with upstream
Use CMSG_FIRSTHDR macro to properly link the kqueue to the socket to get it to now return -1/EBADF with sendmsg per the testcase expectations
This commit is contained in:
parent
5aa3a5ea8a
commit
490cf9a071
@ -117,15 +117,9 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
|
||||
if (recvmsg(s[1], &m, 0) == -1)
|
||||
err(1, "child: could not recvmsg");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
bcopy(CMSG_DATA(msg), &kq, sizeof(kq));
|
||||
printf("child (pid %d): received kq fd %d\n", getpid(), kq);
|
||||
_exit(0);
|
||||
#else
|
||||
kq = *(int *)CMSG_DATA(msg);
|
||||
printf("child (pid %d): received kq fd %d\n", getpid(), kq);
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
close(s[1]);
|
||||
@ -133,33 +127,21 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
|
||||
iov.iov_base = &storage;
|
||||
iov.iov_len = sizeof(int);
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
msg = CMSG_FIRSTHDR(&m);
|
||||
#endif
|
||||
msg->cmsg_level = SOL_SOCKET;
|
||||
msg->cmsg_type = SCM_RIGHTS;
|
||||
msg->cmsg_len = CMSG_LEN(sizeof(int));
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/*
|
||||
* What is should have been
|
||||
* bcopy(&s[0], CMSG_DATA(msg), sizeof(kq));
|
||||
*/
|
||||
bcopy(&kq, CMSG_DATA(msg), sizeof(kq));
|
||||
#else
|
||||
*(int *)CMSG_DATA(msg) = kq;
|
||||
#endif
|
||||
|
||||
EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0);
|
||||
EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0);
|
||||
ATF_CHECK(kevent(kq, &ev, 1, NULL, 0, NULL) != -1);
|
||||
|
||||
printf("parent (pid %d): sending kq fd %d\n", getpid(), kq);
|
||||
if (sendmsg(s[0], &m, 0) == -1) {
|
||||
#ifdef __NetBSD__
|
||||
ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno);
|
||||
atf_tc_skip("PR kern/46523");
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno);
|
||||
close(s[0]);
|
||||
#endif
|
||||
}
|
||||
|
||||
close(kq);
|
||||
|
Loading…
x
Reference in New Issue
Block a user