Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Limkilde Svendsen
relibc
Commits
662051a9
Verified
Commit
662051a9
authored
5 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Only call epoll_ctl once per descriptor, fixing vim on Redox
parent
4c4ce7ec
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/header/sys_select/mod.rs
+41
-43
41 additions, 43 deletions
src/header/sys_select/mod.rs
with
41 additions
and
43 deletions
src/header/sys_select/mod.rs
+
41
−
43
View file @
662051a9
...
...
@@ -54,57 +54,55 @@ pub fn select_epoll(
// Keep track of the number of file descriptors that do not support epoll
let
mut
not_epoll
=
0
;
for
fd
in
0
..
nfds
{
if
let
Some
(
ref
mut
fd_set
)
=
read_bitset
{
let
mut
events
=
0
;
if
let
Some
(
ref
fd_set
)
=
read_bitset
{
if
fd_set
.contains
(
fd
as
usize
)
{
let
mut
event
=
epoll_event
{
events
:
EPOLLIN
,
data
:
epoll_data
{
fd
},
..
Default
::
default
()
};
if
epoll_ctl
(
*
ep
,
EPOLL_CTL_ADD
,
fd
,
&
mut
event
)
<
0
{
if
unsafe
{
platform
::
errno
==
errno
::
EPERM
}
{
not_epoll
+=
1
;
}
else
{
return
-
1
;
}
}
else
{
fd_set
.remove
(
fd
as
usize
);
}
events
|
=
EPOLLIN
;
}
}
if
let
Some
(
ref
mut
fd_set
)
=
write_bitset
{
if
let
Some
(
ref
fd_set
)
=
write_bitset
{
if
fd_set
.contains
(
fd
as
usize
)
{
let
mut
event
=
epoll_event
{
events
:
EPOLLOUT
,
data
:
epoll_data
{
fd
},
..
Default
::
default
()
};
if
epoll_ctl
(
*
ep
,
EPOLL_CTL_ADD
,
fd
,
&
mut
event
)
<
0
{
if
unsafe
{
platform
::
errno
==
errno
::
EPERM
}
{
not_epoll
+=
1
;
}
else
{
return
-
1
;
}
}
else
{
fd_set
.remove
(
fd
as
usize
);
}
events
|
=
EPOLLOUT
;
}
}
if
let
Some
(
ref
mut
fd_set
)
=
except_bitset
{
if
let
Some
(
ref
fd_set
)
=
except_bitset
{
if
fd_set
.contains
(
fd
as
usize
)
{
let
mut
event
=
epoll_event
{
events
:
EPOLLERR
,
data
:
epoll_data
{
fd
},
..
Default
::
default
()
};
if
epoll_ctl
(
*
ep
,
EPOLL_CTL_ADD
,
fd
,
&
mut
event
)
<
0
{
if
unsafe
{
platform
::
errno
==
errno
::
EPERM
}
{
not_epoll
+=
1
;
}
else
{
return
-
1
;
}
events
|
=
EPOLLERR
;
}
}
if
events
>
0
{
let
mut
event
=
epoll_event
{
events
,
data
:
epoll_data
{
fd
},
..
Default
::
default
()
};
if
epoll_ctl
(
*
ep
,
EPOLL_CTL_ADD
,
fd
,
&
mut
event
)
<
0
{
if
unsafe
{
platform
::
errno
==
errno
::
EPERM
}
{
not_epoll
+=
1
;
}
else
{
fd_set
.remove
(
fd
as
usize
);
return
-
1
;
}
}
else
{
if
let
Some
(
ref
mut
fd_set
)
=
read_bitset
{
if
fd_set
.contains
(
fd
as
usize
)
{
fd_set
.remove
(
fd
as
usize
);
}
}
if
let
Some
(
ref
mut
fd_set
)
=
write_bitset
{
if
fd_set
.contains
(
fd
as
usize
)
{
fd_set
.remove
(
fd
as
usize
);
}
}
if
let
Some
(
ref
mut
fd_set
)
=
except_bitset
{
if
fd_set
.contains
(
fd
as
usize
)
{
fd_set
.remove
(
fd
as
usize
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment