Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to avoid usage of memfd_create #729

Open
jleibs opened this issue May 18, 2024 · 3 comments
Open

Feature to avoid usage of memfd_create #729

jleibs opened this issue May 18, 2024 · 3 comments

Comments

@jleibs
Copy link

jleibs commented May 18, 2024

Right now memfd_create appears to be used in a single place gated on certain platforms:

// Only try memfd on systems that provide it, (like Linux, Android)
#[cfg(any(target_os = "linux", target_os = "android"))]
loop {
match memfd_create(
CStr::from_bytes_with_nul(b"wayland-cursor-rs\0").unwrap(),
MemfdFlags::CLOEXEC,
) {
Ok(fd) => return Ok(fd),
Err(Errno::INTR) => continue,
Err(Errno::NOSYS) => break,
Err(errno) => return Err(errno.into()),
}
}

For other systems there appears to already be a fallback alternative.

Unfortunately, this creates a dependency on glibc > 2.26, which makes this incompatible with the conda build environment, forcing us to disable wayland support for those builds.

Given the minimal scope and existing fallback this seems like it could be a good candidate for a feature flag instead so we could avoid using it on platforms with an older glibc.

@ids1024
Copy link
Member

ids1024 commented May 18, 2024

So, you're seeing a link error due to glibc not having the memfd_create symbol?

Because I don't think that should happen. (With the latest version of wayland-rs.) rustix should be using direct system calls, unless the use-libc feature is enabled somewhere.

@jleibs
Copy link
Author

jleibs commented May 18, 2024

Exactly. We were getting a link error. Thanks for the pointers. I'll check the versions and see if we're using rustix tomorrow -- we might be one version behind.

@ids1024
Copy link
Member

ids1024 commented May 18, 2024

There might be an older version of wayland-rs somewhere in the dependency tree, from before we moved from nix to rustix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants