mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-09 05:34:31 -04:00
os: Use fallback implementations when *_CLOEXEC are unavailable at build time
On platforms without F_DUPFD_CLOEXEC, MSG_CMSG_CLOEXEC, or SOCK_CLOEXEC, we should skip past their usage and just use the fcntl() fallback. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
parent
aa7c02ff80
commit
b5cb23d698
2 changed files with 10 additions and 3 deletions
|
|
@ -141,10 +141,12 @@ recvmsg(int sockfd, struct msghdr *msg, int flags)
|
|||
{
|
||||
wrapped_calls_recvmsg++;
|
||||
|
||||
#ifdef MSG_CMSG_CLOEXEC
|
||||
if (fall_back && (flags & MSG_CMSG_CLOEXEC)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return real_recvmsg(sockfd, msg, flags);
|
||||
}
|
||||
|
|
@ -342,9 +344,10 @@ do_os_wrappers_recvmsg_cloexec(int n)
|
|||
struct marshal_data data;
|
||||
|
||||
data.nr_fds_begin = count_open_fds();
|
||||
#if HAVE_BROKEN_MSG_CMSG_CLOEXEC
|
||||
#if HAVE_BROKEN_MSG_CMSG_CLOEXEC || !defined(MSG_CMSG_CLOEXEC)
|
||||
/* We call the fallback directly on FreeBSD versions with a broken
|
||||
* MSG_CMSG_CLOEXEC, so we don't call the local recvmsg() wrapper. */
|
||||
* MSG_CMSG_CLOEXEC or platforms without MSG_CMSG_CLOEXEC, so we
|
||||
* don't call the local recvmsg() wrapper. */
|
||||
data.wrapped_calls = 0;
|
||||
#else
|
||||
data.wrapped_calls = n;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue