Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions src/kernel/poller.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/protocol/kafka_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Authors: Wang Zhulei ([email protected])
*/

#include <sys/uio.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/kafka_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 18 additions & 1 deletion tutorial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()

Expand Down