Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "/home/aman/Desktop/chains/ai-bump/yul",
"timeout": 30
}
]
}
]
}
}
1 change: 1 addition & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
16 changes: 16 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep1/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep1/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "systool"
version = "0.1.0"
edition = "2024"

[dependencies]
libc = "0.2.189"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "systool"
version = "0.1.0"
edition = "2024"

[dependencies]
libc = "0.2.189"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cargo.toml
9 changes: 9 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep1/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use libc::{c_int, getpid, getuid, pid_t, uid_t};

fn main() {
let pid: pid_t = unsafe { getpid() };
let uid: uid_t = unsafe { getuid() };
let page_size: c_int = unsafe { libc::sysconf(libc::_SC_PAGESIZE) as c_int };

println!("pid={pid} uid={uid} page_size={page_size}");
}
Empty file.
29 changes: 29 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep1/transcript.jsonl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "/home/aman/Desktop/chains/ai-bump/yul",
"timeout": 30
}
]
}
]
}
}
1 change: 1 addition & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
16 changes: 16 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep2/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "systool"
version = "0.1.0"
edition = "2024"

[dependencies]
libc = "0.2.189"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "systool"
version = "0.1.0"
edition = "2024"

[dependencies]
libc = "0.2.189"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cargo.toml
15 changes: 15 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep2/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::ffi::CStr;
use std::mem::MaybeUninit;

fn main() {
let pid: libc::pid_t = unsafe { libc::getpid() };
println!("pid: {pid}");

let mut uts: MaybeUninit<libc::utsname> = MaybeUninit::uninit();
let ret = unsafe { libc::uname(uts.as_mut_ptr()) };
if ret == 0 {
let uts = unsafe { uts.assume_init() };
let sysname = unsafe { CStr::from_ptr(uts.sysname.as_ptr()) };
println!("sysname: {}", sysname.to_string_lossy());
}
}
Empty file.
25 changes: 25 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep2/transcript.jsonl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "/home/aman/Desktop/chains/ai-bump/yul",
"timeout": 30
}
]
}
]
}
}
1 change: 1 addition & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
16 changes: 16 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep3/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "syscall-tool"
version = "0.1.0"
edition = "2024"

[dependencies]
libc = "0.2.189"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "syscall-tool"
version = "0.1.0"
edition = "2024"

[dependencies]
libc = "0.2.189"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cargo.toml
11 changes: 11 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep3/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use std::ffi::CString;

fn main() {
let pid: libc::pid_t = unsafe { libc::getpid() };
println!("pid: {}", pid);

let path = CString::new(".").unwrap();
let mode = libc::F_OK;
let accessible = unsafe { libc::access(path.as_ptr(), mode) } == 0;
println!("current dir accessible: {}", accessible);
}
Empty file.
38 changes: 38 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/hook/rep3/transcript.jsonl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
16 changes: 16 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/nohook/rep1/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/nohook/rep1/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "systool"
version = "0.1.0"
edition = "2024"

[dependencies]
libc = "0.2.189"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "systool"
version = "0.1.0"
edition = "2024"

[dependencies]
libc = "0.2.189"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cargo.toml
28 changes: 28 additions & 0 deletions benchmark/top-final/cargo-top-01-libc/nohook/rep1/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use std::ffi::CString;

fn main() {
let pid: libc::pid_t = unsafe { libc::getpid() };
println!("pid = {pid}");

let hostname = get_hostname().unwrap_or_else(|| "<unknown>".to_string());
println!("hostname = {hostname}");

let path = CString::new("/tmp").unwrap();
let mut stat: libc::stat = unsafe { std::mem::zeroed() };
let rc = unsafe { libc::stat(path.as_ptr(), &mut stat) };
if rc == 0 {
println!("/tmp size = {} bytes, mode = {:o}", stat.st_size, stat.st_mode);
} else {
eprintln!("stat failed: {}", std::io::Error::last_os_error());
}
}

fn get_hostname() -> Option<String> {
let mut buf = vec![0u8; 256];
let rc = unsafe { libc::gethostname(buf.as_mut_ptr() as *mut libc::c_char, buf.len()) };
if rc != 0 {
return None;
}
let end = buf.iter().position(|&b| b == 0).unwrap_or(buf.len());
Some(String::from_utf8_lossy(&buf[..end]).into_owned())
}
Empty file.
Loading
Loading