> In the next few days, I will focus on reviewing the code of sgx_libc::ocall. > > I have two questions: > > 1. When ocall fails, should errno be set with set_errno? > 2. Should the return value type of the following functions also be of type > OCallResult<T, OCallError>? > mmap > munmap > msync > mprotect > sched_setaffinity > sched_getaffinity > pipe > sched_yield > nanosleep > sigaction > sigprocmask > raise > pthread_sigmask
1. When ocall fails, should errno be set with set_errno? Currently not set. We can set_errno in the `eos!` macro. However, the caller is encouraged to use OCallResult/OCallError to handle all kinds of error (including the OS error), instead of using the conventional `get_errno` function. 2. Should the return value type of the following functions also be of type OCallResult<T, OCallError>? Yes. Ideally, we should make every API in the `sgx_libc` follow the same convention. This PR is still on-going work. Besides return value, we should also unify the parameter conventions based on the semantics of those APIs, such as your comments in `gai_strerror`/`pipe`/`pipe2`. I believe you will find more when digging in `ocall.rs` . The ultimate goal is to provide a better interface with deterministic semantic and sanitized results for Rust callers in the Rust SGX ecosystem. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/apache/incubator-teaclave-sgx-sdk/pull/258#issuecomment-660686480
