This is an automated email from the ASF dual-hosted git repository.
rduan pushed a commit to branch v2.0.0-preview
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git
The following commit(s) were added to refs/heads/v2.0.0-preview by this push:
new b729101a add epoll_create
b729101a is described below
commit b729101a5c056634a0fb3ec2a9575bf36ee160e4
Author: douchuan <[email protected]>
AuthorDate: Thu Oct 27 09:01:29 2022 +0000
add epoll_create
---
common/inc/tlibc/sys/epoll.h | 1 +
sgx_libc/src/linux/ocall/asyncio.rs | 9 +++++++++
sgx_oc/src/linux/ocall/asyncio.rs | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/common/inc/tlibc/sys/epoll.h b/common/inc/tlibc/sys/epoll.h
index e6ac1b17..5f61d356 100644
--- a/common/inc/tlibc/sys/epoll.h
+++ b/common/inc/tlibc/sys/epoll.h
@@ -43,6 +43,7 @@ struct epoll_event {
// ocall
int epoll_create1(int);
+int epoll_create(int);
int epoll_ctl(int, int, int, struct epoll_event *);
int epoll_wait(int, struct epoll_event *, int, int);
diff --git a/sgx_libc/src/linux/ocall/asyncio.rs
b/sgx_libc/src/linux/ocall/asyncio.rs
index 5c6fa6d7..34d9678f 100644
--- a/sgx_libc/src/linux/ocall/asyncio.rs
+++ b/sgx_libc/src/linux/ocall/asyncio.rs
@@ -49,6 +49,15 @@ pub unsafe extern "C" fn epoll_create1(flags: c_int) ->
c_int {
}
}
+#[no_mangle]
+pub unsafe extern "C" fn epoll_create(size: c_int) -> c_int {
+ if let Ok(fd) = ocall::epoll_create(size) {
+ fd
+ } else {
+ -1
+ }
+}
+
#[no_mangle]
pub unsafe extern "C" fn epoll_ctl(
epfd: c_int,
diff --git a/sgx_oc/src/linux/ocall/asyncio.rs
b/sgx_oc/src/linux/ocall/asyncio.rs
index 6b70aaa8..d100de49 100644
--- a/sgx_oc/src/linux/ocall/asyncio.rs
+++ b/sgx_oc/src/linux/ocall/asyncio.rs
@@ -60,6 +60,11 @@ pub unsafe fn epoll_create1(flags: c_int) ->
OCallResult<c_int> {
Ok(result)
}
+pub unsafe fn epoll_create(size: c_int) -> OCallResult<c_int> {
+ ensure!(size > 0, eos!(EINVAL));
+ epoll_create1(0)
+}
+
pub unsafe fn epoll_ctl(
epfd: c_int,
op: c_int,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]