Commit Graph

28 Commits

Author SHA1 Message Date
ClawSeven
e96a1348e5 [test] Implement ut for sigsuspend 2024-03-06 15:59:26 +08:00
ClawSeven
d27f0d5cd0 [libos] Implement Pselect syscall with sigset 2024-03-06 15:59:26 +08:00
Hui, Chunyang
6cb9ca7e44 Add sendmsg/recvmsg support for unix domain socket 2022-08-23 20:37:57 +08:00
LI Qing
fc7ba98ded Add ppoll 2021-11-24 16:52:25 +08:00
Hui, Chunyang
bad2581a25 Add dummy implementation of getsockopt for unix domain socket 2021-06-10 20:50:30 +08:00
Hui, Chunyang
0dc85f8229 Add support for indexing unix domain socket file with inode 2021-06-10 20:50:30 +08:00
zongmin.gu
070bdf6f39 Add sendmmsg syscall 2021-06-03 16:24:34 +08:00
He Sun
3b915db774 Refactor Unix socket
1. Implement type-safe functions;
2. Improve the correctness of nearly all the functions;
3. Improve the readability by introducing Listener and Endpoint for StreamUnix;
4. Substitue RingBuf with Channel in Unix socket.
2020-12-16 01:28:53 +08:00
Tate, Hongliang Tian
1de089ac7d Rewrite the select syscall using the new poll implementation 2020-11-18 19:35:04 +08:00
Tate, Hongliang Tian
71df1cf2c8 Add the new poll implementation 2020-11-12 15:49:20 +08:00
Tate, Hongliang Tian
6fdfa57a14 Add the new epoll implementation
Before this commit, the epoll implementation works by simply delegating to the
host OS through OCall. One major problem with this implementation is
that it can only handle files that are backed by a file of the host OS
(e.g., sockets), but not those are are mainly implemented by the LibOS
(e.g., pipes). Therefore, a new epoll implementation that can handle all
kinds of files is needed.

This commit completely rewrites the epoll implementation by leveraging
the new event subsystem. Now the new epoll can handle all file types:

1. Host files, e.g., sockets, eventfd;
2. LibOS files, e.g., pipes;
3. Hybrid files, e.g., epoll files.

For a new file type to support epoll, it only neends to implement no
more than four methods of the File trait:

* poll (required for all file types);
* notifier (required for all file files);
* host_fd (only required for host files);
* recv_host_events (only required for host files).
2020-11-10 14:34:40 +08:00
Tate, Hongliang Tian
2ff4b1c776 Reduce the FileRef type to Arc<dyn File>
The FileRef type was defined as Arc<Box<dyn File>>, where the use of Box is
unnecessary. This commit reduces the type to Arc<dyn File>.
2020-11-10 14:34:40 +08:00
He Sun
d590486029 Refactor host socket
1. Add Rust memory-safe types, e.g., socket_address, address_family and socket_type;
2. Implement Berkeley Sockets API for HostSocket.
2020-10-21 12:24:00 +08:00
He Sun
5d5e8d44ec Pass host-generated SIGPIPE to libos
Socket-related ocalls, e.g, sendto, sendmsg and write, may cause SIGPIPE
in host. Since the ocall is called by libos, this kind of signal should
be handled in libos. We ignore SIGPIPE in host and raise the same signal
in libos if the return value of the above ocalls is EPIPE. In this way
the signal is handled by libos.
2020-09-18 12:39:12 +08:00
He Sun
c85163ec0a Add notification mechanism for basic IO events
1. Add notification mechanism for select, poll, epoll and blocking IO
2. Add pipe support for select, poll and blocking IO
2020-07-18 00:27:26 +08:00
He Sun
eb4bb860ce Add the unix socket support for sendto system call 2020-06-03 17:57:38 +08:00
He Sun
987e06a458 Move networking system call interfaces to net module 2020-06-03 17:57:38 +08:00
He Sun
cd2f13ae54 Refactor select syscall
1. Substitute the underlying poll OCall to select OCall to update the
timeout argument correctly.
2. Add more checks for the inputs.
2020-05-26 11:44:46 +08:00
He Sun
f9486bf7a9 Add resource limit check for the number of the fds in poll 2020-05-15 03:02:42 +00:00
He Sun
bbb52f6990 Refine check for pointers from user space and outside enclave
Implement the check functions that are empty before and do some
adjustment where they are called.
2020-05-15 02:59:16 +00:00
Tate, Hongliang Tian
2a1d3d98c5 Refactor the process/thread subsystem
As a major rewrite to the process/thread subsystem, this commits:
1. Implements threads as a first-class object, which represents a group of OS resources
and a thread of execution;
2. Implements processes as a first-class object that manages threads and maintains
the parent-child relationship between processes;
3. Refactors the code in process subsystem to follow the improved coding style and
conventions emerged in recent commits;
4. Refactors the code in other subsystems to use the new process/thread subsystem.
2020-04-15 06:22:41 +00:00
He Sun
221f5b78e8 Rewrite epoll implementation and the test 2020-04-02 17:43:24 +08:00
Tate, Hongliang Tian
1a35188212 Simplify the frequent code of getting a file reference 2020-03-26 10:34:14 +00:00
Tate, Hongliang Tian
5933499f9b Refactor LibOS to conform with logging strategy
This commit introduces a unified logging strategy, summarized as below:

1. Use `error!` to mark errors or unexpected conditions, e.g., a
 `Result::Err` returned from a system call.
2. Use `warn!` to warn about potentially problematic issues, e.g.,
 executing a workaround or fake implementation.
3. Use `info!` to show important events (from users' perspective) in
 normal execution, e.g., creating/exiting a process/thread.
4. Use `debug!` to track major events in normal execution, e.g., the
 high-level arguments of a system call.
5. Use `trace!` to record the most detailed info, e.g., when a system
 call enters and exits the LibOS.
2020-03-25 02:53:31 +00:00
He Sun
65694815a4 Add eventfd file type and system call 2020-03-24 22:16:41 +08:00
He Sun
e2edaa49c0 Change the flags used in sendmsg/recvmsg from raw int to memory-safe type 2020-03-24 21:51:04 +08:00
LI Qing
de904bf628 Refactor the structure of FS subsystem
1. Move the system call handling functions into the "syscalls.rs"
2. Split syscall memory safe implementations into small sub-modules
3. Move the unix_socket and io_multiplexing into "net"
4. Remove some unnecessary code
2020-02-14 06:19:49 +00:00
He Sun
0cef5b1b53 Add sendmsg/recvmsg syscalls
1. Add a separate net/ directory for the network subsystem;
2. Move some existing socket code to net/;
3. Implement sendmsg/recvmsg with OCalls;
4. Extend client/server test cases.
2019-12-13 12:00:55 +00:00