diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index fc4c15b8..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "C_Cpp.errorSquiggles": "enabled" -} \ No newline at end of file diff --git a/Justfile b/Justfile index 19d1d9d9..4ab1428e 100644 --- a/Justfile +++ b/Justfile @@ -41,7 +41,3 @@ test-dev: compile pytest probe_src --failed-first --maxfail=1 pre-commit: fix-format-nix fix-ruff fix-format-rust fix-clippy check-clang compile check-mypy test-dev - -pre-commit: fix-format-nix fix-ruff fix-format-rust fix-clippy clang-tidy compile check-mypy test-dev - -on-push: check-format-nix check-ruff check-format-rust check-clippy clang-tidy compile check-mypy check-flake test-ci diff --git a/Makefile b/Makefile deleted file mode 100644 index 91e90242..00000000 --- a/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -all: - mkdir -p experiments - - # Process 14194128: bash -c cat flake.nix > test0; head test0 >tmp ; wc -l test0; head test0 >tmp ; wc -l process_14194128/output.log 2>&1 - # Process 14194128: cat flake.nix - mkdir -p process_14194128 - # Copy input files for process 14194128 - cp flake.nix_v0 process_14194128/ - # Run command for process 14194128 - (cd process_14194128 && cat flake.nix) - # Process 14194128: head test0 - mkdir -p process_14194128 - # Copy input files for process 14194128 - cp test0_v0 process_14194128/ - # Run command for process 14194128 - (cd process_14194128 && head test0) - # Process 14194128: wc -l - mkdir -p process_14194128 - # Copy input files for process 14194128 - cp tmp_v0 process_14194128/ - # Run command for process 14194128 - (wc -l) > process_14194128/output.log 2>&1 \ No newline at end of file diff --git a/probe_src/libprobe/arena/test_arena.c b/probe_src/libprobe/arena/test_arena.c index c02fcbf8..3e490b8f 100644 --- a/probe_src/libprobe/arena/test_arena.c +++ b/probe_src/libprobe/arena/test_arena.c @@ -6,8 +6,10 @@ #include #include #define ARENA_PERROR -#define strncpy_s(dest, destsz, src, count) strncpy(dest, src, count) #include "arena.h" +#define DEFAULT_ARENA_SIZE 4096 +#define HELLO_WORLD_SIZE 12 +#define HELLO_WORLD "hello world" int main() { struct stat stat_buf; @@ -18,22 +20,22 @@ int main() { } errno = 0; struct ArenaDir arena_dir; - int ret = arena_create(&arena_dir, AT_FDCWD, "arena_data", 4096); + int ret = arena_create(&arena_dir, AT_FDCWD, "arena_data", DEFAULT_ARENA_SIZE); assert(ret == 0); /* This will copy strings into the arena. * Eventually, it will overflow the first arena, causing a second to be allocated. * */ - for (size_t i = 0; i < 4000; ++i) { - char* foo = arena_calloc(&arena_dir, 12, sizeof(char)); + for (size_t i = 0; i < DEFAULT_ARENA_SIZE - HELLO_WORLD_SIZE - 1; ++i) { + char* foo = arena_calloc(&arena_dir, HELLO_WORLD_SIZE, sizeof(char)); assert(foo); - strncpy_s(foo, 12, "hello world", 12); + strncpy(foo, HELLO_WORLD, HELLO_WORLD_SIZE); arena_uninstantiate_all_but_last(&arena_dir); arena_uninstantiate_all_but_last(&arena_dir); } /* This is greater than the old capacity of the arena */ - char* foo = arena_calloc(&arena_dir, 81920, sizeof(char)); + char* foo = arena_calloc(&arena_dir, 2 * DEFAULT_ARENA_SIZE, sizeof(char)); assert(foo); - strncpy_s(foo, 40,"this is a reaaally long string", 40); + strncpy(foo, HELLO_WORLD, HELLO_WORLD_SIZE); /* This next line is totally optional */ /* arena_destroy(&arena_dir); */ return 0; diff --git a/probe_src/libprobe/src/declarations.h b/probe_src/libprobe/src/declarations.h index 02e0dddd..d43927dc 100644 --- a/probe_src/libprobe/src/declarations.h +++ b/probe_src/libprobe/src/declarations.h @@ -2,9 +2,10 @@ #include -#define ARENA_USE_UNWRAPPED_LIBC +#ifndef NDEBUG #define ARENA_PERROR -#define unwrapped_openat openat +#endif +#define ARENA_USE_UNWRAPPED_LIBC #include "../arena/include/arena.h" /* diff --git a/probe_src/libprobe/src/lib.c b/probe_src/libprobe/src/lib.c index fc12a9c0..58d6708d 100644 --- a/probe_src/libprobe/src/lib.c +++ b/probe_src/libprobe/src/lib.c @@ -26,11 +26,10 @@ static __thread bool __thread_inited = false; #include "../generated/libc_hooks.h" -#include "declarationss.h" +#include "declarations.h" #include "util.h" - #include "../include/libprobe/prov_ops.h" #include "global_state.c" diff --git a/probe_src/libprobe/src/util.h b/probe_src/libprobe/src/util.h index dcf1a11c..ae0d32d1 100644 --- a/probe_src/libprobe/src/util.h +++ b/probe_src/libprobe/src/util.h @@ -131,7 +131,7 @@ static pid_t my_gettid(){ ret; \ }) -static OWNED char* path_join(BORROWED char* path_buf, size_t left_size, BORROWED const char* left, size_t right_size, BORROWED const char* right) { +static OWNED char* path_join(BORROWED char* path_buf, int left_size, BORROWED const char* left, int right_size, BORROWED const char* right) { if (left_size == -1) { left_size = strlen(left); } @@ -234,7 +234,7 @@ static bool is_dir(const char* dir) { static OWNED const char* dirfd_path(int dirfd) { static char dirfd_proc_path[PATH_MAX]; - CHECK_SNPRINTF(dirfd_proc_path, (unsigned long) PATH_MAX, "/proc/self/fd/%d", dirfd); + CHECK_SNPRINTF(dirfd_proc_path, PATH_MAX, "/proc/self/fd/%d", dirfd); char* resolved_buffer = malloc(PATH_MAX); const char* ret = unwrapped_realpath(dirfd_proc_path, resolved_buffer); return ret;