compiling
This commit is contained in:
parent
0b4a609064
commit
3889536160
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.10.0)
|
||||
cmake_minimum_required(VERSION 3.18.0)
|
||||
project(ppd)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
@ -10,34 +10,30 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/msg/msg.pb.cc
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS True)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
pkg_check_modules(bsock REQUIRED bsock)
|
||||
|
||||
set(CFLAGS -Wall -Wextra -Werror -std=c++17 -O3 -g)
|
||||
|
||||
# if (${ENABLE_FSTACK} MATCHES "y")
|
||||
# pkg_check_modules(dpdk REQUIRED libdpdk)
|
||||
# pkg_check_modules(bsdtopo REQUIRED bsdtopo)
|
||||
# pkg_check_modules(ssl REQUIRED libssl)
|
||||
# include_directories(${dpdk_INCLUDE_DIRS})
|
||||
# include_directories(${ssl_INCLUDE_DIRS})
|
||||
# include_directories(${bsdtopo_INCLUDE_DIRS})
|
||||
# endif()
|
||||
|
||||
|
||||
set(CFLAGS -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -std=c++17 -O2 -g)
|
||||
add_library(common OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/common/io.cc)
|
||||
target_link_directories(common PRIVATE ${bsock_LIBRARY_DIRS})
|
||||
target_link_libraries(common ${bsock_LIBRARIES})
|
||||
target_compile_options(common PRIVATE ${CFLAGS})
|
||||
target_include_directories(common PRIVATE ${bsock_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
add_executable(dsmbr ${CMAKE_CURRENT_SOURCE_DIR}/dsmbr/dsmbr.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common/io.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dsmbr/dmsg.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dsmbr/generator.cc)
|
||||
target_link_libraries(dsmbr pthread bsock)
|
||||
target_compile_options(dsmbr PRIVATE ${CFLAGS} ${bsock_CFLAGS})
|
||||
target_include_directories(dsmbr PRIVATE ${bsock_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_link_libraries(dsmbr common pthread OpenSSL::SSL ${bsock_LIBRARIES})
|
||||
target_link_directories(dsmbr PRIVATE ${bsock_LIBRARY_DIRS})
|
||||
target_compile_options(dsmbr PRIVATE ${CFLAGS})
|
||||
target_include_directories(dsmbr PRIVATE ${bsock_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
add_executable(ppd ${CMAKE_CURRENT_SOURCE_DIR}/ppd/ppd.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common/io.cc)
|
||||
target_link_libraries(ppd pthread bsock)
|
||||
target_compile_options(ppd PRIVATE ${CFLAGS} ${bsock_CFLAGS})
|
||||
target_include_directories(ppd PRIVATE ${bsock_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
add_executable(ppd ${CMAKE_CURRENT_SOURCE_DIR}/ppd/ppd.cc)
|
||||
target_link_libraries(ppd pthread common OpenSSL::SSL ${bsock_LIBRARIES})
|
||||
target_link_directories(ppd PRIVATE ${bsock_LIBRARY_DIRS})
|
||||
target_compile_options(ppd PRIVATE ${CFLAGS})
|
||||
target_include_directories(ppd PRIVATE ${bsock_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
# if (${ENABLE_FSTACK} MATCHES "y")
|
||||
# add_executable(ppd_ff ${CMAKE_CURRENT_SOURCE_DIR}/ppd_ff/ppd.cc
|
||||
|
@ -103,8 +103,8 @@ struct dsmbr_options {
|
||||
char output_file[128];
|
||||
cpuset_t cpuset;
|
||||
char module_path[128];
|
||||
char mod_argk[MAX_MOD_ARGS][64];
|
||||
char mod_argv[MAX_MOD_ARGS][64];
|
||||
char mod_argk[MAX_MOD_ARGS][MAX_MOD_ARG_LEN];
|
||||
char mod_argv[MAX_MOD_ARGS][MAX_MOD_ARG_LEN];
|
||||
int mod_argc;
|
||||
int enable_tls;
|
||||
int master_mode;
|
||||
@ -220,7 +220,6 @@ static struct dsmbr_conn *
|
||||
dsmbr_conn_create(void *thrd_ctx)
|
||||
{
|
||||
struct sockaddr_in server_addr;
|
||||
SSL *ssl = nullptr;
|
||||
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_port = htons(options.server_port);
|
||||
@ -350,7 +349,6 @@ dsmbr_worker_main(void *ctx)
|
||||
V("Thread %d starting...\n", tinfo->tid);
|
||||
while (true) {
|
||||
int ret = 0;
|
||||
struct kevent kev;
|
||||
|
||||
if (options.state.load(std::memory_order_relaxed) == STATE_STOP) {
|
||||
break;
|
||||
|
@ -49,7 +49,7 @@ Generator* createGenerator(std::string str) {
|
||||
if (t_ptr == NULL) // || a_ptr == NULL)
|
||||
DIE("strtok(.., \":\") failed to parse %s", str.c_str());
|
||||
|
||||
char t = t_ptr[0];
|
||||
// char t = t_ptr[0];
|
||||
|
||||
saveptr = NULL;
|
||||
char *s1 = strtok_r(a_ptr, ",", &saveptr);
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
virtual ~Generator() {}
|
||||
|
||||
virtual double generate(double U = -1.0) = 0;
|
||||
virtual void set_lambda(double lambda) {DIE("set_lambda() not implemented");}
|
||||
virtual void set_lambda(__attribute__((unused)) double lambda) { DIE("set_lambda() not implemented");}
|
||||
protected:
|
||||
std::string type;
|
||||
};
|
||||
@ -59,7 +59,7 @@ protected:
|
||||
class Fixed : public Generator {
|
||||
public:
|
||||
Fixed(double _value = 1.0) : value(_value) { D("Fixed(%f)", value); }
|
||||
virtual double generate(double U = -1.0) { return value; }
|
||||
virtual double generate(__attribute__((unused)) double U = -1.0) { return value; }
|
||||
virtual void set_lambda(double lambda) {
|
||||
if (lambda > 0.0) value = 1.0 / lambda;
|
||||
else value = 0.0;
|
||||
|
Loading…
Reference in New Issue
Block a user