From 31f9f6f6c1d0cf6db8d466b20d47434cefd14d16 Mon Sep 17 00:00:00 2001 From: Michael Tuexen <tuexen@fh-muenster.de> Date: Fri, 8 Mar 2019 17:04:53 +0100 Subject: [PATCH] Improve compilation on Mac OS X. --- gtests/net/packetdrill/run_system_call.c | 6 ++++-- gtests/net/packetdrill/symbols_darwin.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index 01e0a80d..b8f88c6b 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -76,7 +76,7 @@ struct sctp_tlv { u32 sn_length; }; #endif -#if defined(__FreeBSD__) || defined(linux) || (defined(__APPLE__) && defined(HAVE_SCTP)) || defined(__SunOS_5_11) +#if defined(__FreeBSD__) || defined(linux) || (defined(__APPLE__) && defined(HAVE_SCTP) && defined(MSG_NOTIFICATION)) || defined(__SunOS_5_11) static int check_sctp_notification(struct socket *socket, struct iovec *iov, struct expression *iovec_expr, char **error); static int parse_expression_to_sctp_initmsg(struct expression *expr, struct sctp_initmsg *init, @@ -2458,7 +2458,7 @@ static int syscall_recvmsg(struct state *state, struct syscall_spec *syscall, expected_msg_flags, msg->msg_flags); goto error_out; } -#if defined(__FreeBSD__) || defined(linux) || (defined(__APPLE__) && defined(HAVE_SCTP)) || defined(__SunOS_5_11) +#if defined(__FreeBSD__) || defined(linux) || (defined(__APPLE__) && defined(HAVE_SCTP) && defined(MSG_NOTIFICATION)) || defined(__SunOS_5_11) if (msg->msg_flags & MSG_NOTIFICATION) { struct socket *socket = find_socket_by_script_fd(state, script_fd); if (check_sctp_notification(socket, msg->msg_iov, msg_expression->value.msghdr->msg_iov, error)) @@ -6522,10 +6522,12 @@ static int syscall_sctp_recvv(struct state *state, struct syscall_spec *syscall, asprintf(error, "sctp_recvv flags bad return value. expected %d, actual %d", script_flags, flags); goto error_out; +#if defined(MSG_NOTIFICATION) } else if (flags & MSG_NOTIFICATION) { struct socket *socket = find_socket_by_script_fd(state, script_fd); if (check_sctp_notification(socket, iov, iovec_expr_list, error)) goto error_out; +#endif } } free(from); diff --git a/gtests/net/packetdrill/symbols_darwin.c b/gtests/net/packetdrill/symbols_darwin.c index 9e6b035a..fe3c75b8 100644 --- a/gtests/net/packetdrill/symbols_darwin.c +++ b/gtests/net/packetdrill/symbols_darwin.c @@ -495,7 +495,9 @@ struct int_symbol platform_symbols_table[] = { { MSG_HAVEMORE, "MSG_HAVEMORE" }, { MSG_RCVMORE, "MSG_RCVMORE" }, { MSG_NEEDSA, "MSG_NEEDSA" }, - +#if defined(MSG_NOTIFICATION) + { MSG_NOTIFICATION, "MSG_NOTIFICATION" }, +#endif /* /usr/include/sys/filio.h */ { FIOCLEX, "FIOCLEX" }, { FIONCLEX, "FIONCLEX" }, -- GitLab