mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix close_range syscall tests for Linux kernels <5.11
The CLOEXEC flag for close_range was added in 5.11; if CLOEXEC tests are run on earlier versions they will return EINVAL. PiperOrigin-RevId: 537160906
This commit is contained in:
committed by
gVisor bot
parent
3260f6bed6
commit
64d1e9c09b
@@ -216,6 +216,9 @@ TEST_F(CloseRangeTest, CloexecFlagTest) {
|
||||
int num_files_in_range = 10;
|
||||
unsigned int flags = CLOSE_RANGE_CLOEXEC;
|
||||
|
||||
// CLOEXEC is only available on >=5.11 kernels.
|
||||
SKIP_IF(close_range(1, 0, flags) < 0 && errno == EINVAL);
|
||||
|
||||
CreateFiles(num_files_in_range);
|
||||
OpenFilesRdwr();
|
||||
|
||||
@@ -318,6 +321,9 @@ TEST_F(CloseRangeTest, CloexecAndUnshareFlagTest) {
|
||||
int num_files_in_range = 10;
|
||||
unsigned int flags = CLOSE_RANGE_CLOEXEC | CLOSE_RANGE_UNSHARE;
|
||||
|
||||
// CLOEXEC is only available on >=5.11 kernels.
|
||||
SKIP_IF(close_range(1, 0, flags) < 0 && errno == EINVAL);
|
||||
|
||||
CreateFiles(num_files_in_range);
|
||||
OpenFilesRdwr();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user