Replace sendStringResp() with sendStringRespSync()

This commit is contained in:
Andreas Hampicke 2016-06-26 23:43:49 +02:00
parent 910dee08eb
commit c15cd01636
4 changed files with 53 additions and 26 deletions

View file

@ -13,7 +13,7 @@ $c_OBJECT_PATHS := $(addprefix $($c_OBJDIR)/,$($c_OBJECTS))
$c_AS := x86_64-managarm-as
$c_CXX := x86_64-managarm-g++
$c_CPPFLAGS := -std=c++11 -Wall
$c_CPPFLAGS := -std=c++14 -Wall
$c_CPPFLAGS += -I$(FRIGG_PATH)/include
$c_CPPFLAGS += -I$(TREE_PATH)/libc/generic/ansi/include
$c_CPPFLAGS += -I$(TREE_PATH)/libc/generic/posix/include

View file

@ -49,8 +49,10 @@ int fstat(int fd, struct stat *result) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;
@ -95,8 +97,10 @@ int open(const char *path, int flags, ...) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;
@ -127,8 +131,10 @@ ssize_t read(int fd, void *buffer, size_t size){
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
uint8_t msg_buffer[128];
size_t length;
@ -166,8 +172,10 @@ ssize_t write(int fd, const void *buffer, size_t size) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
uint8_t msg_buffer[128];
size_t length;
@ -207,8 +215,10 @@ off_t lseek(int fd, off_t offset, int whence) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
uint8_t buffer[128];
size_t length;
@ -237,8 +247,10 @@ int close(int fd) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
uint8_t buffer[128];
size_t length;
@ -268,8 +280,10 @@ int dup2(int src_fd, int dest_fd) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;
@ -303,8 +317,10 @@ int isatty(int fd) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;
@ -335,8 +351,10 @@ char *ttyname(int fd) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;

View file

@ -41,8 +41,10 @@ extern "C" pid_t __mlibc_doFork(uintptr_t child_ip, uintptr_t child_sp) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;
@ -84,8 +86,10 @@ pid_t getpid(void) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;
@ -115,7 +119,10 @@ int execve(const char *path, char *const argv[], char *const envp[]) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(), request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;

View file

@ -25,8 +25,10 @@ int connect(int fd, const struct sockaddr *address, socklen_t addr_length) {
int64_t request_num = allocPosixRequest();
frigg::String<MemoryAllocator> serialized(*memoryAllocator);
request.SerializeToString(&serialized);
posixPipe->sendStringReq(serialized.data(), serialized.size(),
request_num, 0);
HelError error;
posixPipe->sendStringReqSync(serialized.data(), serialized.size(),
*eventHub, request_num, 0, error);
HEL_CHECK(error);
int8_t buffer[128];
size_t length;