-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle select() calls that update status for fds beyond FD_SETSIZE
This also makes smaller select()s slightly more efficient. Resolves #3612
- Loading branch information
1 parent
79dbdd5
commit 9232147
Showing
3 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -911,6 +911,7 @@ set(BASIC_TESTS | |
bad_syscall | ||
barrier | ||
big_buffers | ||
big_select | ||
block | ||
block_open | ||
bpf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */ | ||
|
||
#include "util.h" | ||
|
||
#define NUM_LONGS (FD_SETSIZE/(8 * sizeof(long)) + 1) | ||
|
||
int main(void) { | ||
struct { | ||
long longs[NUM_LONGS]; | ||
} *fdset; | ||
int ret; | ||
struct timeval timeout = { 0, 0 }; | ||
struct rlimit rlim = { FD_SETSIZE + 1, FD_SETSIZE + 1 }; | ||
if (setrlimit(RLIMIT_NOFILE, &rlim)) { | ||
atomic_puts("Can't set necessary rlimit, skipping test"); | ||
atomic_puts("EXIT-SUCCESS"); | ||
return 0; | ||
} | ||
|
||
ret = dup2(0, FD_SETSIZE); | ||
test_assert(ret == FD_SETSIZE); | ||
|
||
ALLOCATE_GUARD(fdset, 'a'); | ||
memset(fdset->longs, 0, sizeof(fdset->longs)); | ||
fdset->longs[NUM_LONGS - 1] = -1; | ||
ret = select(FD_SETSIZE + 1, (fd_set*)fdset, NULL, NULL, &timeout); | ||
test_assert(ret == 0); | ||
VERIFY_GUARD(fdset); | ||
|
||
test_assert(fdset->longs[NUM_LONGS - 1] == 0); | ||
|
||
atomic_puts("EXIT-SUCCESS"); | ||
return 0; | ||
} |
9232147
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
block-32
failed on CI with an EINVAL from select, which seems likely related. FYI.