Skip to content

Commit 4f4cffa

Browse files
committed
allow memfd_create to be used with older glibc (<2.27)
1 parent 2f4861f commit 4f4cffa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/sys/memfd.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ pub fn memfd_create(name: &CStr, flags: MemFdCreateFlag) -> Result<OwnedFd> {
4848
// Android does not have a memfd_create symbol
4949
not(target_os = "android"),
5050
any(
51+
// Note that memfd_create is available since release 13.0
52+
// See https://man.freebsd.org/cgi/man.cgi?query=memfd_create
5153
target_os = "freebsd",
52-
// If the OS is Linux, gnu and musl expose a memfd_create symbol but not uclibc
53-
target_env = "gnu",
54+
// If the OS is Linux, gnu and musl expose a memfd_create symbol but not uclibc.
55+
// But in glibc it is availible since 2.27. The oldest one officially supported by Rust is 2.17.
56+
// So it is reasonable to keep compatibility with it.
5457
target_env = "musl",
5558
)))]
5659
{

0 commit comments

Comments
 (0)