Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
f4grx
NuttX RTOS
Commits
b5dd7061
Commit
b5dd7061
authored
11 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
poll needs to set POLLNVAL if file descriptor is bad
parent
9d280a58
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+2
-0
2 additions, 0 deletions
ChangeLog
fs/fs_poll.c
+28
-15
28 additions, 15 deletions
fs/fs_poll.c
with
30 additions
and
15 deletions
ChangeLog
+
2
−
0
View file @
b5dd7061
...
...
@@ -4777,3 +4777,5 @@
* net/net_poll.c: When readahead data is availalbe, the network poll
logic should set POLLIN (or POLLRDNORM), not POLLOUT. Max Holtzberg
(2013-5-23)
* fs/fs_poll.c: Actually, it should not ignore invlid descriptors, it
should set the POLLNVAL event and return immediately (2013-5-23).
This diff is collapsed.
Click to expand it.
fs/fs_poll.c
+
28
−
15
View file @
b5dd7061
...
...
@@ -163,17 +163,30 @@ static inline int poll_setup(FAR struct pollfd *fds, nfds_t nfds, sem_t *sem)
for
(
i
=
0
;
i
<
nfds
;
i
++
)
{
/*
Ignore negative
descriptor
s
*/
/*
Setup the poll
descriptor */
if
(
fds
[
i
].
fd
>=
0
)
fds
[
i
].
sem
=
sem
;
fds
[
i
].
priv
=
NULL
;
/* Check for invalid descriptors */
if
(
fds
[
i
].
fd
<
0
)
{
/* Set
up the poll descripto
r */
/* Set
POLLNVAL to indicate the invalid fd membe
r */
fds
[
i
].
sem
=
sem
;
fds
[
i
].
revents
=
0
;
fds
[
i
].
priv
=
NULL
;
fds
[
i
].
revents
=
POLLNVAL
;
/* And increment the semaphore so that poll will return
* immediately (but with a successful return value).
*/
sem_post
(
sem
);
}
else
{
/* Set up the poll on this valid file descriptor */
/* Set up the poll */
fds
[
i
].
revents
=
0
;
ret
=
poll_fdsetup
(
fds
[
i
].
fd
,
&
fds
[
i
],
true
);
if
(
ret
<
0
)
...
...
@@ -219,18 +232,18 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count)
{
ret
=
status
;
}
}
/* Check if any events were posted */
/* Check if any events were posted */
if
(
fds
[
i
].
revents
!=
0
)
{
(
*
count
)
++
;
}
if
(
fds
[
i
].
revents
!=
0
)
{
(
*
count
)
++
;
}
/* Un-initialize the poll structure */
/* Un-initialize the poll structure */
fds
[
i
].
sem
=
NULL
;
}
fds
[
i
].
sem
=
NULL
;
}
return
ret
;
...
...
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