Re: [PATCH spice-server] Minor compatibility with FreeBSD system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

Might have been worth splitting this a bit. Regardless of that, looks
goodh to me,
Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

On Wed, Jan 10, 2018 at 08:51:16AM +0000, Frediano Ziglio wrote:
> 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@xxxxxxxxxx>
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  configure.ac                     | 2 +-
>  server/net-utils.c               | 5 ++++-
>  server/red-worker.c              | 6 ++++++
>  server/sound.c                   | 2 ++
>  server/tests/test-display-base.c | 2 +-
>  5 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 9e4868bcc..9eb9bb492 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -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"],
> diff --git a/server/net-utils.c b/server/net-utils.c
> index 06fb8b137..90dbbed57 100644
> --- a/server/net-utils.c
> +++ b/server/net-utils.c
> @@ -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;
> diff --git a/server/red-worker.c b/server/red-worker.c
> index 21622b1e3..387f500e8 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -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
>  
> diff --git a/server/sound.c b/server/sound.c
> index 68f3484d2..8ba2485ce 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -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>
> diff --git a/server/tests/test-display-base.c b/server/tests/test-display-base.c
> index c74a2289b..a86a8b67a 100644
> --- a/server/tests/test-display-base.c
> +++ b/server/tests/test-display-base.c
> @@ -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>
> -- 
> 2.14.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]