summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt23
-rw-r--r--inc/dnbd3/shared/timing.h4
-rw-r--r--src/bench/CMakeLists.txt2
-rw-r--r--src/client/CMakeLists.txt2
-rw-r--r--src/client/client.c1
-rw-r--r--src/fuse/CMakeLists.txt2
-rw-r--r--src/fuse/connection.h1
-rw-r--r--src/shared/CMakeLists.txt2
-rw-r--r--src/shared/sockhelper.c2
9 files changed, 17 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1a91aa..6bf7d0b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,14 +31,18 @@ endif()
if(CMAKE_SYSTEM_NAME MATCHES "BSD")
message(STATUS "Detected BSD System: Disable build of the dnbd3 Linux kernel module")
set(DNBD3_KERNEL_MODULE OFF)
+else(CMAKE_SYSTEM_NAME MATCHES "BSD")
+ # set Linux kernel directories
+ set(KERNEL_BUILD_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/build"
+ CACHE PATH "Path to Linux kernel modules to compile against")
+ set(KERNEL_INSTALL_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/extra"
+ CACHE PATH "Path to install Linux kernel modules")
+
+ # print configured settings
+ message(STATUS "Path to Linux kernel modules to compile against is " ${KERNEL_BUILD_DIR})
+ message(STATUS "Path to install Linux kernel modules is " ${KERNEL_INSTALL_DIR})
endif(CMAKE_SYSTEM_NAME MATCHES "BSD")
-# set Linux kernel directories
-set(KERNEL_BUILD_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/build"
- CACHE PATH "Path to Linux kernel modules to compile against")
-set(KERNEL_INSTALL_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/extra"
- CACHE PATH "Path to install Linux kernel modules")
-
# search for required packages
find_package(Git)
find_package(Threads)
@@ -60,9 +64,6 @@ include(KernelVersion)
# include project version related macros
include(ProjectVersion)
-# get Linux kernel version from path
-get_kernel_version(LINUX_KERNEL_VERSION ${KERNEL_BUILD_DIR})
-
# set include directories
set(PROJECT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inc)
set(PROJECT_INCLUDE_TMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/inc)
@@ -72,10 +73,6 @@ include_directories(${PROJECT_INCLUDE_DIR})
# exposes dnbd3-generate-version and dnbd3-version target
gen_project_version(${PROJECT_INCLUDE_DIR}/dnbd3/version.h.in ${PROJECT_INCLUDE_TMP_DIR}/dnbd3/version.h)
-# print configured settings
-message(STATUS "Path to Linux kernel modules to compile against is " ${KERNEL_BUILD_DIR})
-message(STATUS "Path to install Linux kernel modules is " ${KERNEL_INSTALL_DIR})
-
# add compile option to handle files greater than 2GB on a 32bit system
add_definitions(-D_FILE_OFFSET_BITS=64)
diff --git a/inc/dnbd3/shared/timing.h b/inc/dnbd3/shared/timing.h
index f23bfeb..2530416 100644
--- a/inc/dnbd3/shared/timing.h
+++ b/inc/dnbd3/shared/timing.h
@@ -1,10 +1,6 @@
#ifndef _D_TIMING_H
#define _D_TIMING_H
-#ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 199309L
-#endif
-
#include <time.h>
#include <stdint.h>
#include <stdbool.h>
diff --git a/src/bench/CMakeLists.txt b/src/bench/CMakeLists.txt
index d8a5dc9..57aad92 100644
--- a/src/bench/CMakeLists.txt
+++ b/src/bench/CMakeLists.txt
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.10)
project(dnbd3-bench)
# add compile option to enable enhanced POSIX pthread features
-add_compile_options(-D_GNU_SOURCE)
+add_definitions(-D_GNU_SOURCE)
add_executable(dnbd3-bench ${CMAKE_CURRENT_SOURCE_DIR}/connection.c
${CMAKE_CURRENT_SOURCE_DIR}/helper.c
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
index a7c1eb4..4cc1212 100644
--- a/src/client/CMakeLists.txt
+++ b/src/client/CMakeLists.txt
@@ -7,7 +7,7 @@ project(dnbd3-client)
add_compile_options(-Wno-multichar)
# add compile option to enable enhanced BSD netdb features
-add_compile_options(-D_GNU_SOURCE)
+add_definitions(-D_GNU_SOURCE)
add_executable(dnbd3-client ${CMAKE_CURRENT_SOURCE_DIR}/client.c)
target_link_libraries(dnbd3-client dnbd3-version dnbd3-shared)
diff --git a/src/client/client.c b/src/client/client.c
index 33737fa..e433160 100644
--- a/src/client/client.c
+++ b/src/client/client.c
@@ -33,6 +33,7 @@
#include <arpa/inet.h>
#include <string.h>
#include <sys/stat.h>
+#include <sys/socket.h>
#include <sys/un.h>
#include <errno.h>
diff --git a/src/fuse/CMakeLists.txt b/src/fuse/CMakeLists.txt
index 367356a..1c107ed 100644
--- a/src/fuse/CMakeLists.txt
+++ b/src/fuse/CMakeLists.txt
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.10)
project(dnbd3-fuse)
# add compile option to enable enhanced POSIX pthread features
-add_compile_options(-D_GNU_SOURCE)
+add_definitions(-D_GNU_SOURCE)
add_executable(dnbd3-fuse ${CMAKE_CURRENT_SOURCE_DIR}/connection.c
${CMAKE_CURRENT_SOURCE_DIR}/helper.c
diff --git a/src/fuse/connection.h b/src/fuse/connection.h
index dde6da9..b869ac6 100644
--- a/src/fuse/connection.h
+++ b/src/fuse/connection.h
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
+#include <sys/socket.h>
#define FUSE_USE_VERSION 30
#include <fuse_lowlevel.h>
diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt
index 804d27c..f42b49f 100644
--- a/src/shared/CMakeLists.txt
+++ b/src/shared/CMakeLists.txt
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.10)
project(dnbd3-shared)
# add compile option to get POLLRDHUP support for signals
-add_compile_options(-D_GNU_SOURCE)
+add_definitions(-D_GNU_SOURCE)
add_library(dnbd3-shared STATIC ${CMAKE_CURRENT_SOURCE_DIR}/crc32.c
${CMAKE_CURRENT_SOURCE_DIR}/fdsignal.c
diff --git a/src/shared/sockhelper.c b/src/shared/sockhelper.c
index f218d5a..585afe7 100644
--- a/src/shared/sockhelper.c
+++ b/src/shared/sockhelper.c
@@ -73,7 +73,7 @@ int sock_connect(const dnbd3_host_t * const addr, const int connect_ms, const in
errno = e2;
return -1;
}
- sockaddr_storage junk;
+ struct sockaddr_storage junk;
socklen_t more_junk = sizeof(junk);
if ( getpeername( client_sock, (struct sockaddr*)&junk, &more_junk ) == -1 ) {
e2 = errno;