Skip to content
Snippets Groups Projects
Commit 6614962b authored by Florian Fischer's avatar Florian Fischer
Browse files

fixup! export async functions to C

parent 75bef808
No related branches found
No related tags found
No related merge requests found
#include "emper.h"
#include "emper-config.h"
#include "Runtime.hpp"
#include "Fiber.hpp"
#include "BinaryPrivateSemaphore.hpp"
......@@ -101,38 +102,38 @@ void wait_cps(cps* sem) {
}
#ifdef EMPER_ASYNC_NETWORK
int async_recv(int fd, unsigned char* buff, int buff_len, int flags) {
bool read_once = flags & READ_FULL_BUFFER == 0;
bool fd_serialized = flags & UNSERIALIZED == 0;
int async_recv(int fd, void* buff, int buff_len, int flags) {
bool read_once = (flags & READ_FULL_BUFFER) == 0;
bool fd_serialized = (flags & UNSERIALIZED) == 0;
return io::async_recv(fd, buff, buff_len, read_once, fd_serialized);
return io::async_recv(fd, (unsigned char*)buff, buff_len, read_once, fd_serialized);
}
int async_send(int fd, unsigned char* buff, int buff_len, int flags) {
bool fd_serialized = flags & UNSERIALIZED == 0;
int async_send(int fd, const void* buff, int buff_len, int flags) {
bool fd_serialized = (flags & UNSERIALIZED) == 0;
return io::async_recv(fd, buff, buff_len, read_once, fd_serialized);
return io::async_send(fd, (unsigned char*)buff, buff_len, fd_serialized);
}
int async_connect(int fd, sockaddr* sockaddress, socklen_t len, int flags) {
bool fd_serialized = flags & UNSERIALIZED == 0;
int async_connect(int fd, struct sockaddr* sockaddress, size_t len, int flags) {
bool fd_serialized = (flags & UNSERIALIZED) == 0;
return io::async_connect(fd, sockaddress, len, fd_serialized);
}
int async_accept(int fd, sockaddr* sockaddress, socklen_t len, int flags) {
bool fd_serialized = flags & UNSERIALIZED == 0;
int async_accept(int fd, struct sockaddr* sockaddress, size_t len, int flags) {
bool fd_serialized = (flags & UNSERIALIZED) == 0;
return io::async_accept(fd, sockaddress, len, fd_serialized);
}
#endif
#ifdef EMPER_ASYNC_DISK_IO
int async_read_file(int fd, unsigned char* buff, size_t count, off_t offset) {
int async_read_file(int fd, void* buff, size_t count, off_t offset) {
return io::async_read_file(fd, buff, count, offset);
}
int async_write_file(int fd, const unsigned char* buff, size_t count, off_t offset) {
int async_write_file(int fd, const void* buff, size_t count, off_t offset) {
return io::async_write_file(fd, buff, count, offset);
}
#endif
#pragma once
#include "emper-common.h"
#include "emper-config.h"
#include "stddef.h"
#ifdef EMPER_ASYNC_NETWORK
#include "sys/socket.h"
......@@ -66,19 +68,19 @@ extern "C" {
UNSERIALIZED = 2,
};
int async_recv(int fd, unsigned char* buff, int buff_len, int flags);
int async_recv(int fd, void* buff, int buff_len, int flags);
int async_send(int fd, unsigned char* buff, int buff_len, int flags);
int async_send(int fd, const void* buff, int buff_len, int flags);
int async_connect(int fd, sockaddr* sockaddress, socklen_t len, int flags);
int async_connect(int fd, struct sockaddr* sockaddress, size_t len, int flags);
int async_accept(int fd, sockaddr* sockaddress, socklen_t len, int flags);
int async_accept(int fd, struct sockaddr* sockaddress, size_t len, int flags);
#endif
#ifdef EMPER_ASYNC_DISK_IO
int async_read_file(int fd, unsigned char* buff, size_t count, off_t offset);
int async_read_file(int fd, void* buff, size_t count, off_t offset);
int async_write_file(int fd, const unsigned char* buff, size_t count, off_t offset);
int async_write_file(int fd, const void* buff, size_t count, off_t offset);
#endif
#ifdef __cplusplus
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment