[Glacier] Convert ErrorCode into an Enum.
This commit is contained in:
parent
bcd9cf09bc
commit
e66706d381
14 changed files with 77 additions and 66 deletions
|
|
@ -29,7 +29,8 @@ class ResponseContext {
|
|||
code,
|
||||
};
|
||||
written_ = true;
|
||||
return ZReplyPortSend(reply_port_, sizeof(response), &response, 0, nullptr);
|
||||
return static_cast<glcr::ErrorCode>(
|
||||
ZReplyPortSend(reply_port_, sizeof(response), &response, 0, nullptr));
|
||||
}
|
||||
|
||||
bool HasWritten() { return written_; }
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ void EndpointServer::ServerThread() {
|
|||
uint64_t message_size = kBufferSize;
|
||||
uint64_t reply_port_cap = 0;
|
||||
uint64_t num_caps = 0;
|
||||
glcr::ErrorCode err =
|
||||
glcr::ErrorCode err = static_cast<glcr::ErrorCode>(
|
||||
ZEndpointRecv(endpoint_cap_, &message_size, recieve_buffer_, &num_caps,
|
||||
nullptr, &reply_port_cap);
|
||||
nullptr, &reply_port_cap));
|
||||
if (err != glcr::OK) {
|
||||
dbgln("Error in receive: %x", err);
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -19,5 +19,9 @@ glcr::ErrorOr<Mutex> Mutex::Create() {
|
|||
return Mutex(mutex_cap);
|
||||
}
|
||||
|
||||
glcr::ErrorCode Mutex::Lock() { return ZMutexLock(mutex_cap_); }
|
||||
glcr::ErrorCode Mutex::Release() { return ZMutexRelease(mutex_cap_); }
|
||||
glcr::ErrorCode Mutex::Lock() {
|
||||
return static_cast<glcr::ErrorCode>(ZMutexLock(mutex_cap_));
|
||||
}
|
||||
glcr::ErrorCode Mutex::Release() {
|
||||
return static_cast<glcr::ErrorCode>(ZMutexRelease(mutex_cap_));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@ PortClient PortClient::AdoptPort(z_cap_t cap) { return PortClient(cap); }
|
|||
PortClient::PortClient(z_cap_t port_cap) : port_cap_(port_cap) {}
|
||||
|
||||
glcr::ErrorCode PortClient::WriteString(glcr::String str, z_cap_t cap) {
|
||||
return ZPortSend(port_cap_, str.length() + 1, str.cstr(), 1, &cap);
|
||||
return static_cast<glcr::ErrorCode>(
|
||||
ZPortSend(port_cap_, str.length() + 1, str.cstr(), 1, &cap));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ glcr::ErrorCode PortServer::RecvCap(uint64_t *num_bytes, char *msg,
|
|||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t PortServer::PollForIntCap(uint64_t *msg, uint64_t *cap) {
|
||||
glcr::ErrorCode PortServer::PollForIntCap(uint64_t *msg, uint64_t *cap) {
|
||||
uint64_t bytes = sizeof(uint64_t);
|
||||
uint64_t caps = 1;
|
||||
RET_ERR(ZPortPoll(port_cap_, &bytes, reinterpret_cast<uint8_t *>(msg), &caps,
|
||||
|
|
|
|||
|
|
@ -22,4 +22,6 @@ Thread::Thread(Entry e, const void* arg1) {
|
|||
reinterpret_cast<uint64_t>(arg1)));
|
||||
}
|
||||
|
||||
glcr::ErrorCode Thread::Join() { return ZThreadWait(thread_cap_); }
|
||||
glcr::ErrorCode Thread::Join() {
|
||||
return static_cast<glcr::ErrorCode>(ZThreadWait(thread_cap_));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue