Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rule-preprocessor/src/semantic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ fn build_rustc_args(crate_root: &Path) -> Vec<String> {
"rustls_ffi",
"nix",
"jiff",
"xattr",
] {
if let Some(rlib) = find_rlib(deps.as_path(), dep) {
args.push("--extern".to_string());
Expand Down
1 change: 1 addition & 0 deletions rules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ brotli-sys = "0.3"
rustls-ffi = { version = "0.15.3", default-features = false }
nix = { version = "0.30", features = ["socket", "net", "fs", "poll", "time", "user", "dir", "term", "event", "hostname"] }
jiff = "0.2"
xattr = "1"
2 changes: 2 additions & 0 deletions rules/src/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,7 @@ pub mod unistd_tgt_unsafe;
pub mod vector_tgt_refcount;
#[path = r#"../vector/tgt_unsafe.rs"#]
pub mod vector_tgt_unsafe;
#[path = r#"../xattr/tgt_refcount.rs"#]
pub mod xattr_tgt_refcount;
#[path = r#"../xattr/tgt_unsafe.rs"#]
pub mod xattr_tgt_unsafe;
32 changes: 32 additions & 0 deletions rules/xattr/tgt_refcount.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2022-present INESC-ID.
// Distributed under the MIT license that can be found in the LICENSE file.

use libcc2rs::*;

#[cfg(target_os = "linux")]
fn f1(a0: i32, a1: Ptr<u8>, a2: AnyPtr, a3: usize, a4: i32) -> i32 {
match a4 {
0 => {}
__f => panic!("fsetxattr: unsupported flags {}", __f),
}
let __name = a1.to_rust_string();
match FdRegistry::with_fd(a0, |__fd| nix::unistd::dup(__fd)) {
Ok(__dup) => {
let __file = ::std::fs::File::from(__dup);
match a2
.reinterpret_cast::<u8>()
.with_slice(a3, |__v| xattr::FileExt::set_xattr(&__file, &__name, __v))
{
Ok(()) => 0,
Err(__e) => {
libcc2rs::cpp2rust_errno().write(__e.raw_os_error().unwrap_or(::libc::EIO));
-1
}
}
}
Err(__e) => {
libcc2rs::cpp2rust_errno().write(__e as i32);
-1
}
}
}
Loading