mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
libc: propagate fd flags in socket_fs_plugin
When creating a socket, fd flags can be specified by ORing them with the socket type. Most importantly, the flag SOCK_NONBLOCK must be propagated to the Socket_fs::Context in order to support non-blocking recv/send. genodelabs/genode#4550
This commit is contained in:
parent
7c340b1cc9
commit
a8070a429a
@ -1065,6 +1065,13 @@ extern "C" int socket_fs_socket(int domain, int type, int protocol)
|
||||
Socket_fs::Context(proto, handle_fd);
|
||||
} catch (New_socket_failed) { return Errno(ENFILE); }
|
||||
|
||||
if (context) {
|
||||
int flags = 0;
|
||||
if (type & SOCK_NONBLOCK) flags |= O_NONBLOCK;
|
||||
if (type & SOCK_CLOEXEC) flags |= O_CLOEXEC;
|
||||
context->fd_flags(flags);
|
||||
}
|
||||
|
||||
File_descriptor *fd = file_descriptor_allocator()->alloc(&plugin(), context);
|
||||
if (!fd) {
|
||||
Libc::Allocator alloc { };
|
||||
|
Loading…
Reference in New Issue
Block a user