mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
Fix errors on FreeBSD. (#1760)
This commit is contained in:
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -62,8 +62,10 @@ jobs:
|
||||
copyback: false
|
||||
prepare: |
|
||||
pkg update -f
|
||||
pkg install -y cmake gmake gcc pkgconf openssl
|
||||
pkg install -y cmake gmake gcc pkgconf openssl devel/googletest
|
||||
pkg install -y snappy zstd liblz4
|
||||
run: |
|
||||
freebsd-version
|
||||
gmake
|
||||
gmake tutorial
|
||||
gmake KAFKA=y
|
||||
gmake check KAFKA=y
|
||||
gmake tutorial KAFKA=y
|
||||
|
||||
@@ -231,15 +231,17 @@ static int __poller_set_timerfd(int fd, const struct timespec *abstime,
|
||||
|
||||
if (abstime->tv_sec || abstime->tv_nsec)
|
||||
{
|
||||
flags = EV_ADD;
|
||||
clock_gettime(CLOCK_MONOTONIC, &curtime);
|
||||
nseconds = 1000000000LL * (abstime->tv_sec - curtime.tv_sec);
|
||||
nseconds += abstime->tv_nsec - curtime.tv_nsec;
|
||||
flags = EV_ADD;
|
||||
if (nseconds < 0)
|
||||
nseconds = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
nseconds = 0;
|
||||
flags = EV_DELETE;
|
||||
nseconds = 0;
|
||||
}
|
||||
|
||||
EV_SET(&ev, fd, EVFILT_TIMER, flags, NOTE_NSECONDS, nseconds, NULL);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
Authors: Wang Zhulei (wangzhulei@sogou-inc.com)
|
||||
*/
|
||||
|
||||
#include <sys/uio.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef _KAFKA_PARSER_H_
|
||||
#define _KAFKA_PARSER_H_
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/uio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "list.h"
|
||||
|
||||
@@ -107,9 +107,26 @@ endif()
|
||||
if (KAFKA STREQUAL "y")
|
||||
add_executable("kafka_cli" "tutorial-13-kafka_cli.cc")
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_path(SNAPPY_INCLUDE_PATH NAMES snappy.h)
|
||||
find_library(SNAPPY_LIB NAMES snappy)
|
||||
find_library(LZ4_LIB NAMES lz4)
|
||||
if ((NOT SNAPPY_INCLUDE_PATH) OR (NOT SNAPPY_LIB))
|
||||
message(FATAL_ERROR "Fail to find snappy with KAFKA=y")
|
||||
endif ()
|
||||
include_directories(${SNAPPY_INCLUDE_PATH})
|
||||
|
||||
find_path(ZSTD_INCLUDE_PATH NAMES zstd.h)
|
||||
find_library(ZSTD_LIB NAMES zstd)
|
||||
if ((NOT ZSTD_INCLUDE_PATH) OR (NOT ZSTD_LIB))
|
||||
message(FATAL_ERROR "Fail to find zstd with KAFKA=y")
|
||||
endif ()
|
||||
include_directories(${ZSTD_INCLUDE_PATH})
|
||||
|
||||
find_path(LZ4_INCLUDE_PATH NAMES lz4.h)
|
||||
find_library(LZ4_LIB NAMES lz4)
|
||||
if ((NOT LZ4_INCLUDE_PATH) OR (NOT LZ4_LIB))
|
||||
message(FATAL_ERROR "Fail to find lz4 with KAFKA=y")
|
||||
endif ()
|
||||
include_directories(${LZ4_INCLUDE_PATH})
|
||||
target_link_libraries("kafka_cli" ${WFKAFKA_LIB} ${LIB} ZLIB::ZLIB ${SNAPPY_LIB} ${LZ4_LIB} ${ZSTD_LIB})
|
||||
endif ()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user