Skip to content

Commit

Permalink
[refactor] use libwayshot for shm
Browse files Browse the repository at this point in the history
Signed-off-by: Shinyzenith <[email protected]>
  • Loading branch information
Shinyzenith committed Jul 3, 2023
1 parent 23988b7 commit 402793d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 186 deletions.
183 changes: 0 additions & 183 deletions 0001-wayshot-stash.patch

This file was deleted.

6 changes: 3 additions & 3 deletions libwayshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ fn create_shm_fd() -> std::io::Result<RawFd> {
loop {
// Create a file that closes on succesful execution and seal it's operations.
match memfd::memfd_create(
CStr::from_bytes_with_nul(b"wayshot\0").unwrap(),
CStr::from_bytes_with_nul(b"libwayshot\0").unwrap(),
memfd::MemFdCreateFlag::MFD_CLOEXEC | memfd::MemFdCreateFlag::MFD_ALLOW_SEALING,
) {
Ok(fd) => {
Expand All @@ -368,7 +368,7 @@ fn create_shm_fd() -> std::io::Result<RawFd> {
// Fallback to using shm_open.
let sys_time = SystemTime::now();
let mut mem_file_handle = format!(
"/wayshot-{}",
"/libwayshot-{}",
sys_time.duration_since(UNIX_EPOCH).unwrap().subsec_nanos()
);
loop {
Expand Down Expand Up @@ -396,7 +396,7 @@ fn create_shm_fd() -> std::io::Result<RawFd> {
Err(nix::errno::Errno::EEXIST) => {
// If a file with that handle exists then change the handle
mem_file_handle = format!(
"/wayshot-{}",
"/libwayshot-{}",
sys_time.duration_since(UNIX_EPOCH).unwrap().subsec_nanos()
);
continue;
Expand Down

0 comments on commit 402793d

Please sign in to comment.