Skip to content

Commit

Permalink
update unix
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAlphaFox committed Nov 29, 2024
1 parent 61358b2 commit 52d3a11
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@ project(czsocket VERSION 1.0.1 DESCRIPTION "socket library for chez scheme")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 17)

add_library(${PROJECT_NAME} SHARED
set(SOURCE_FILES
src/common/base_handler.cpp
src/common/timer_handler.cpp
src/common/io_handler.cpp
src/common/wakeup_handler.cpp
src/common/timer_manager.cpp
src/common/base_engine.cpp
src/reactor.cpp
src/unix/core.cpp
src/unix/pipe.cpp
src/unix/unix_base_engine.cpp
src/unix/select_engine.cpp

)

if(UNIX)
set(SOURCE_FILES
${SOURCE_FILES}
src/unix/core.cpp
src/unix/pipe.cpp
src/unix/unix_base_engine.cpp
src/unix/select_engine.cpp)
endif()

add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})

add_executable(test
src/main.cpp
)
Expand Down
8 changes: 4 additions & 4 deletions src/chez_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#define EV_CLOSED 0x80

#if defined(__linux__) || \
defined(__FreeBSD__) || \
defined(__OpenBSD__) || \
defined(__DragonFly__) || \
defined(__NetBSD__)
defined(__FreeBSD__) || \
defined(__OpenBSD__) || \
defined(__DragonFly__) || \
defined(__NetBSD__)
#define fd_t int
#endif

Expand Down
8 changes: 8 additions & 0 deletions src/reactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@
#include "common/io_handler.h"
#include "common/timer_handler.h"
#include "common/timer_manager.h"

#if defined(__linux__) || \
defined(__FreeBSD__) || \
defined(__OpenBSD__) || \
defined(__DragonFly__) || \
defined(__NetBSD__)
#include "unix/select_engine.h"
#endif

#include "reactor.h"



reactor::reactor()
{
_engine = std::make_shared<select_engine>();
Expand Down
10 changes: 5 additions & 5 deletions src/unix/unix_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ int make_pipe(fd_t fds[2], int read_flags, int write_flags);
#ifndef UNIX_PLATFORM_H
#define UNIX_PLATFORM_H
#if defined(__APPLE__) || \
defined(__DragonFly__) || \
defined(__FreeBSD__) || \
defined(__linux__) || \
defined(__OpenBSD__) || \
defined(__NetBSD__)
defined(__DragonFly__) || \
defined(__FreeBSD__) || \
defined(__linux__) || \
defined(__OpenBSD__) || \
defined(__NetBSD__)
#define mark_nonblock mark_nonblock_ioctl
#else
#define mark_nonblock mark_nonblock_fcntl
Expand Down

0 comments on commit 52d3a11

Please sign in to comment.