optimizing fiber module

This commit is contained in:
zhengshuxin 2021-08-18 16:32:34 +08:00
parent 1f013d27e4
commit 099b658685
5 changed files with 10 additions and 4 deletions

View File

@ -3,6 +3,7 @@
#include "dns/resolver.h"
#include "common.h"
#include "fiber.h"
#include "hook.h"
#ifdef SYS_UNIX

View File

@ -29,13 +29,13 @@ typedef int (WINAPI *select_fn)(int, fd_set *, fd_set *,
fd_set *, const struct timeval *);
#elif defined(SYS_UNIX)
typedef int (*setsockopt_fn)(socket_t, int, int, const void *, socklen_t);
typedef unsigned (*sleep_fn)(unsigned int seconds);
typedef ssize_t (*read_fn)(socket_t, void *, size_t);
typedef ssize_t (*readv_fn)(socket_t, const struct iovec *, int);
typedef ssize_t (*recv_fn)(socket_t, void *, size_t, int);
typedef ssize_t (*recvfrom_fn)(socket_t, void *, size_t, int,
struct sockaddr *, socklen_t *);
typedef ssize_t (*recvmsg_fn)(socket_t, struct msghdr *, int);
typedef ssize_t (*write_fn)(socket_t, const void *, size_t);
typedef ssize_t (*writev_fn)(socket_t, const struct iovec *, int);
@ -76,6 +76,7 @@ extern accept_fn __sys_accept;
extern connect_fn __sys_connect;
extern recv_fn __sys_recv;
extern recvfrom_fn __sys_recvfrom;
extern send_fn __sys_send;

View File

@ -126,7 +126,7 @@ CFLAGS += -I./src -I../c/include -I./include -I../../lib_acl/include -I../../li
#Project's objs
SRC = $(wildcard src/*.cpp) $(wildcard src/*/*.cpp)
SRC = $(wildcard src/*.cpp) $(wildcard src/keeper/*.cpp)
OBJ = $(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(SRC)))
###########################################################

View File

@ -1,8 +1,8 @@
#include "stdafx.hpp"
#include "detours/detours.h"
#include "winapi_hook.hpp"
#if (defined(_WIN32) || defined(_WIN64)) && _MSC_VER >= 1911
#include "detours/detours.h"
SOCKET_FN __socket = socket;
LISTEN_FN __listen = listen;
@ -57,4 +57,4 @@ bool winapi_hook(void) {
return true;
}
#endif
#endif

View File

@ -4,6 +4,10 @@
extern "C" {
#endif
#if !defined(_WIN32) && !defined(_WIN64)
# define WINAPI
#endif
typedef socket_t (WINAPI* SOCKET_FN)(int, int, int);
typedef int (WINAPI* LISTEN_FN)(socket_t, int);
typedef int (WINAPI* CLOSE_FN)(socket_t);