x11: Use POSIX shared memory in X11 backend

The X11 backend used System-V shared memory to communicate shared
buffers to the server, but rustix does not support SysV SHM so we had to
use libc in this backend. However, there is an alternate X11 API which
uses POSIX shared memory, which rustix does support. This PR switches
the X11 backend to POSIX shared memory and purges the previous
usages of libc.

The goal is to remove libc totally. Therefore this PR also removes the
default libc dependency from rustix.

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2023-10-17 19:15:15 -07:00 committed by GitHub
parent a405e0341d
commit c0e8723081
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 45 deletions

View file

@ -333,7 +333,8 @@ impl BufferImpl<'_> {
// returns `ENOSYS` and check that before allocating the above and running this.
match self.display.dirty_framebuffer(self.front_fb, &rectangles) {
Ok(()) => {}
Err(drm::SystemError::Unknown { errno }) if errno as i32 == libc::ENOSYS => {}
Err(drm::SystemError::Unknown { errno })
if errno as i32 == rustix::io::Errno::NOSYS.raw_os_error() => {}
Err(e) => {
return Err(SoftBufferError::PlatformError(
Some("failed to dirty framebuffer".into()),