Skip to content

Commit

Permalink
Merge pull request #902 from Dennisbonke/epoll
Browse files Browse the repository at this point in the history
sysdeps/managarm: Make epoll_create accept O_CLOEXEC too
  • Loading branch information
Geertiebear authored Aug 19, 2023
2 parents c8003bb + a912c1b commit 2291899
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sysdeps/managarm/generic/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,12 +1105,14 @@ int sys_poll(struct pollfd *fds, nfds_t count, int timeout, int *num_events) {
}

int sys_epoll_create(int flags, int *fd) {
__ensure(!(flags & ~(EPOLL_CLOEXEC)));
// Some applications assume EPOLL_CLOEXEC and O_CLOEXEC to be the same.
// They are on linux, but not yet on managarm.
__ensure(!(flags & ~(EPOLL_CLOEXEC | O_CLOEXEC)));

SignalGuard sguard;

uint32_t proto_flags = 0;
if(flags & EPOLL_CLOEXEC)
if(flags & EPOLL_CLOEXEC || flags & O_CLOEXEC)
proto_flags |= managarm::posix::OpenFlags::OF_CLOEXEC;

managarm::posix::CntRequest<MemoryAllocator> req(getSysdepsAllocator());
Expand Down

0 comments on commit 2291899

Please sign in to comment.