mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-06 18:52:33 +00:00
Minor compatibility with FreeBSD system
Some additional header are needed to avoid undefined types. SOL_TCP and IPPROTO_TCP have the same value in Linux but SOL_TCP is not defined in FreeBSD. Provide pthread_setname_np using pthread_set_name_np (same parameters). Patch is based on a patch from Oleg Ginzburg <olevole@olevole.ru> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
parent
aac2460164
commit
7a25e46c8b
@ -49,7 +49,7 @@ AM_PROG_CC_C_O
|
||||
AC_C_BIGENDIAN
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
AC_CHECK_HEADERS([sys/time.h execinfo.h linux/sockios.h])
|
||||
AC_CHECK_HEADERS([sys/time.h execinfo.h linux/sockios.h pthread_np.h])
|
||||
AC_CHECK_DECL([TCP_KEEPIDLE], [have_tcp_keepidle="yes"],,
|
||||
[#include <netinet/tcp.h>])
|
||||
AS_IF([test "x$have_tcp_keepidle" = "xyes"],
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sys/socket.h>
|
||||
@ -54,7 +57,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
|
||||
}
|
||||
|
||||
#ifdef HAVE_TCP_KEEPIDLE
|
||||
if (setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
|
||||
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
|
||||
if (errno != ENOTSUP) {
|
||||
spice_printerr("setsockopt for keepalive timeout failed, %s", strerror(errno));
|
||||
return false;
|
||||
|
||||
@ -47,6 +47,12 @@
|
||||
#include "cursor-channel.h"
|
||||
#include "tree.h"
|
||||
|
||||
// compatibility for FreeBSD
|
||||
#ifdef HAVE_PTHREAD_NP_H
|
||||
#include <pthread_np.h>
|
||||
#define pthread_setname_np pthread_set_name_np
|
||||
#endif
|
||||
|
||||
#define CMD_RING_POLL_TIMEOUT 10 //milli
|
||||
#define CMD_RING_POLL_RETRIES 1
|
||||
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <wait.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user